To make this fit it was important to minimise the hardware footprint, have an integrated display interface and have a modular architecture.  Some of the choices are obvious, others are based on the best options I can find.

  • Platform: Custom PCB with Surface Mount Components
  • Brain: ESP32 Pico D4.  Integrated memory, crystal, and lots of io options and protocols
  • Display: Nextion 2.4 TFT.  Built in processor with software to configure pages and links
  • HASP Code: MQTT based control of display pages and content (converted for ESP32)
  • OpenMQTTGateway Code: Modular way to interface with many sensors and components

The Brain

The ESP32 Pic D4 is a low cost, small footprint IC with built in ADC, Wi-Fi and Bluetooth and also interfaces for SPI, UART, I2C that we need for adding lots of components.  Also I added a serial interface for programming using a CP2104 USB to UART IC. 

Radio Frequency 433MHz - CC1101

To control RF Plugs and receive RF signals (e.g. doorbell press) I need a Radio Frequency (RF) Rx and Tx board.  There are a few options separate board but to minimise the footprint with one board with a single antenna I selected a low cost CC1101 board.  These can transmit and receive on one board switching in software when transmitting.  There is also good support for this in OpenMQTTGateway.

InfraRed Receive and Transmit

This is useful if you have a spare remote for device control or want to transmit to control TVs.  The interface is fairly simple with plenty of examples in the web and lots of software support, again using OpenMQTTGateway.  This just requires a IR diode with an NPN transistor boost and am IR receiver with no additional circuitry beyond a passive resistor.

General Midi Synthesizer, SD Reader, MP3 Decoder, Microphone, Midi Input

It's a fairly old IC but the VS1053b is powerful with a lot of capability in a small package. I had been looking to build my own General Midi synth (I have nostalgic Monkey Island needs) so not going to miss the opportunity.  This chip also provides MP3 decoding, Microphone encoding in Ogg format and a midi input for controlling the General Midi synth.

It is not an easy chip to work with but Adafruit and Sparkfun provide example boards, code and circuit diagrams. Ralph S Bacon does a good YouTube video using one of these boards to build an internet radio.

There was no space in a light switch for a standard MIDI 5 pin din plug but TRS 3.5mm plug is now reasonably standard for MIDI input.  You can switch from standard to MIDI input mode in code with a VS1053b plug in.

Most of the VS1053b boards come with an SD card interface to load MP3 files, the fact that both the VS1053b and an SD card reader use SPI means that just an additional CS data line is needed to communicate with the SD reader.

Amplifier, Headphones and Speaker

If you have an MP3 and Midi Synthesiser on board then you need to be able to hear it.  The original design used a DFPlayer Mini for the MP3 player as it amplifier, SD reader, and speaker and headphone pins.  Changing to the VS1053b meant I needed to add an amplifier and the TPA2012 was compact and had a dev board with code and circuit diagrams from Adafruit with details on the additional passive components.  The TPA2012 has both headphone and line out so I used a special jack to switch to headphones when they are plugged in.  Look for 3.5mm PJ-307C 5 pin jack with the switching pins.

Programmable Led Interface

There are a few different programmable LED components available but I included 2 standard WS2821b's.  Including 2 either side of the display to allow for some feedback or alarm indication.  Also added a breakout to connect an external led chain. If the led chain is externally power then this could also power the light switch (remember, each WS2821b could use up to 60mA so best not to use the copper traces to power a strip).

Fingerprint Sensor


Read more »