Skip to content
  • 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.
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

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.
  • GertSandersG Offline
    GertSandersG Offline
    GertSanders
    Hardware Contributor
    wrote on last edited by
    #10

    very nice to see that good progress was made :-)

    1 Reply Last reply
    0
    • soifS Offline
      soifS Offline
      soif
      Plugin Developer
      wrote on last edited by soif
      #11

      @gyro
      Keep up the good work debugging this chinese box !

      This box is a really good value for money box to build mysensors projects ( at least box + lipo + solar panel).

      If your investigations let us to also use the built in Charger / PIR / LEDS , it would just be amazing.

      Please keep us in touch ! ;-)

      gyroG 1 Reply Last reply
      0
      • soifS soif

        @gyro
        Keep up the good work debugging this chinese box !

        This box is a really good value for money box to build mysensors projects ( at least box + lipo + solar panel).

        If your investigations let us to also use the built in Charger / PIR / LEDS , it would just be amazing.

        Please keep us in touch ! ;-)

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

        @soif , @GertSanders
        some progress was made, but i need an hardware advice.

        This is the part of schematic that drives the LEDs.
        0_1455909866821_piygV.png

        First the battery is not connected directly (as here in schematic) but over protection IC logic.

        Question 1:

        Current circuit works as follows:

        • When solar cell voltage is higher than 0.7V , LED is OFF (sort off day/night sensor).
        • When solar voltage is lower than 0,7V, LED is shining with low intensity

        What is the the correct way to connect arduino pin D1 to take control over above described default behavior? (disconnect the line at SW4 and remove R9 -1Mohm)?

        Question 2:
        Which voltage measurement technique (internal reference or reference to regulated Vcc voltage) should i use to meassure Lipo voltage?
        What are correct/recommended resistor value for optimal battery utilization.
        Should this reference be used: https://github.com/rlogiacco/BatterySense

        Would make sense to measure also solar cell voltage?

        Question 3:

        Is arduino pin D2 connect properly? It control two level LED intensity:
        pin HIGH - LED glows with HIGH intensity (between led+ and led- is ~4V) pin LOW LED glows with LOW intensity (between led+ and led- is ~2,5V)

        Thanks for help and recommendations

        I have asked the same here, but no perfect answer jet:
        http://electronics.stackexchange.com/questions/218114/solar-battery-powered-leds-circuit-arduino-controlled

        1 Reply Last reply
        0
        • GertSandersG Offline
          GertSandersG Offline
          GertSanders
          Hardware Contributor
          wrote on last edited by GertSanders
          #13

          @gyro

          Since you are using a atmega328p, it does make sense to measure the battery level and solar power level.

          If you make a node which does NOT sleep all the time, then monitoring both voltage levels is the starting point to make decisions.

          I'm guessing you want to add a node using the battery, so a node that sleeps until something needs to be done.
          In that case we need a trigger when the light is bright enough to switch off the leds, and dark enough to switch them on again.

          The trigger to wake up from sleep should be a voltage change on pin D2 or D3, and the voltage difference needs to be from below the lowest "HIGH" threshold to above the highest "LOW" threshold. Check the specification for the atmega328 you use, as this depends on the working voltage of the processor.

          The question I ask myself is what is the lowest voltage you get from the solar cell ? Looking at the circuit, they use the voltage of the solar cell to open the gate of a transistor, which then pulls the emitter voltage of a transistor to ground, which in turn switches off a second transistor with is feeding the battery current to the LEDs.

          Your question of the values of R2 and R11 is actually how to measure voltages over a resistor divider? You can choose any value of resistors, but their ratio is what is important.

          To calculate the resistor values:

          To measure at a maximum of 5V on an analog pin:

          R11 = R2 * (1 - voltage-ratio) / voltage-ratio

          To go from 6V to 5V the ratio = 5V / 6V = 0.83

          Take R2 as 1M Ohm, then R11 = 1M * (1 - 0.83) / 0.83 = 205K => a common value is 220K

          To check: voltage over R2 (which is the input voltage on the analog pin A0)

          V(A0) = Vinput * R2 / (R1 + R2) = 6V * 1M / (1M+220K) = 4.9 V

          gyroG 1 Reply Last reply
          1
          • GertSandersG GertSanders

            @gyro

            Since you are using a atmega328p, it does make sense to measure the battery level and solar power level.

            If you make a node which does NOT sleep all the time, then monitoring both voltage levels is the starting point to make decisions.

            I'm guessing you want to add a node using the battery, so a node that sleeps until something needs to be done.
            In that case we need a trigger when the light is bright enough to switch off the leds, and dark enough to switch them on again.

            The trigger to wake up from sleep should be a voltage change on pin D2 or D3, and the voltage difference needs to be from below the lowest "HIGH" threshold to above the highest "LOW" threshold. Check the specification for the atmega328 you use, as this depends on the working voltage of the processor.

            The question I ask myself is what is the lowest voltage you get from the solar cell ? Looking at the circuit, they use the voltage of the solar cell to open the gate of a transistor, which then pulls the emitter voltage of a transistor to ground, which in turn switches off a second transistor with is feeding the battery current to the LEDs.

            Your question of the values of R2 and R11 is actually how to measure voltages over a resistor divider? You can choose any value of resistors, but their ratio is what is important.

            To calculate the resistor values:

            To measure at a maximum of 5V on an analog pin:

            R11 = R2 * (1 - voltage-ratio) / voltage-ratio

            To go from 6V to 5V the ratio = 5V / 6V = 0.83

            Take R2 as 1M Ohm, then R11 = 1M * (1 - 0.83) / 0.83 = 205K => a common value is 220K

            To check: voltage over R2 (which is the input voltage on the analog pin A0)

            V(A0) = Vinput * R2 / (R1 + R2) = 6V * 1M / (1M+220K) = 4.9 V

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

            @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

            GertSandersG siklosiS 2 Replies Last reply
            2
            • 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

              GertSandersG Offline
              GertSandersG Offline
              GertSanders
              Hardware Contributor
              wrote on last edited by
              #15

              @gyro
              Very nice work !!!!

              1 Reply Last reply
              0
              • D Offline
                D Offline
                Dylano
                wrote on last edited by
                #16

                higher math for me...
                Great...

                Can you use the motion seperate from the liight?
                And can u use the light with a switch option? [ i will turn on the light when there is motion.. ]
                Or is the light switching only on lux?

                Domoticz, with a lot of working hardware, include mysensors :-)
                OpenPLI, RuneAudio, Solarmeter, etc......

                Not a great builder of software and hardware, more a user...
                Only i try to do my best :-(

                gyroG 1 Reply Last reply
                0
                • D Dylano

                  higher math for me...
                  Great...

                  Can you use the motion seperate from the liight?
                  And can u use the light with a switch option? [ i will turn on the light when there is motion.. ]
                  Or is the light switching only on lux?

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

                  @GertSanders thanks, you have motivated my research

                  @Dylano the purpose of this project was exactly what you have asked.

                  The lamp is now mysensors aware.
                  Every task can be operated separately.

                  • When there is dark, the trigger is send, when the sun shines, the trigger is send. (transistor as switch). In scetch i use it as magnet switch part of code. When trigger is received (can wake up arduino), than you decide with controller what you want to do .

                  • PIR acts as classic PIR sensor and can also be used as trigger. (can wake up arduino), than you decide with controller what you want to do.

                  • The Lamp have two phases and can be controlled with controller (i control it over mqtt for now)

                  • phase one is dimmed light (relay 1)

                  • phase two is high bright light (relay 2)

                  Below is code that works for now. I wil improve it in next few days

                  // Enable debug prints
                  #define MY_DEBUG
                  #define MY_NODE_ID 11 
                  // Enable and select radio type attached
                  #define MY_RADIO_NRF24
                  //#define MY_RADIO_RFM69
                  
                  #include <SPI.h>
                  #include <MySensor.h>
                  #include <Bounce2.h>
                  
                  //unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                  #define DIGITAL_INPUT_SENSOR 2   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                  //#define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
                  #define CHILD_ID 12   // Id of the sensor child
                  
                  boolean lastMotion = false;
                  
                  // Initialize motion message - start
                  MyMessage msg(CHILD_ID, V_TRIPPED);
                  
                  //trigger solar power day on/off -start
                  #define CHILD_ID_SW 5
                  #define BUTTON_PIN  5  // Arduino Digital I/O pin for button/reed switch
                  Bounce debouncer = Bounce();
                  int oldValue = -1;
                  
                  // Change to V_LIGHT if you use S_LIGHT in presentation below
                  MyMessage SolarMsg(CHILD_ID_SW, V_TRIPPED);
                  // trigger solar - end
                  
                  #define RELAY_1  3  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
                  #define NUMBER_OF_RELAYS 2 // Total number of attached relays
                  #define RELAY_ON 1  // GPIO value to write to turn on attached relay
                  #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
                  
                  void setup()
                  {
                  	//trigger solar power day on/off - start
                  	// Setup the button
                  	pinMode(BUTTON_PIN, INPUT);
                  	// Activate internal pull-up
                  	digitalWrite(BUTTON_PIN, HIGH);
                  
                  	// After setting up the button, setup debouncer
                  	debouncer.attach(BUTTON_PIN);
                  	debouncer.interval(5);
                  	//trigger solar - end
                  
                  
                  	pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
                  
                  	for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
                  		// Then set relay pins in output mode
                  		pinMode(pin, OUTPUT);
                  		// Set relay to last known state (using eeprom storage) 
                  		digitalWrite(pin, loadState(sensor) ? RELAY_ON : RELAY_OFF);
                  	}
                  }
                  
                  void presentation() {
                  	// Send the sketch version information to the gateway and Controller
                  	sendSketchInfo("Motion Sensor and light", "1.0");
                  
                  	// Register all sensors to gw (they will be created as child devices)
                  	present(CHILD_ID, S_MOTION);
                  	for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
                  		// Register all sensors to gw (they will be created as child devices)
                  		present(sensor, S_LIGHT);
                  
                  		// Register binary input sensor to gw (they will be created as child devices)
                  		// You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. 
                  		// If S_LIGHT is used, remember to update variable type you send in. See "msg" above.
                  		present(CHILD_ID_SW, S_DOOR);
                  	}
                  }
                  
                  void loop()
                  {
                  	// Read digital motion value
                  	boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
                  
                  	if (lastMotion != tripped) {
                  		Serial.println(tripped);
                  		lastMotion = tripped;
                  		send(msg.set(tripped ? "1" : "0"));  // Send tripped value to gw 
                  	}
                  	// Sleep until interrupt comes in on motion sensor. Send update every two minute. 
                  	//sleep(INTERRUPT,CHANGE, SLEEP_TIME);
                  
                  	//trigger solar power day on/off - start
                  	debouncer.update();
                  	// Get the update value
                  	int value = debouncer.read();
                  
                  	if (value != oldValue) {
                  		// Send in the new value
                  		send(SolarMsg.set(value == HIGH ? 1 : 0));
                  		oldValue = value;
                  	//trigger solar power day on/off - stop
                  	}
                  }
                  
                  void receive(const MyMessage &message) {
                  	// We only expect one type of message from controller. But we better check anyway.
                  	if (message.type == V_LIGHT) {
                  		// Change relay state
                  		digitalWrite(message.sensor - 1 + RELAY_1, message.getBool() ? RELAY_ON : RELAY_OFF);
                  		// Store state in eeprom
                  		saveState(message.sensor, message.getBool());
                  		// Write some debug info
                  		Serial.print("Incoming change for sensor:");
                  		Serial.print(message.sensor);
                  		Serial.print(", New status: ");
                  		Serial.println(message.getBool());
                  	}
                  }```
                  1 Reply Last reply
                  1
                  • D Offline
                    D Offline
                    Dylano
                    wrote on last edited by
                    #18

                    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 ...

                    Domoticz, with a lot of working hardware, include mysensors :-)
                    OpenPLI, RuneAudio, Solarmeter, etc......

                    Not a great builder of software and hardware, more a user...
                    Only i try to do my best :-(

                    gyroG 1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      Dylano
                      wrote on last edited by
                      #19

                      guess what...
                      I do have a:
                      http://www.ebay.com/itm/161885080971?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT
                      Exact the same board in of this light...
                      I think i going to try the make this work...

                      Only i do not understand exact the wiring of your example.
                      Will you please make a list of exact stuff to buy.
                      And make some more pictures, from the good places..

                      And a thing that i see.
                      You use D2 from the arduino.
                      Is that not a one for the radio?

                      Domoticz, with a lot of working hardware, include mysensors :-)
                      OpenPLI, RuneAudio, Solarmeter, etc......

                      Not a great builder of software and hardware, more a user...
                      Only i try to do my best :-(

                      1 Reply Last reply
                      0
                      • 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
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          3

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular