Pannello a led RGB compatibile MQTT

MQTT RGB Led panel is a digital signage device easy to integrate inside an existing IOT ecosystem. It can get the messages to show from a MQTT broker. The project is based on Arietta G25 and is fully open hardware and software.


What is MQTT ? What is IOT ? What is an Arietta ? What is a RGB led panel ? Dove comprarlo ?

Invia un messaggio da Javascript

In Acme ci sono due pannelli a led installati. Da questa pagina puoi inviare un messaggio a questi pannelli usando le librerie Paho per Javascript ed una connessione WebSocket verso il broker iot.eclipse.org.

MQTT pusher per pannello: LedPanel 1

MQTT LedPanel gets the print commands from MQTT broker from making a subscription to the following topic:

tanzolab/mqtt_panel/macaddress/cmd 

macaddress is mac address of your Arietta G25 WiFi adapter and is unique all over the world so you can use also public MQTT broker like iot.eclipse.org to talk with your LedPanel.

From this topic LedPanel waits for a JSON message in this format:

#Print a string
{
    "cmd"     : "print",
    "font"    : "font filename",
    "color"   : "font color",
    "bgcolor" : "background color",
    "text"    : "text"
}

What is a Topic ? What is JSON ? What is a MAC address ?

Descrizione

The MQTT RGB LedPanel is made my tree main parts:

  • A RGB panel composed by 1024 RGB leds ordered in 32x32 grid on a black PCB of 19x19 cm size. This part usually is made by a Chinese company called LINSN
  • An Arietta G25 Linux module complete with a WiFi module
  • A 4A 5VDC wall adapter

All the parts can be fixed inside a cheap and elegant IKEA RIBBA photo frame as shown below:

Getting started

Insert the microSD provided with the MQTT LedPanel kit inside your PC. The first partition is formatted in FAT32 so you can access to it on any OS (Windows, Linux or OSX).

Edit the file wpa_supplicant.conf using and ASCII editor like Nodepad, Nodepad++, Wrangler, gedit, etc.

What is FAT32 ? What is an ASCII editor ? What is wpa_supplicant.conf ?

Insert the name of your WiFi access point and the password to get the access:

network={
    ssid="your access point name"
    psk="password"

    scan_ssid=1
    proto=WPA RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
}

then save it, unmount the microSD and use it to boot your LedPanel.

Turn-on the LedPanel and wait. After about 1 minute will appear the mac address on the RGB panel.

How the RGB led panel works inside

The RGB led panel has a two 16 pins male connector where to send data using a synchronous serial transmission.

  • Three data lines are for the Red, Green and Blue (Rx, Gx, Bx)
  • One line is for the serial clock (CLK)
  • One line is for latching the data sent after 32 clock pulse (STB)
  • One line is to enable the latch output line to the led (OE)

The panel is logicaly splitted in two section:

  • Top 16 rows of 32 led each
  • Bottom 16 rows of 32 led each

R0, G0 and B0 are the data sent to the top block

R1, G1 and B1 are the data sent to the top block

Four address lines (A,B,C and D) select to which row of led are sending the data on Rx,Gx and Bx lines

This is the lock diagram of the internal parts of a RGB led panel

RGB led panel pinout

This is the pinout of input data connector:

LED Pin # Signal Description Arietta pin # Line gpio ID
1 R0 Red 1st bank J4.10 PA21 21
2 G0 Green 1st bank J4.8 PA22 22
3 B0 Blue 1st bank J4.7 PA23 23
4 GND Ground J4.9
5 R1 Red 2nd bank J4.11 PA24 24
6 G1 Green 2nd bank J4.13 PA25 25
7 B1 Blue 2nd bank J4.15 PA26 26
8 GND Ground J4.9
9 A Row address J4.28 PA5 5
10 B Row address J4.27 PA6 6
11 C Row address J4.26 PA7 7
12 D Row address J4.25 PA8 8
13 CLK Clock J4.17 PA27 27
14 STB Strobe J4.19 PA28 28
15 OE Output Enable J4.21 PA29 29
16 GND Ground J4.9

On the output data connector just replicates the input lines for a wire another RGB led panel display.

The power supply connector needs 5 VDC @ max 3A. At this current all leds are on at maximum brightness.

How the ledpanel Linux driver works

All the rgb led panel are generate in bit banging mode using normal GPIO lines. To go as fast as possible a Linux driver written in C code is required. The driver I wrote can update the whole panel contents 679 times per second leaving enough time to Linux to do other jobs in the meanwhile. The main routine of this driver is a callback function called by a hrtimer 10800 times per second at interval of 92uS. In just 22uS this routine check the brightness of each color and send a simulated pwm signal to any led (32 x 3 color = 96) on a single row then exit. It will be called again by the Kernel after 66uS.

The fully source code of this driver is available under GPL licence on GitHub: ledpanel source on GitHub

Python MQTT client

Compiling ledpanel driver from the sources

To compile ledpanel.c it is requested a Linux Ubuntu PC on where install the cross compiler toolchain and Linux Kernel sources. Follow this tutorial to know how to do that:

Inside the Kernel configuration be sure that the High Resolution Timer in enabled:

General setup  --->
    Timers subsystem  --->
        [*] High Resolution Timer Support  

Clone inside the home directory of your Linux PC the ledpanel GitHub repository:

git clone git://github.com/tanzilli/ledpanel.git
cd ledpanel

Launch the module compilation by typing:

make -C ~/path-to-linux-sources/linux-4.9.33 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- M=`pwd` modules

then copy the binary file generaterd inside Arietta G25 microSD

scp ledpanel.ko root@ledpanel.local:/root

Open a command session on Arietta and load the Kernel module:

insmod ledpanel.ko

How to mount ledpanel.ko automatically at startup

Copy the module into a well known location on the Arietta microSD:

cp ledpanel.ko /lib/modules/$(uname -r)/kernel/ledpanel.ko

Add it to the module list to load at bootstrap

echo ledpanel >> /etc/modules

refresh the kernel tables:

depmod

check only if the module is loaded:

modprobe ledpanel

reboot Arietta:

reboot

Links

Sergio Tanzilli (Autore - Progettista hw & sw - Imprenditore - Musicista dilettante, classe 1964)
Fondatore di Area SX srl, Acme Systems srl e del TanzoLab, si occupa dal 1974 di elettronica digitale, dal 1978 di microprocessori, dal 1992 di microcontroller, dal 1995 di Linux e pubblicazioni su Web, dal 2005 di progettazione, produzione e commercializzazione di schede Linux Embedded.
http://www.tanzilli.com - http://www.acmesystems.it - https://github.com/tanzilli - sergio@tanzilli.com



Le attività del TanzoLab si svolgono ogni mercoledi sera, salvo casi speciali, dalle ore 18:30 presso i locali della Acme Systems srl e consistono in:

  • Talk monotematici a cura di professionisti in vari settori tecnologici
  • Workshop pratici su elettronica embedded, produzione e informatica
  • Progettazione e realizzazione di nuovi prodotti embedded per l'IT

Le attività vengono coordinate tramite questo sito, in cui vengono pubblicati tutti i lavori svolti o in via di sviluppo, e tramite un gruppo Telegram con cui per interagire direttamente via chat con gli altri membri.