Feature

Festive Lights

8 Channel Christmas Lights Controller

Erich Heinzle and Steph Kriewaldt

Issue 53, December 2021

Learn how a primary school in Adelaide has designed and built an Arduino-based Christmas lights controller for their community event.

For over sixty years, a traditional Christmas festival has been lighting up the Lobethal Valley in the Adelaide Hills (South Australia), all created by the community of Lobethal. It has now evolved into the largest Community Christmas Light Display in the Southern Hemisphere!

One of our readers, Erich Heinzle, who volunteers at a local school in the Lobethal Valley got in touch with us on their school’s lighting project. According to Erich, The Lobethal Lutheran School has been cultivating STEM and Maker activities in the curriculum, and to this end, an open source and open hardware 8 channel Christmas light controller was designed.

A BROAD OVERVIEW

The eight channel Christmas light controller uses an stm32 "Bluepill" or similar single board computer to drive four L293D motor driver ICs to provide eight channels of control for Christmas lights. The single-board computer can be powered via USB, or via a 5V input terminal.

The board allows bidirectional "two-wire" LED lights to be used, with each direction treated as a channel, as well as the less common three wire LED strings which also have a ground wire.

Common LED strings require 30V or 31V DC. The board requires a suitable external power supply, such as a benchtop laboratory power supply, or a switch mode power supply that can be adjusted to provided the required voltage. In this case, a conventional 36V, 10 Amp switch mode power supply has been used, which has had its output voltage adjusted to 30V using the built in adjustment potentiometer.

The board has two input buttons, currently used for mode selection, which include:

  • All on
  • Slow Flash
  • Slow Flash with ramped brightness
  • Fast Flash
  • Random flash
  • Light chase
  • Light chase with bounce (pong)
  • Light chase with ramped brightness
  • Light chase with bounce (pong) with ramped brightness
  • Text to Morse Code (Default text is "Lobethal Lutheran School")
  • Alternating bidirectional flash

FROM THE DESIGNER

We caught up with Erich to learn more about the project.

Thank you for sharing your school’s amazing lighting controller with us, Erich. Please tell us a little more about yourself and what got you involved in this project.

I volunteer at the Lobethal Lutheran School providing an after hours coding club, running a pool of Linux boxes running open source software to allow game design, coding, graphic design, CAD/CAM, electronics and STEM extension opportunities for students, who range between grades 1 and 7.

I have a longstanding interest in electronics, computing, and mathematics, and have a Bachelor of Science in Mathematics. I am also a licenced radio amateur (VK5HSE). I have been designing PCBs on Linux for around a decade, using free and open source tools such as pcb-rnd on inexpensive hardware ideally suited to educational settings.

The project was inspired after coming across cheap bidirectional LED Christmas lights in January, and investigating how they could be driven. A convenient solution for hobbyists appeared to be lacking, but H bridge circuits were the suggested approach. Given the natural fit with the Lobethal Christmas Lights tradition, and something that could make the coding club more interesting, I designed the board. I firmly believe that nothing encourages interest in coding more than the ability to experiment and see real world effects straight away.

What made you choose the STM32 Blue Pill microcontroller?

The choice of an STM32 platform was driven by the desire to control up to eight channels with minimal complexity in the supporting circuitry. The STM32 also has the speed and processing power to implement Fourier transform based music synchronisation in due course.

The audio option is the next part of the project, but with Christmas fast approaching, the focus has been on getting the low hanging fruit coded first.

It’s easy for scope creep to delay getting projects working, so your approach to get the easy bits done first is a sensible approach. Did you code from scratch or re-mix someone else’s code?

I coded the software from scratch. I am more conversant with C than C++, and the approach taken in the code is more procedural than object oriented for this reason. The code should be very readable as a result.

Well done on designing your own PCB. Tell us more about that.

The PCB was designed in the open source PCB design tool pcb-rnd. This and all software development took place on an old netbook running lubuntu linux.

What would you recommend is the maximum current to pass through the L293D ICs?

Each bidirectional light chain comprised of 250 LEDs typically draws up to 100 milliamps, which is well within the rating of the L293 motor driver, which for most versions of the IC is able to deliver at least 600mA.

Would the circuit work on LED strings that run from lower voltages, and how about those Christmas lights that have 3 wires?

The L293D is rated to control up to 36 volts, so LED light chains running anywhere between 4.5V and 36V could be controlled. The PCB connectors include ground terminals to provide for three wire light chains, or alternatively, pairs of unidirectional light chains.

What should our readers consider before building a similar project for themselves?

First of all, they will need to ensure that all of the LED strings run at the same voltage. Lower voltage strings will be blown if run at a higher voltage needed by other strings

Secondly, a suitable power supply will need to be found that can reliably provide the required voltage without overshoot. In our case, an open frame 36V SMPS, after adjustment of the onboard trimpot, was the easiest way to get 31V with the adequate current. The unit used was quite over specified, as nothing smaller than a 10 Amp 36V unit could be found.

Thirdly, if less than the full eight channels are used, the code will require some simple modifications to make the light chasing and bouncing (pong) modes look right.

Finally, the use of an stm32 based "Blue Pill" or equivalent board will require the necessary arduino IDE support and ST development tools to be installed, to allow programming of the stm32. This should not be too challenging for those with already working Arduino environments. A USB->serial-TTL adaptor, or, an ST-Link programmer, will be needed to program the stm32.

What other improvements do you have planned for your project?

A footprint to allow for easier serial programming of the stm32 board without having to remove it from the PCB. This is not an issue for those using an ST-Link programmer, but makes development cycles quicker for those using a USB ->serial-TTL adaptor to program the stm32.

Add decoupling capacitors to each of the L293 IC power rails. No issues have been observed but it will help with noise immunity.

Polarity protection diodes are planned for the 5V and Vcc inputs to provide cheap protection from mishaps to the stm32 and L293 ICs

I will be ordering the revised PCB layout shortly, and will update the GitHub repository with the new Gerbers, schematic, BOM and pictures.

Is there anything else that we haven’t covered that our readers would know about?

Software debouncing is used for the pushbutton inputs. The channel button was included in the prototype in case an extra input might be useful, but I have not found a compelling use for it so far, and therefore plan to provide a footprint in parallel with it on v2 of the board to allow an LDR for ambient light sensing.

The demands of the lighting patterns have not necessitated the use of interrupts, but these will likely be necessary once the DSP is implemented.

Great! On behalf of our maker audience, we thank you for making your project open source and available to the maker community. Thank you for sharing your project with us. We wish you all the best with the event, and we look forward to seeing a video of it all in action, which we will share with our readers.

The BOM, code and PCB files can be found on the school’s GitHub page: https://github.com/Lobethal-Lutheran-School/LLS-Christmas-Light-Controller/