Java program that receives events via MQTT and displays scenes using a TPM2 device (connected via serial link) which controls a connected LED strip. The program writes TPM2 frames to the serial link which will then be interpreted by a TPM2 device. The TPM2 device can be a simple µController like an Arduino or an ESP8266. However, the Arduino seems to be not fast enough to manage the amount of data sent since it is very limited both in processing speed and the size of the serial buffer.
Scenes visualized using the strip:
The strip can also be used to lighten the football table.
You can either run docker in privileged mode (--privileged
) or pass in the device(s) available in the container
docker run --rm --device=/dev/ttyUSB4:/dev/ttyUSB0 -e LEDS=72 -e TTY=/dev/ttyUSB0 -e MQTTHOST=mqtt -e MQTTPORT=1883 ledcontrol
Because the device numbers depends on the order the devices are connected you should use static links. You can add your own udev rule or just use the already existing link:
docker run --rm --device=/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0:/dev/ttyUSB0 -e LEDS=72 -e TTY=/dev/ttyUSB0 -e MQTTHOST=mqtt -e MQTTPORT=1883 ledcontrol
LED strip showing score
See below for building your own TPM2 device. You can find the sketch to upload in this repo.
LED controller module using an ESP8266, top and bottom layout view
The soldered PCB
Showing the ESP8266 module inside a hand crafted case (used to be a RasPi case)
Beside the RGB LED strip (WS2812B), the three wire (white/green/red) connection cable (JST) and a micro USB cable we used the following parts to build the TPM2 device.
Amount | Description | Price (china) |
---|---|---|
1 | Resistor 470Ω | 0,10€ |
1 | Capacitor 1,0mF | 0,50€ |
1 | WeMos D1 mini (ESP8266) | 2,00€ |
1 | 5V Power supply 6A/30W (One RBG LED drains upto 60mA) |
8,00€ |
1 | PCB mount power socket connector (matching power supply connector) |
0,05€ |
1 | PCB 15"x15" | <1€ |
(2) | (Optional) 8 pins single row female pin header | 0,10€ |