Introduction: PrgbControl 16x16 Ws2812b STMduino Panel
A lot of projects exist there like this, what is different: I use stm32f103c8t6 (BLUEPILL) for the brain of the panel.
Why?, STM have high capacities and a low price. And you can integrate it in Arduino IDE!
This project have the next features:
- Show Hour and Date, (stm32f103 have RTC embedded)
- Show any Text
- Show any Image 16x16
- 3 Animated Effects
- 3 Vumeters
- Lamp Mode (with desired intensity)
- 1 Output Power for any artefact (Optional)
- Play your favorite Music since sdcard. (Optional)
- Bluetooth (HC-06) for control all features with Android APK.
So, let´s continue.
- 1 stm32f103c8t6 (128kb prefered) BLUE PILL board (image)
- 1 WS2812b (black PCB, 5M 60Leds/m) Total 300 Leds (16x16= 256 required) (image)
- 1 lithium cell 3V (image)
- 1 Amp module (optional) if you use KY-037 (image)
- 1 DFPlayer mini (optional) (image)
- 1 SSR-25DA o similar (optional) (image)
- 1 HC-06 Bluettooth Module (image)
- 1 USB -Serial TTL converter like this (image) - Only for programming 1 time
- 1 Power Supply 5V-10A (image)
Others, enclosure, cables, connectors. According to your criteria
Step 1: Preparing the Arduino IDE
In this step, you need prepare the arduino IDE. for default Arduino don't include STM32 core.
Please follow this instructions
After you need install Maple bootloader in Bluepill. For This:
- Download STM32 Flash loader demonstrator
- Download generic_boot20_pc13.bin file
- Connect BluePill with USB-Serial TTL converter like the figure. Wait for a COM PORT name.
- Execute STM32 Flash and select the Com Port.
- After select the bin file and download it.
Please follow this instructions if you need more details.
Finally, We get convert bluepill in a stm32duino board!
Look the second image, there is my selected board in TOOLS:
- Board: "Generic STM32F1 Series"
- Board Part Number: BluePill F103CB (or C8 with 128Kb)
- Upload Method: "Maple DFU Bootloader Original"
Step 2: Uploading the Code
We are almost ready, but need some libraries for Arduino. (From Manage Library)
- STM32duino RTC more info
- Adafruit NeoMatrix more info, required NeoPixel
- Adafruit NeoPixel more info
- DFRobotDFPlayermini more info
Finally Open the ino file (stm32_panel.ino), remember the correct selected board and upload method. Send the code to our stm32duino converted board using a simple MicroUSB cable on the micro-usb port of bluepill.
Remember that bluepill drain power from Computer USB Port in this method, be careful. disconnect other power supplies for security.
Step 3: Building the Frontal Panel
My Panel is 300x290x80mm size. You can use metal, wood, paperboard, acrylic, etc.
My WS2812b ribbon is not adhesive, I use contact glue.
The direction is important, in the second image my first led is in the TOP-LEFT corner and the last is in the BOTTOM-RIGHT. You can change the order but you must modify the code.
In my case I use MDF 6mm thickness
Step 4: Building the Back Panel
In the back of the panel I fit all the components, see the last image where I wrote the components location.
In the first image You can see the connection's diagram. Remember that Bluepill works with 3.3V and some pins are 5V tolerant.
I tested max current in lamp mode (white color, 200 brightness) and this drains 7.5Amp. Since Power Supply is 10A we are fine.
In my case I try a kind of bus bars for +5V y GND signals for LEDS and avoid lost of power (see the images).
Step 5: Mounting the Boards
More images, in the first image I use a pre-drilled board for get out connectors. On top-left corner is the power connector +5V for the board. I disconnect this for upload updated codes.
Remember that SSR-25DA and DFPlayer are Optionals, do not affect operation.
- MIC signal is connected to PA0 pin (this board must use 3.3v)
- WS2812b is connected to PB9 pin (connected to +5V and GND)
- SST-25DA is connected to PA4 pin and GND
Bluetooth HC-06 module is connected to:
- RX -------------> PA9 (Tx)
- TX --------------> PA10 (Rx)
- VCC-------------> +5V
DFPlayer Mini is connected to:
- TX --------------> PB11 (Rx)
- RX --------------> PB10 (Tx)
- VCC ------------> +5V
SP1, SP2 to Speaker (until 3W speaker or you can connect it to AMP)
Step 6: Preparing the Music
This step is optional, if you don't have the module.
Prepare your favorite music in sd card using computer. DFPlayer Mini reproduce music according tha FAT table. First in copy is the first in play.
My android App can play 8 mp3 files one time and 8 folders in loop (You can put until 999 songs in each folder)
- Important!!! Folder's Name must be named 01, 02, 03, .. 08 (take note the content's folder in some place)
- Mp3 files can have any name.
If you need reorder the music according preference. use this
So you will have 8 folders with various songs inside and 8 mp3 files in the main root. (Can be voices, greetings for example)
Step 7: Finishing the Panel
I wish paint the panel, but finally i prefered cover it with speaker cloth.
I make a kind of bee panel for the leds, and cover it with white translucid acrylic.
Back I use other mdf cover (3mm) and Finally use aluminum profile for the frame in front and back.
If we power on the panel. We will the "Hola" welcome message. you can edit it in the code. Next will show the hour no updated. Congratz if works!
Step 8: Installing APK
Install the APK file in phone. It was created in MIT app Inventor.
Go to settings and activate bluetooth scanning. You must be HC-06 address and link it, key is 0000 or 1234.
Open the installed app named PgrbControl. First screen is the second image above.
Only Spanish labels are shown.
- Press "Conectar" and choose the HC-06 Module
- Top Label will show "Estado: Conectado" in green forecolor.
- Choose "Brillo" level and press "Lampara" for Lamp Test.
- Vumeters are "Clasico, Arcoiris, Estrella"
- Effects are "Fuego, Nieve, Arcoiris"
- "Reloj" shows Hour and Date (hour is kept for backup battery, date not unfortunately)
- "Activar Salida" activate SSR-25DA
- "Modo random" if on then in mode Hour sequence is Hour (30sec) - Text - Image(30 sec) (if image was sent)
else only hour is showed.
In "Texto Imagen" tab (third image)
- Choose text color (8 availables)
- Write your text message
- Press "Enviar" for show the text in the panel.
- Press any image and after press "Enviar Imagen" for display it.
- Custom Image?, Yes you can, follow in last step.
In "Avanzados" tab (last image)
- You can update the hour or date with "Hora" and "Fecha"
- Set the Audio Volume with "Volumen Audio" slider and press "Enviar"
- Press any button from 1 to 8 (remember the order) and you will hear the single mp3 files.
- Press the switch on "Reproducir una carpeta" and press button from 1 to 8 again and you hear the folders named 01 to 08.
Step 9: Custom Images
Unzip the WS2812b_generator.rar file and execute it.
- In the main window select: "Archivo -> Abrir" and select any image that you want.
- Yout image will be resized to 16x16 after configuration is MATRIX_TOP + MATRIX_LEFT + MATRIX_ROWS + MATRIX_PROGRESSIVE. Choose "Archivo CSV" and Color "R.G.B"
- Press "Generar Código" see the example image. and save it like txt file
- I include 3 example files "bunny.txt", "cake.txt", "gift.txt"
the examples files or created files for you must be moved to phone.
- Move the files to "Download" folder of Android Phone.
- Open the App. and in the second tab press "Abrir archivo".
- Write the file name without extension like "bunny", "cake", "gift". and Ok
- Press "Enviar Imagen" and that's all.
Step 10: Demostration
See the demo video
Until next time, Bye.