Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Chinese Solar Lipo powered PIR led lamp.

Chinese Solar Lipo powered PIR led lamp.

Scheduled Pinned Locked Moved My Project
42 Posts 9 Posters 26.5k Views 19 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gyroG gyro

    @GertSanders I think i managed to successfully connect arduino with solar lamp.

    My prototype is working, and has the following functions:

    1. Measure battery voltage (when charging it is alway 100% - makes sense)
    2. Measure solar voltage (can be omitted - but resistor should be there for a transistor to work properly)
    3. Solar power day/night trigger with transistor as a switch (can be used wake up arduino from sleep)
    4. PIR sensor (can be used wake up arduino from sleep)
    5. Lights on/off dimmed brightness
    6. Lights on/off high brightness ( original resistor R9 -1k was replaced with 4.7k - i think it draws to much current and sometimes hangs arduino)

    I will post the code later, but every part works with default "mysensor" examples

    How to connect and how to add elements see picture:
    0_1457202432374_solar_circuit_connect_arduino.jpg

    siklosiS Offline
    siklosiS Offline
    siklosi
    wrote on last edited by
    #20

    @gyro is there a reason you used high/low intensity with resistor instead of PWM?

    gyroG 1 Reply Last reply
    0
    • siklosiS siklosi

      @gyro is there a reason you used high/low intensity with resistor instead of PWM?

      gyroG Offline
      gyroG Offline
      gyro
      wrote on last edited by
      #21

      @siklosi Resistor is used as transisistor base resistor. This was the best way to connect i could think off. But you need two output pins - 2 transistors are controlled.
      first PIN - lights ON/OFF
      second PIN - ligths bright ON/OFF

      1 Reply Last reply
      0
      • D Dylano

        mmm i ordered 1...
        So i hope i gonna ix this...
        It is looking higher mathematics

        Will see... when i have time..
        Thanks for the sketch!!!
        Give it a try in a uno ...

        gyroG Offline
        gyroG Offline
        gyro
        wrote on last edited by gyro
        #22

        @Dylano Great to hear that the light has the same board...please post a picture.
        My light is still protoype connected together on protoboard - connected to arduino pro mini - i can post only a picture connected elements on protoboard for now.
        I am trying to put all together in openhab now.
        I will try to make a list of exact elements.
        I have free D2 pin on arduino pro mini.

        1 Reply Last reply
        0
        • readykalR Offline
          readykalR Offline
          readykal
          wrote on last edited by
          #23

          As the easiest way to disable dimmed mode this lamp?

          1 Reply Last reply
          0
          • korttomaK Offline
            korttomaK Offline
            korttoma
            Hero Member
            wrote on last edited by
            #24

            Got myself a similar PIR LED lamp. The functionality seems like it is the same but the circuit board is different.

            3_1461237714861_WP_20160415_06_56_45_Pro.jpg 2_1461237714860_WP_20160415_06_31_16_Pro.jpg 1_1461237714860_WP_20160415_06_30_18_Pro.jpg 0_1461237714859_WP_20160415_06_24_35_Pro.jpg

            • Tomas
            gyroG 1 Reply Last reply
            0
            • korttomaK korttoma

              Got myself a similar PIR LED lamp. The functionality seems like it is the same but the circuit board is different.

              3_1461237714861_WP_20160415_06_56_45_Pro.jpg 2_1461237714860_WP_20160415_06_31_16_Pro.jpg 1_1461237714860_WP_20160415_06_30_18_Pro.jpg 0_1461237714859_WP_20160415_06_24_35_Pro.jpg

              gyroG Offline
              gyroG Offline
              gyro
              wrote on last edited by gyro
              #25

              @korttoma
              Nice to see some interest in smart solar lamps :)
              It looks like an updated version (at least i like it more from your pictures). Could you post an order link.
              I think this one should be even easier to intercept with "mysensors", beacause i see only two transistors and circuit connectios are clearly visible.

              so lets try to understand the circuit:
              -U3 is probably battery protection circuit

              • Q1 i think is voltage regulator HT33 - to power arduino wih 3.3V (meassure voltage)
              • take a photo of PIR sensor from front side (is there any ic elements)?
              • U1 - i would guess PIR sensor IC logic - leg 6 (count from dot on IC) should be output (meassure voltage - high 3,3 V when motion detected):
                -if it is output from PIR just remove R3 and IC ouput goes over resistor to you arduino input.
              • the output goes over resistor to Q2
                -whats is left - you have to figure out what drives resistor Q1(J3y) :
              • i gues its driven by solar cell, than collector is connected to resistor R10, resesitor is than connected over board to the other side.......
              1 Reply Last reply
              0
              • korttomaK Offline
                korttomaK Offline
                korttoma
                Hero Member
                wrote on last edited by
                #26

                I guess you meant U4 is the 3.3V regulator. I measured it to 3.3V and HT33 should be a regulator. Q1 and Q2 I think are transistors. U3 handles the solar charging. U1 is for the PIR but unfortunately there is no text on the chip. I will get you the link tomorrow but it is quite easy to find on aliexpress.

                • Tomas
                gyroG 1 Reply Last reply
                0
                • korttomaK korttoma

                  I guess you meant U4 is the 3.3V regulator. I measured it to 3.3V and HT33 should be a regulator. Q1 and Q2 I think are transistors. U3 handles the solar charging. U1 is for the PIR but unfortunately there is no text on the chip. I will get you the link tomorrow but it is quite easy to find on aliexpress.

                  gyroG Offline
                  gyroG Offline
                  gyro
                  wrote on last edited by
                  #27

                  @korttoma
                  sorry my typo: you are correct

                  • U4 - HT33 is voltage regulator
                  • yes Q1 and Q2 are transistors
                  • U1 - PIR out test - measure voltage between PIN 6 and R3 when PIR is OF and ON. I think this drives Q2 (high brightness / low brightnes)

                  also take picture of other side of circuit board, beause i think Q1 is conected to R10 and
                  then further on the other side

                  1 Reply Last reply
                  0
                  • korttomaK Offline
                    korttomaK Offline
                    korttoma
                    Hero Member
                    wrote on last edited by
                    #28

                    Here is the link to the one I got but it seems like the prize is allot higher now since I paid 23,84$ including shipping -> http://www.aliexpress.com/item/1-Set-1200-Lumens-46-pcs-LED-Solar-Power-Motion-Sensor-Lamp-Ultra-thin-PIR-Outdoor/32354254209.html

                    Also it took like 10 weeks for it to arrive so maybe another seller would be a better fit.

                    • Tomas
                    1 Reply Last reply
                    0
                    • korttomaK Offline
                      korttomaK Offline
                      korttoma
                      Hero Member
                      wrote on last edited by
                      #29

                      There is not much on the other side of the board, just a status LED, a button to turn it on and the PIR.

                      0_1461306917706_WP_20160422_09_27_29_Pro.jpg

                      • Tomas
                      gyroG 1 Reply Last reply
                      0
                      • korttomaK korttoma

                        There is not much on the other side of the board, just a status LED, a button to turn it on and the PIR.

                        0_1461306917706_WP_20160422_09_27_29_Pro.jpg

                        gyroG Offline
                        gyroG Offline
                        gyro
                        wrote on last edited by
                        #30

                        @korttoma
                        Are you sure that this light has two modes of operation or only one: when a person is present is activated for 15s and then switched off

                        1 Reply Last reply
                        0
                        • korttomaK Offline
                          korttomaK Offline
                          korttoma
                          Hero Member
                          wrote on last edited by
                          #31

                          I'm sorry I did not test the device I just read the manual so I think that yes it has 2 modes for LED brightness.

                          0_1461308847304_WP_20160422_09_59_09_Pro.jpg

                          • Tomas
                          gyroG 1 Reply Last reply
                          0
                          • korttomaK korttoma

                            I'm sorry I did not test the device I just read the manual so I think that yes it has 2 modes for LED brightness.

                            0_1461308847304_WP_20160422_09_59_09_Pro.jpg

                            gyroG Offline
                            gyroG Offline
                            gyro
                            wrote on last edited by
                            #32

                            @korttoma
                            Don't be sorry.I am not an circuits expert, I just try help you figure things out.
                            You wil have to test this lamp a little bit.
                            it looks that Q1 drives U1 active/not active when there is sun, but how/what turns on dimm lights in dark?

                            Did you measure U1 pin 6 when pir active/not active?

                            1 Reply Last reply
                            0
                            • korttomaK Offline
                              korttomaK Offline
                              korttoma
                              Hero Member
                              wrote on last edited by
                              #33

                              In the application I will use this one I actually do not care so much for the built in PIR and LED, I just see it as a smart enclosure with a solar battery power-supply built in. I will tap in to the 3.3V regulator to power a pro mini that has an external PIR and (LDR) Light sensor. In addition to this I would like to add voltage measurement for the battery. BTW, did you komplette your sketch? I would like to copy the battery voltage sensor part. I will look att figuring out the circuit later, it does not look to complicated.

                              • Tomas
                              gyroG 1 Reply Last reply
                              0
                              • korttomaK korttoma

                                In the application I will use this one I actually do not care so much for the built in PIR and LED, I just see it as a smart enclosure with a solar battery power-supply built in. I will tap in to the 3.3V regulator to power a pro mini that has an external PIR and (LDR) Light sensor. In addition to this I would like to add voltage measurement for the battery. BTW, did you komplette your sketch? I would like to copy the battery voltage sensor part. I will look att figuring out the circuit later, it does not look to complicated.

                                gyroG Offline
                                gyroG Offline
                                gyro
                                wrote on last edited by
                                #34

                                @korttoma
                                I did try some battery measurement variants. The following code works best for me. I suggest that you first try the following sketch.

                                • measure the voltage with voltmeter on VCC pin and correct #define VREF value so it will be a close as possible to measured value before you integrate into case specific code
                                
                                
                                // define values for the battery measurement
                                #define R1 1e6
                                #define R2 330e3
                                #define VMIN 2.8
                                #define VMAX 4.2
                                #define ADC_PRECISION 1023
                                #define VREF 1.13
                                
                                
                                int oldBatteryPcnt = 0;
                                int batteryVoltage = 0;
                                int BATTERY_SENSE_PIN = 0;
                                int val = 0;
                                
                                void setup()  
                                { 
                                     // use the 1.1 V internal reference
                                  #if defined(__AVR_ATmega2560__)
                                     analogReference(INTERNAL1V1);
                                  #else
                                     analogReference(INTERNAL);
                                  #endif
                                  Serial.begin(9600);
                                }
                                
                                void loop()      
                                {  
                                   //float batteryPcnt = getBatteryPercentage();
                                
                                  //val = analogRead(BATTERY_SENSE_PIN);
                                  //Serial.println(batteryVoltage);
                                  float batteryVoltage = getBatteryPercentage();
                                  Serial.println(batteryVoltage);
                                  float batteryV= batteryVoltage;
                                
                                  float batteryVmap = fabs(fmap(batteryV, 2.5, 4.2, 0.0, 1000.0));
                                  int batteryPcnt = batteryVmap / 10;
                                  if (batteryPcnt >= 100) {
                                	  batteryPcnt = 99;
                                  }
                                   Serial.print("Battery voltage: ");
                                   Serial.print(batteryPcnt);
                                   Serial.println(" %");
                                delay(2000);
                                   /*if (oldBatteryPcnt != batteryPcnt) {
                                     // Power up radio after sleep
                                     //gw.sendBatteryLevel(batteryPcnt);
                                     oldBatteryPcnt = batteryPcnt;
                                   }*/
                                  
                                  // totally random test values
                                
                                }
                                
                                float getBatteryPercentage() {
                                
                                  // read analog pin value
                                  int inputValue = analogRead(BATTERY_SENSE_PIN);
                                  
                                  // calculate the max possible value and therefore the range and steps
                                  float voltageDividerFactor = (R1 + R2) / R2;
                                  float maxValue = voltageDividerFactor * VREF;
                                  float voltsPerBit = maxValue / ADC_PRECISION;
                                
                                  float batteryVoltage = voltsPerBit * inputValue;
                                  float batteryPercentage = ((batteryVoltage-VMIN)/(VMAX-VMIN))*100;
                                  //int batteryPercentage = map(batteryVoltage, 0, maxValue, 0, 100);
                                
                                  //return batteryPercentage;
                                  return batteryVoltage;
                                }
                                float fmap(float x, float in_min, float in_max, float out_min, float out_max) {
                                	return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
                                }
                                
                                1 Reply Last reply
                                0
                                • korttomaK Offline
                                  korttomaK Offline
                                  korttoma
                                  Hero Member
                                  wrote on last edited by
                                  #35

                                  @gyro said:

                                  int BATTERY_SENSE_PIN = 0;

                                  This means that you use A0 for measuring right?

                                  #define R1 1e6
                                  #define R2 330e3

                                  And you have used 1Mohm and 330kohm for the resistors?

                                  • Tomas
                                  gyroG 1 Reply Last reply
                                  0
                                  • korttomaK korttoma

                                    @gyro said:

                                    int BATTERY_SENSE_PIN = 0;

                                    This means that you use A0 for measuring right?

                                    #define R1 1e6
                                    #define R2 330e3

                                    And you have used 1Mohm and 330kohm for the resistors?

                                    gyroG Offline
                                    gyroG Offline
                                    gyro
                                    wrote on last edited by gyro
                                    #36

                                    Hi @korttoma

                                    • yes battery sense is A0
                                    • yes R1 and R2 are resistors values to measure Lipo voltage
                                    1 Reply Last reply
                                    0
                                    • korttomaK Offline
                                      korttomaK Offline
                                      korttoma
                                      Hero Member
                                      wrote on last edited by
                                      #37

                                      Thanks for the code and the additional info. Measuring the battery seems to work as expected but using the Internal reference seems to mess with the light level measurement LDR. Is it possible to use indifferent reference for different analog inputs? Or do I need to recalculate my LDR voltage divider?

                                      • Tomas
                                      1 Reply Last reply
                                      0
                                      • korttomaK Offline
                                        korttomaK Offline
                                        korttoma
                                        Hero Member
                                        wrote on last edited by
                                        #38

                                        I managed to squeeze in a pro mini and radio that is now powered from the 3.3V available from the built in circuit board. It has battery voltage measurement, light level and a external PIR.

                                        0_1461752523359_WP_20160427_11_25_34_Pro.jpg

                                        • Tomas
                                        gyroG 1 Reply Last reply
                                        1
                                        • korttomaK korttoma

                                          I managed to squeeze in a pro mini and radio that is now powered from the 3.3V available from the built in circuit board. It has battery voltage measurement, light level and a external PIR.

                                          0_1461752523359_WP_20160427_11_25_34_Pro.jpg

                                          gyroG Offline
                                          gyroG Offline
                                          gyro
                                          wrote on last edited by gyro
                                          #39

                                          @korttoma great that you maneged to connect it lamp..
                                          I don't know if analog reference is than set for all analog interfaces..
                                          Just one more thing you should adjust:
                                          I have figured out that I need to raise alarm for lower threshold for battery to higher than 3V (now is 2.5V!) because regulator voltage drop is ~250mV, and mini pro drops out at around 2.8V..
                                          But the whole concept now works fairly good

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          21

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular