Back in October 2020 I started a series of blogs on an "Smart Solar Lighting Project". The idea was as follows:
- Li-Ion charger, with programmable charging current level to find the maximum power point (as opposed to true power point, I will be stepping up the current as long as the solar panel voltage remains about the battery voltage)
- Li-Ion battery with a capacity of 840 mAh.
- Four Warm LEDs (two facing towards the deck and two facing towards the stairs), providing 17 lm (at 30 mA each) of lighting at both faces (depending on diffuser losses). This capacity should be sufficient to provide ~ 7 hours of illumination, but I plan to run considerably shorter light schedules to hopefully handle a cloudy day or two.
- Real time clock (super capacitor backup) to track time of day and allow programmable light schedules.
- Enocean transceiver to allow communications to a PC-based application providing data collection and time of day synchronization and limited interaction with Enocean switches (semi on-demand lighting).
- Power saving electronics to periodically sleep the Enocean transceiver (quite power hungry for a battery powered application)
- LED current monitoring to adjust lighting based on changes in battery voltage.
- Provisions for solar voltage cut off if unloaded voltage rises above the battery charger maximum input (not needed for the initial design as the selected solar panels are within the safe range on the charger).
- Provision for using the LEDs as a load to the solar panels for characterizing the solar panels prior to final initialization.
The project, over the course of 5 blog entries (Smart Solar Lighting Project - Initial design ideas , Smart Solar Lighting Project - Update 10/2/2020 , Smart Solar Lighting Project - Update 10/8/2020 , Smart Solar Lighting Project - LED Intensity Control System and Smart Solar Lighting Project - Illumination improvements ) , achieved all of its stated goals, but due to the shading of my Oak trees, solar panel size and placement, I was never able to fully charge my batteries. So fast forward to August 2021 when I started a new series of blogs based on my "Outdoor LED Lighting Project Revival Project" (2 blogs - Outdoor LED Lighting revival project and Outdoor LED Lighting revival project - part 2 ) where I picked up the prior project and bumped up the scope a bit by adding some hanging LED lanterns (that once were solar) to the project. Now that project14, Off the Shelf contest is in full swing, I have decided to complete the project and submit it to the competition.
Over the course of all of these projects the design has changed quite a bit. As the number of LED lighting elements increased (adding 2 hanging LED fixtures), I decided to move from a distributed control system to a master and slave configuration. The solar panels went away and were replaced by an EnOcean enabled power system with cabling to supply power to the LED lighting elements. So here is an update design overview:
- Two new hanging LED lanterns with the existing solar modules replaced with 'wired' modules with three Warm LEDs powered with analog constant current supplies,
- Updated stair lighting modules with 12 Warm LEDs (6 facing towards the deck and six facing towards the stairs) powered with analog constant current supplies.
- All fixtures use the same LED Lighting boards, populated with either 3 or 6 LEDs (3 LEDs per side).
- New EnOcean equipped power controller module, running smart controller providing scheduled and on demand lighting.
- Power controller equipped with current load monitoring and auto shutdown on overcurrent conditions (programmable level and trip delay).
- Power supply, providing up to 10A at 5Volts to handle future lighting needs.
Lets take a deeper look of each of the system components with some comparisons to the early versions.
The Lighting elements - The basis of all the Lighting elements is a 6 channel, constant current, LED module. Here are the layouts and schematics:
The basic concept of the schematic is a simple constant current source to drive each LED. The target current for the LEDs is 30mA. At 30 mA, the sense resistor (20Ω) develops a 0.6 volt drop which begins to turn on the transistor, which in turn, begins to shut down the MOSFET that drives the LED. The current measured turns out to be right on 30mA, and the current only changes slightly over a +/- 1 volt swing of the input voltage. The final size of the PCB is 1.0" x 1.0", which gives plenty of room for the PCB to fit inside the light module. I decided to go with warm LEDs (3700-5000K) as I am not a big fan of the super white/blue light output.
Solar Hanging Lantern Retrofit - These formerly solar lanterns had their modules removed and new housing were designed and printed to adapt them for wired usage. Here are the design file images:
Initially, I had intended to line the inside of the reflector cones with highly reflective foil. In testing it was determined that printing the cones in white IPA was produced almost the same illumination as the foil lined cones, so I went with the much easier approach and used the white reflector cones. Here is a table of the light intensities of the various combinations of reflector and lenses:
Here are some pictures of the actual assemblies:
Here are images of the updated hanging lanterns in daylight and then lit during the nighttime.
Solar Deck/Stairway Lights Retrofit - These formerly solar light modules were redesigned/printed and adapted for wired usage. First, here are the existing modules from the smart solar project:
Moving to the 'wired' elements, the existing PCB was replaced with two of the new lighting modules and some 3D printed parts needed to be designed or redesigned. The previous design for the reflector has smaller holes for the light entry (single LED) and some reliefs in the reflector top edge to accommodate the battery holder, so these needed to be redesign. In redesigning the reflectors I tried a combination of different reflector shapes and material in order to get a consistent illumination pattern here are some of my test results:
Here are 3D designs for the new parts:
Each Deck/Stair Lighting Module requires four the conical reflectors, two of the bridge pieces and two of the standoff/supports than fit into the end of the plexiglass tubes. The bridge pieces are bolted together (small standoff facing towards the inside) and hold the lighting boards into place (along with their reflector/lens assemblies. Here are some images of the resulting assemblies:
The first two images were taken after I had trimmed the plexiglass tubing for the assembly, there was a lot of plastic dust inside the tubes prior to the cleaning and final assembly. The final picture shows the completed assembly. Due to part shortages I was not able to purchase enough LEDs to complete all the assemblies, to I ordered a the basic part but with a slightly different binning specification. I used the older LEDs on the top side of the lighting modules and the new LEDs on the bottom side of the PCB, The 'F' on the bridge is to remind me to face this side of the module to the front (or deck side) during the installation as I wanted the light to be as consistent as possible from each viewing angle.
Here are some pictures of the Lighting Modules being installed into the light fixtures at the deck stairway and some pictures with the lights on:
I constructed a pair of retainer assemblies to hold the Lighting Modules into the light fixtures. At the top is a pair of plexiglass retainer that allow the lighting module to be tipped into the fixture. At the bottom are a pair of wooden blocks that I glued onto the split bottom pieces of the fixture housing. After the wires were connected (using 2 position Wago compact splicing connectors), the rear glass plate is slipped into place and the bottom of the housing is attached (with barrel nuts or cross dowels and screws), closing up the fixture. (Notice the 'B' side of the lighting module is facing out on the stairside of the deck).
With the wires attached and the fixtures close, here are some pictures of the deck/stairs lighting in action:
Lighting controller/Power Supply - This is the new element of the lighting system. Using the old smart solar electronics/software as a starting point I ported both the electronic and software into this new design. The controller has the following specifications:
- USB programmable to support configuration of the EEPROM constants that effect the lighting schedule (Time offset from dusk, Auto On duration, Manual On duration) and over current protection (current trip level and time delay).
- EnOcean transceiver to support manual On command (EnOcean Rocker switch) and to provide status updates (TBD).
- DC load switching/monitoring to energize lighting modules. The MOSFET controlled switching can support up to 10A, although the present needs are less than 1 Amp. Current monitoring and programmable level and delay settings allows safe operation.
- RTC chip (with super capacitor support) to provide accurate timing in support of the Auto light scheduling features.
- 5 Volt, 10 Amp power supply allows for future lighting options. (The controller and supply are mounted inside the house with plastic conduit and heavy gauge wiring running to the light fixtures)
Here are the (modified as I found a couple of errors during testing) schematic and layouts for the Lighting controller:
Here is BOM (parts list) for the Lighting Controller board:
The Light Controller and Power Supply are mounted on a common frame and power is routed from the power supply to the controller and then switched to the LEDs. Here are the design images of this frame and pictures of the final assembly.
The mounting plate has screw holes in the bottom to secure the power supply and holes in the side (with access for nuts) to attach the controller board.
Light Controller - Software Overview
The software files will be attached to the end of this file, but here is a brief overview of the software of the controller:
- The ATmega328PB uses two serial ports to communicate to the outside world. USART0 communicates with the EnOcean Transceiver, which is being use to listen form manual switch message from the paired rocker switch to provide 'ON' and 'OFF' command to the load switch. USART1 communicates to the configuration program, running on a PC, via the USB to serial bridge.
- The main loop processes the two serial data streams and multiple timer generated flags to coordinate data collection and event processing.
- mSecReady - this event is used to handle the ADC data processing. Four different cases occur (ADC mux switching, ADC start, get and filter and end of frame processing), repeating every 4 mSec, for each of the 3 analog channels (Load current sensing, 5 Volt level and 3.3 Volt level). (Note: Voltage and current levels can be sent out (via the USB) as a status message, which was really handy for debugging and testing)
- Ready100mSec - This event is used to process the filtered load current sense values. If the I_Sense value is greater than the programmable Limit value, the TripTime is decremented and tested for zero, if zero the device enters an Over Current Shutdown, turning off the Load MOSFET and latching the device until a reboot (after clearing any shorts). If the I_Sense value is greater than the programmable Maximum current value, the device enters an immediate Over Current Shutdown, turning off the Load MOSFET. If the I_Sense value is less that the programmable Limit value, the TripTime is reset to its programmed value. On a Over Current Shutdown Light Controller is latched and prevented from turning on the Load MOSFET until a reboot (after clearing any shorts).
- SecReady - Once a second the RTC is read and the ON/OFF state is managed based on either the Auto or Manual schedules. Auto Turn On occurs on a programmable offset from the computed dusk schedule (computed daily) and Off occurs on a programmable duration time (after the ON). The Manual schedule is used to turn off and manually signaled On message with a separate programmable duration time.
- The EEPROM on the ATmega328 is used to save EnOcean IDs (my ID, paired master and paired rocker switch) along with the programmable values pertaining the scheduling and load monitoring
- EE_C_LED_ON_OFFSET - Number of minutes after dusk, when the LEDs should be turned on.
- EE_C_LED_ON_DURATION - Number of minutes that the LEDs should remain on in auto mode (up to 4 Hour and 15 minutes).
- EE_C_MANUAL_LED_ON_TIME - Number of minutes that the LEDs should remain on in manual mode (up to 4 Hour and 15 minutes).
- EE_C_CURRENT_LIMIT_VALUE - Current limit value.
- EE_C_CURRENT_TRIP_TIME - Number of 100mSec counts that the current is allowed to be over the limit.
- EE_C_CURRENT_MAX_LIMIT - Maximum current value, Exceeding this value results in an immediate shutdown.
- Dusk time Calculations - The software contains a segmented, linearized version of the Sun graph for San Antonio, Texas, as a basis of computing when dusk occurs, This data is used, once a day, as the RTC reports a change in date, to compute the dusk time for the current day. All of the calculations and data have daylight savings time removed from the calculations, to that device will follow true dusk.
Light Controller Configuration - Software Overview
To program the Light Controller configuration settings I developed a Visual Basic control panel. This software connects to the Lighting Controller through a USB serial bridge. Here is the control panel:
The control panel software is used to set and read the RTC data, set and read the configuration data along with other features for setup and debugging. The two text window at the bottom of the panel are used to display serial data sent and received from the Light Controller (nice debugging feature). The following is a brief description of the features on the control panel:
- Read Registers and Set Time/Date - These buttons are used to query and the set the RTC. In addition to the Day, Date and TIme, we can view and control some of the other registers of the RTC.
- Read Config and Update Config - These buttons are used to query and set the Light scheduling parameters and the load protection parameters.
- Enable Status - This button is used to turn on or off the status reporting from the Light Controller. When 'On' the Light controller will send status messages once every 100mSec to the control panel. The status messages are displayed in the righthand text window and look like this: STAT =4,232,84,913,247,0,0, were the first number is the ADC value of the I_Sense current reading. The second number is the scaled 5 Volt reading, and third is a tricky approach at measuring the 3.3V power, which is the ADC reference voltage, by measuring the internal 1.1V and using its value to infer the 3.3V level (in this example the 84 is one LSB away from 1/3 of the ADC full range, which makes sense as 1.1 is 1/3 of 3.3V). The fourth number is number of minutes from midnight, or 913, which is 15 hours and 13 minutes, or our time of day. The fifth number is the number of minutes until the LEDs should turn on, 4 hours and 7 minutes, or 19:20. The remaining two numbers are used to show the remaining On time for the Auto and Manual schedules, but are currently zero as no LEDs are presently on.
- Start Learning - This button is used to start and end a learning session, where the Light Controller listens for EnOcean messages from rocker switches, looking for an 'On', 'Off', 'On', 'Off' sequence of the telegrams (EnOcean talk for messages). If such a sequence is seen during the Learning session, the Light controller will bind itself to that device. Once the Light Controller is bound, it will act upon any telegrams from that device and turn On or Off the attached LEDs.
- Turn On LEDs - This button is used to control the LEDs for testing and debug. I used this feature to turn On the Load MOSFET so I could load and test the Light Controller current reporting as a function of loading.
Proof Video
In this time lapse video, I started the capture about 10 minutes before the LEDs were scheduled to go on and allowed it to run about 10 minutes after the LEDs went out. The Auto On duration was set to 2 hours.
Conculsion
This was a lot of fun taking a project that has indeed been sitting on a shelf awaiting the opportunity to be completed. In many ways, the it was almost a complete redesign, but in fact much of the electronics and software developed for the original project was factored into this project. Thanks Element14 for another great contest idea!
The software is attached below.