Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Christmas Village Control System, Using ESP32

For The Popcorn

Active Member
[Not trying to steal MrDEB's thunder....]

Last year, a very short time before Christmas, a friend asked if I could add some bang to his large Christmas village scene. "Sure.... oh wait, you mean THIS Christmas!" Fortunately, I had some boards I had made to drive LED strips and the parts to assemble them, and we were able to 32 groups of lights on a semi-random basis. My friend was thrilled with the results of the quickly created system.

There were a few shortcomings to the system, including the need to run a multitude of wires back to a central location and making all of the connections to 5mm terminal blocks.

I have been thinking of ways to make a more distributed system, where 'local' controllers would connect back to a central controller over some kind of network, possibly RS-422. Then the thought hit to use wifi-connected local controllers. This is even better than a wired network, as it would allow separate installations with no need for wires between them. I'm not sure what the control system between the boards will be yet – possibly MQTT, which is used for home IoT device control.

The Bah Hum board has an ESP32 NodeMCU devkit 1 module, an MCP23018 16-bit peripheral expanded and 16 N-channel mosfets to control the LEDs. The ESP32 module does have 18 I/O pins available, all of which support PWM, but many of the pins have shared functions and restrictions, so there always seem to be less pins available then you plan on. Using the port expander may also simplify control a bit. Sending a 16-bit word to each local controller will control the on/off state of all of the LEDs.

I did want some provision for twinkling/flashing/dimming some of the channels, so four of the port expander's 16 lines are connected to the mosfets via a quad AND gate with four of the ESP's I/O lines (capable of PWM). Global on/off control with the option of special effects.

In the upper left corner of the board is a DC-DC converter to supply ~300 mA to the ESP32 – it can draw a lot of current. The AP1509 can handle 24 volts maximum but I am planning on 12 volt power supplies.

The mosfets can each handle several amps. The entire board is limited to 10 amps, by the series reverse-polarity-protection diode. Reverse polarity protection is a good idea since the user is inexperienced. The downside of this arrangement is the maximum current draw of the board is limited by this diode.

If anybody has OCD, the rotated labels on R21 and R22 will be annoying. I didn't forget to align the labels. R21 and R22 are the 4.7k pullup resistors for the IC2 SDA and SCL lines. All of the remaining resistors are 10k pullup resistors, primarily for the open drain outputs of the MCP23018. Rotating those labels is a reminder when I assemble the boards. The PWM lines have pullup resistors to ensure the AND gates are enabled even if the PWM lines are not initialized.

Schematic_ESP Christmas Village V1_2022-08-04.png



PCB_PCB_ESP Christmas Village V1_3_2022-08-04.png


Notes_220805_093213_908.jpg
 

For The Popcorn

Active Member
Boards and stencil arrived today as scheduled. The boards look great and the stencil matches the board! Woohoo.

Time to get to work.

20220820_140213.jpg
 

Nigel Goodwin

Super Moderator
Most Helpful Member
Well my boards turned up yesterday :D

Took 20 days, but only cost:

5 boards: £6.77
Shipping: £3.01
Taxes: £1.96

Total: £11.75

Compared with (a much larger order) via DHL:

200 boards: £128.54
Shipping: £103.97
Taxes: £52.43

Total: £284.94

But they arrived a LOT faster :D

I've ordered some boards for work now with cheap shipping (the ones above were for me - but paid for by work!), as they are just to replace the last few we have left, so no rush.

Thinking on, I could have saved about £100 by having slow shipping on the expensive order above, as there was no particular rush.
 

Latest threads

New Articles From Microcontroller Tips

Top