-
Technical Design Brief
08/20/2014 at 23:15 • 0 commentsFrom the very start of this project, I wanted this project to be cheap, which has flowed into some of the decisions I’ve made about the project. Some other aspects, I won’t be able to make cheap such as the battery packs and the solar panel.
The digital constant current drivers
The constant current drivers are in essence the most important aspect of the project. I need to be able to drive the strands of LEDs with as minimal power loss as I can to extend battery life but also so I can increase what the strands can actually do since the solar lights usually only were solid on or flashing. There are 2 main components of the constant current driver, the current sensing stage and then comparing to a DAC output to determine whether to limit the current further or increase it via a mosfet.
The current sense is a simple case of putting a small valued resistor (500mOhm) and measuring the difference over that signal before amplifying it. The original concept sketch I have done for the constant driver included this, although up until last Sunday, I was using a dedicated IC for this purpose, now I’m going to be using the MCP6L04 to reduce parts on each PCB and to make routing easier in the end. To allow fast changing of common anode and cathode systems, as it could be a variable, dual pins on both sides of the current sense will be used to with a jumper used when the other set is used, this means I can quickly switch it when installing without too much issue.
The DAC outputs to allow the digital current control is from a MCP4728 quad 12-bit output DAC, this should be a cost effective solution and actually give me 4 channels per PCB. Additionally with the changes made recently to the current sense, the same MCP6L04 can be used for both current sense amplification and the DAC control. It does require 2 MCP6L04 per PCB (2 op-amps per channel) but actually reduces the overall cost.
The PCB design is actually going to be a plug in module with a bus to the main microcontroller, addressing each DAC is not an issue as they’ll all have unique I2C addresses in the end, however I need to be able to pull a line low on each MCP4728, it’s not possible to have a single IO line for each MCP4728, however it is possible to have some logic to make an address bus, to reduce the number of IO. However if the logic needs to change later down the line, it needs to be possible to change the logic without having to spin another PCB revision, so a CPLD can be used to achieve this.
Solar and battery charging
A lot of what I need for battery charging is actually already used for the constant current driver, I just need to be able to allow for voltage measurement and for current to flow into the bus. To allow this, I plan to have a few 0 Ohm resistors on the same PCB design as well as some extra mosfets to allow either charging or discharging to go into the bus. The voltage from the batteries is then put though a regulator (switching possibly) to lower it down for the LEDs and associated circuitry.
The solar cell will connect to the main CPU PCB and have a mosfet to let current flow into the main bus for battery charging or powering LEDs if the battery are already charged and power is available from the solar cell when the LEDs are turned on at the specified time. It also needs to prevent when the batteries discharging into the solar cell when active, either 2 mosfets will be needed in a solid state relay configuration or a MOSFET without a diode selected (which I’m not sure exists).
Wireless Control
Some time ago I got a couple of nRF24L01+ modules to experiment with, which makes it a low cost option for wireless communication, as the ICs are cheap and I have a reference design which I can develop with now. As mentioned previously I was looking into creating a USB dongle to control the lights, to help speed up development, I’m switching to having a daughter board for the Raspberry Pi to allow any browser enabled device to program the LED sequences, when to enable and disable the lights, and to run manual checks. Low powered is key to this, so commands need to be buffered for when the main controller wakes up the nRF24L01+ which should be easily possible with the Raspberry Pi.
Main controller board
As mentioned the system needs to be low powered and to do this, a low powered processor needs to be selected, especially during the day when charging is the main priority. I’m a fan of the STM32 series and have an STM32F0DISCOVERY board which will allow for development until I finalise the PCB design; so most likely I’ll be going for the STM32F030 series which will enable me to reduce the power usage and not have additional components for things like the real time clock which is needed for the automatic lights off and on. The other features needed for the processor is a couple of SPI ports (one for NeoPixel driving and one for the nRF24L01+), 1 (ideally 2) I2C ports for the DACs, 2-3 ADC pins to measure battery voltages and spare IO pins for addressing purposes, power features, future expandability and supporting external devices such as the nRF24L01+.
The main microcontroller also needs to be always powered, whereas the LEDs and their associated controller do not need powered the entire time, so switching off the LED supply can help reduce the overall power usage when LEDs are not used. A high current regulator for the LEDs needs to have an enable/disable feature to enable this to occur. There also needs to be a small coin cell to keep time in the RTC when the batteries are flat or for when storage of the controller occurs.
-
90 second intro to the project
08/19/2014 at 12:51 • 0 commentsAfter many attempts (and I mean many) I finally did a video I was happy with:
I'll hopefully post a detailed plan tomorrow night as I'm due to fly out to another state in less than 9 hours. There also might be a blooper reel later of the previous failed attempts.
-
Constant Current Driver Prototype
08/17/2014 at 13:25 • 0 commentsWell, the prototype I built a couple of weeks ago now is semi working. I haven’t been game enough to remove the resistor limiting the current completely but have reduced its value once and may experiment with reducing it further after the next circuit change. The video below shows the circuit before I disassembled it:
The circuit featured in the video is comprised of a Microchip Dual Channel 12-bit DAC (MCP4922) controlled via SPI, a Current Sense amplifier (TS1102-25), a Microchip Quad op-amp (MCP6L04T) and a generic NPN transistor (C9014). One of the problems not mentioned in the video is that when I got the Current Sense Amplifier, I miscalculated which gain I needed, so the amplification is not high enough for the circuit to work as desired. The solution to the problem is to use the op-amp in the circuit and ditch the current sense amplifier completely, which also has an added bonus of reducing cost and reducing the number of unique components.
I’m currently working on implementing the new circuit and testing it out. I should have an update on what the end electronic structure will look like tomorrow including some of what hasn’t been tested and discussed.
-
The Idea and Concept
07/15/2014 at 13:32 • 0 commentsMy 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.