Programmable Christmas Lights (part 1)

Published on: 20th August 2024

Tagged in picolights

I took advantage of / was drawn into Pimoroni’s birthday sale and purchased something new to play with: a Plasma 2040 and some star lights. The Plasma is designed to work with neopixel-compatible lights like the stars so it was a simple matter of plug and play. And it really was! I was able to wire them up in five minutes and had the Plasma connected to my laptop using Thonny.

The Plasma 2040
The plasma 2040
You can see the Plasma and LED string wrapped around a stray piece of wood to stop them getting tangled everywhere. Once connected I uploaded MicroPython and started making some effects.

I wanted to try three effects:

  • A ‘firefly’ effect where random stars would pulse in random colours
  • A ‘chase’ effect where stars would light in turn
  • A ‘switch’ effect where some stars would be continuously lit but change colour The ‘chase’ and ‘switch’ were easily applied using loops. For the ‘chase’ effect every fifth star would light, then every 0.2 seconds this would change to the neighbouring star. This gave the illusion of the lights moving along the stars. For the ‘switch’ effect, light up some stars and every x seconds the colour property would be changed.

Green LED stars
Part of the 'colour switching' effect

The ‘fireflies’ were more tricky. I found some code online that actually did this, and for the most part it was great. Unfortunately random stars would flash violently rather than pulse, and that was no good. It was unpleasant to look at and who knows what it could have triggered in some people. So I had to go back to the drawing board (and part 2).

Gallery

Click to view larger versions.

Green LED stars
The Plasma 2040