Garden DMX512 Lighting Project – Raspberry Pi Pico

A DMX512 controlled Bollard light built on a Raspberry Pi Pico

Table of Contents


Introduction

Recently I had a need to add some more garden lights after purchasing some new Garden bollards. I didn’t want something I needed to access often to update/change code or functions, was simple and reliable, and was small enough to fit at the base of the bollard.

To control these I selected the DMX512 protocol. This protocol is used by professional lighting and can be easily addressed, the RS485 cabling has the capability to run long distances, and most of the smarts are in the controller, with the end device, just doing what it is told. This allows new effects to be added remotely at a central location.

My existing LED lighting was direct driving APA102 LEDs and using a main 24V power supply regulated to 5V close to the lights, I wanted to keep this, as it is approximately 20-25m from the power supply, and running a lower voltage would cause too much voltage drop, a higher voltage introduces more expensive power supplies, so this seems like a good happy medium.


The DMX512 Protocol

The DMX protocol uses an RS485 network running at 250,000 baud to transmit the signal. This transmits 512 channels (bytes) of data along with start bytes and is repeated typically at 25 times per second to allow quick updates to all 512 channels.

Most devices allow a smaller number of channels is 64 channels, which could allow the updates to be more frequent, however this would just be DMX not specifically the official DMX512 protocol. More detail can be found online easily if you would like to read further about this.


The Hardware

The main components of this light are a Raspberry Pi running some code to receive and process the DMX512 protocol, and also update the APA102 LEDs. There is 1 channel per colour, plus a master brightness channel, so using 4 DMX channels per light.

To keep the circuit design simple I wanted to mostly used predefined modules

Microcontroller

The Raspberry Pi Pico was a logical option here, powerful dual core allows the DMX interface and APA102 tasks to run on their own cores, and re-using some of my existing Pythong libraries, reducing required programming.

Power Supply

I have used a DFRobot DFR0571 This allows up to 28V input and a 5V 1.6A Output, more than ample to drive a dozen APA102 LEDs

RS485 Transceiver (DMX512)

A Transceiver I have been using in my projects recently is a MAX22027AWA+. This chip does the hard work of RS485 Transmit and Receive tasks easy. Whilst not using the Transmit for DMX512 in this project, it allows easy implementation, or the board to be used on something else later, increasing flexibility.

This chip is also isolated if needed, and can be supplied with both 5V for the RS485 side, and 3.3v logic levels for the Raspberry Pi Pico. This reduces other logic required to implement the interface. These chips are a bit more expensive, but simplify the implementation and reduce required footprint, which fits well for the size required for this project.

Enclosure

Due to the size of the Garden bollards I had a maximum of 100 x 100 mm in size for an enclosure to fit in the bottom. I found an 83 x 58 x 35 mm enclosure with IP67 water resistance and a clear top on AliExpress. The board and light will need to fit into this to ensure there is space for the cabling to come in and daisy chain out to the next light.

Aliexpress Enclosure Link


Hardware Design

The schematic for this is simple due to the chips and modules used. Although a Buffer was included in the schematic, testing has showed that the 3.3v output from the Pico can drive the APA102 LEDs without this, so this has been omitted when building the project.

Schematic


PCB Production

For the PCB design I used Kicad to design two boards, one for the controller and one for the LEDs to stack up.

For PCB Production I used PCBWay (sponsor of this blog), the quality of the boards and the total cost were my two important aspects here, so PCBWay where a perfect choice. As I had most of the components already, I selected PCB only for this order.

Use this link to receive $5 credit when signing up, and support my blog on future projects. PCBWay

Below is the resulting board from PCBWay, the camera doesn’t show it well ( I need to get a microscope working), but the quality of the board and silkscreen is really good. There is text below ‘MAX22027AWA+.’ Is only 0.8mm tall, and is very easily readable, normally it is recommended to only go down to 1mm, no problems here.

MAX22027 Closeup

PCB Controller and LED


Software

The Raspberry Pi Pico software is written in Python and uploaded to the board using Thonny.

It is broken down into modules:

apa102_thread.py A Smart APA102 library allowing refresh rate to be updated automatically based on the number of LEDs it is controlling, up to a maximum Refresh rate. This runs in the second core of the Pico, and simply updating a variable will allow this module to update the LEDs

config.py Stores the DMX Main Channel, how many channels we need to listen to, and the number of APA102 LEDs

dmx512_rx.py Listen to the DMX network, based on the configuration, and capture errors, for example if the DMX network is down, processing a callback to the main function so we can go into a default mode.

main.py Initialise the modules and process the linking of the DMX received data and updating the APA102 LEDs


Controller Board Assembly

The controller board assembly has a single surface mount part, being the MAX22027AWA+, this needs to be installed first, along with the jumpers to remove the buffer and the IO Jumpers to match the LED board used. This all sits underneath the Pico, and due to height needs to be soldered in, so these are hard to get to once assembled.

Install the Power supply, resistor, LED, Capacitor, then the headers next. The last item should be the Raspber Pi Pico.

The GP jumpers near the LED and the OLED connector are not used once fully assembled.

Cutouts in the board are for the waterproof glands in the case, and to fit around the screw mounts for the lid.

Controller Assembly 1

Controller Assembly 2


LED Board Assembly

All 4 of the LED strips are in parallel with one of the outputs connected to the CO/DO so that the signals could be daisy chained with more ‘dumb’ controller boards for easy expansion if desired. I have made each LED unit independent with their own Pico for redundancy and consistency in my layout.

LED Assembly


Assembled Light

Plug the two boards together and we have an assembled light. The connectors are mini 4 pin IP67 connectors.

Completed Project


Installation

To install these, conduit has been installed alongside concrete pads to allow the combined DMX & Power wires to daisy chain past each bollard.

Conduit Preparation

The new DMX Light is then placed in a middle of the pad to allow it to shine up through the centre.

Bollard Preparation

The finished bollard, lit up at dusk. These lights are meant to be an effect, so not glowing bright, and they nicely light up the bollards as planned.

Bollard Preparation


Summary

Overall I’m very please with the outcome of this. Building something into such a small enclosure and placing it outside in the weather is always a difficult thin to design for and I’m hopefull the components and PCB will live up to the harsh Australian weather over time.

If you are interested in the PCBs or Software used, please reach out!