My sister likes her solar powered Christmas lights and over the years, she has bought several sets with what little money she has. The problem is that she needs to turn them off at night, and when she’s on crutches, that becomes a little more difficult for her, especially during some of the hotter summer days which makes her heart condition worse. That’s where this project idea originally came from, make her solar lights turn on and off automatically at a preset times of the night.
It seemed inefficient and expensive to have a little addition to every one of the lights, so I decided to remove the little individual solar panels and controllers and have everything connected to a centralised box with a much larger solar panel rather than the individual units. It could also have a better effect than just flashing or solid on, adding in some fading effects as well. Since all the lights she owns are just static colours, I thought another cool thing for her is to have some Neopixels along the stairs. Originally I thought just putting them in some ping pong balls, but later I decided that some icicles would be a good compared with just some spheres. The main problem with all of this is to make it weather proof including working in some of the hotter days, as well user friendly for her and other family members to configure.
Driving the Neopixels isn’t going to be the issue in this project, the main issues and features will be:
- Creating a current feedback loop for the normal LED strands which is programmable, and can set a maximum current limit for each ‘channel’ while also providing enough resolution to do smooth fades in an out
- Allowing mixed strands to work with the same anode or cathode (depending on strands)
- Measuring available strands to find out what current is being passed through them and what common configurations are for mixed strands
- Limiting current during daytime to allow for maximum current for charging
- Detect day and night using the solar panel so lights could be turned on at a certain time or when it gets dark enough
- Ensuring safe battery charging from the solar panel
- Wireless programming the patterns the lights will follow
- Leave expansion capability to additionally control lights to music being played
- Shut down strands if over current conditions occur
- Complete controller before December to allow for PCBs to be made in time for lights to be set up
- Try to still keep it a surprise while documenting the project publicly online (this one shouldn’t be too hard)
Creating a current feedback loop for both battery charging and LEDs
The nice part of the project is the constant current driver can be used both for battery charging and the LEDs, although there is more to the battery charging than just providing a constant current. I originally didn’t know a thing about how to achieve the constant current but guessed that one part of the circuit would include a digital to analog convertor (DAC) and remembered Dave Jones’ video on designing a bench power supply. It wasn’t until I read a Maxim app note about creating a digitally controllable constant current driver, which used a digital potentiometer to affect the feedback path into the op-amp driving a transistor; that I started to piece together what would become the basis of this circuit.
While the circuit is unproven yet, I’ll be prototyping up the circuit soon to enable me to verify its behaviour. I’ll be using a Leaflabs maple in the initial prototype but later moving on an STM32F0 based chip.
Programming the controller
When I originally thought of the concept, I wanted to have a way of communicating with the light controller to program new patterns or if needed turn off the lights earlier than a specified time. My original thought was to have a wireless serial connection utilising an STM32F042 (crystal-less USB Cortex-M0 microcontroller) and the nRF24L01+ RF transceiver with a python program to allow easier programming, but decided it would be better if it was browser based so that any device that could access a webpage could control it, including mobile phones. At this stage I’m looking at pairing a nRF24L01+ RF transceiver with a Raspberry Pi Model B to achieve this, although this is more expensive than the former option.
Due to the low powered requirement of the controller, it is not possible to have the wireless transceiver to be constantly listening unless there is constant bright sunlight and the batteries are charged. To reduce power usage, it is better to only listen for short periods occasionally, which allows the Raspberry Pi to ping it until it responds finally, causing the wireless transceiver to stay on until the Raspberry Pi finishes issuing updates and commands. It also needs to have a timeout function to prevent an accidental ping keeping the receiver on and draining available power.