This project reads data from a FATEK PLC over the FATEK RS232 communication protocol and shows status messages on a HUB75 LED matrix panel.
The firmware runs on ESP32 and uses two FreeRTOS tasks:
- one task for PLC communication;
- one task for LED matrix rendering.
- Reads PLC coils and registers (
M,D,R) through FATEK RS232 protocol commands. - Computes and uses LRC checksum for FATEK RS232 frame validation.
- Converts selected register ranges into text.
- Chooses a display scenario based on PLC state.
- Shows 3-line messages with centered text and smooth scrolling.
- Detects PLC communication timeout and shows error status.
The firmware always shows only one active scenario, based on this priority order (top = highest priority):
-
Scenario 6 - Communication error
Condition: PLC communication timeout.
Display:Acest post este INDISPONIBIL E0 -
Scenario 7 - Unavailable
Condition:M120 = 0(only when communication is OK).
Display:Acest post este INDISPONIBIL E1 -
Scenario 5 - Pause finished
Condition:M99 = 1andD0 > 0. -
Scenario 4 - Pause
Condition:M97 = 1andD0 > 0. -
Scenario 3 - Function display
Condition:M94 = 1, exactly one ofM71..M79 = 1, andD0 > 0. -
Scenario 1 / 1.1 / 1.2 - Welcome states (
D0 = 0)- Scenario 1:
M320 = 1 - Scenario 1.1:
M322 = 1 - Scenario 1.2:
M321 = 1
Internal text selection order in code:1.2->1.1->1.
- Scenario 1:
-
Scenario 2 - Amount introduced
Condition:D0 > 0(used when higher-priority scenarios are not active).
Some lines are static and some lines scroll from right to left, based on scenario and text length.
M71..M79(0x817..0x81F): select active function group in Scenario 3 (exactly one active).M94(0x82E): enables Scenario 3 logic.M97(0x831): enables Scenario 4 (Pause).M99(0x833): enables Scenario 5 (Pause finished).M120(0x848): availability flag (0-> Scenario 7 unavailable message).M320(0x910): Scenario 1 (welcome + minimum amount).M321(0x911): Scenario 1.2 (welcome variant with Boxa + ATM message).M322(0x912): Scenario 1.1 (welcome variant with tokens message).
D0(0x1770): core amount/status condition (D0 = 0for welcome states,D0 > 0for amount-based states).D10(0x177A): used in Scenario 1 to buildminimum X Lei/Leu.D47..D49(0x179F..0x17A1): time/value formatting for Scenario 3 and Scenario 5.D57..D59(0x17A9..0x17AB): time/value formatting for Scenario 4.
- Used ranges:
R10..R99(0x0A..0x63) andR110..R199(0x6E..0xC7). - These registers hold ASCII text payload for Scenario 3.
- Mapping by active
Mbit:M71-> line 1 fromR10..R19, line 2 fromR110..R119M72-> line 1 fromR20..R29, line 2 fromR120..R129M73-> line 1 fromR30..R39, line 2 fromR130..R139M74-> line 1 fromR40..R49, line 2 fromR140..R149M75-> line 1 fromR50..R59, line 2 fromR150..R159M76-> line 1 fromR60..R69, line 2 fromR160..R169M77-> line 1 fromR70..R79, line 2 fromR170..R179M78-> line 1 fromR80..R89, line 2 fromR180..R189M79-> line 1 fromR90..R99, line 2 fromR190..R199
The display uses RGB colors from code (via color565 conversion):
- White:
(255, 255, 255)for welcome messages (Scenarios 1/1.1/1.2) - Light green:
(128, 255, 128)for Scenario 2 - Red:
(255, 0, 0)for Scenarios 6 and 7 - Orange:
(255, 128, 0)for Scenario 4 title - Pink:
(255, 128, 128)for Scenario 5 title lines - Blue accent:
(128, 128, 255)for time lines in Scenarios 3/4/5
Scenario 3 line colors by function bit:
M71:(0, 255, 128)M72:(0, 128, 255)M73:(255, 0, 255)M74:(0, 255, 255)M75:(128, 255, 0)M76:(255, 0, 128)M77:(128, 0, 255)M78:(0, 255, 0)M79:(255, 255, 0)
- MCU: ESP32
- PLC link: FATEK communication protocol over RS232
- Matrix: HUB75, configured as
64x32, chain1 - HUB75 to ESP32 pin mapping used in this project:
R1->GPIO25G1->GPIO26B1->GPIO27R2->GPIO14G2->GPIO12B2->GPIO13A->GPIO23B->GPIO19C->GPIO18D->GPIO5E->-1(not used for current panel setup)LAT->GPIO32OE->GPIO15CLK->GPIO33
- RS232 serial defaults in code:
- RX:
16 - TX:
17 - Baud:
115200 - UART format:
7E1(SERIAL_7E1) - Station/Slave ID default:
1 - Request timeout:
2000 ms - Communication timeout status threshold:
3000 ms
- RX:
For deeper technical details about FATEK register maps, address models, and protocol-level behavior, use the manuals in Manuale/ (summarized below).
This folder keeps offline PDFs, ZIP archives, wiring notes, and reference projects for FATEK serial protocols, PLC programming, and related hardware. Use it when you need the official framing, command codes, register/converter addressing, or connection details beyond what this README summarizes.
| Document | What it is for |
|---|---|
08_M_PLC_Binary_Communication_Protocol_User_Manual_en.pdf |
Primary reference: FATEK PLC binary / serial communication protocol (frames, commands, usage). Aligns with how this project talks to the PLC over RS232-style serial. |
Chapter_12.pdf, Appendix1.pdf, Apendix 2.pdf |
Supplementary chapters / appendices (protocol and addressing detail—check TOC inside each PDF). |
Manuale/Comunicare/FATEK manuals/Manual_1_All_en.zip, Manual_2_All_en.zip |
Bundled FATEK manual collections (English); unzip locally for full PLC/system documentation. |
Manuale/Comunicare/FATEK manuals/WinProladder_Manual_en.pdf |
WinProladder programming environment reference. |
| Path | What it is for |
|---|---|
Manuale/Comunicare/RS232 ASCII Fatek communication protocol/FatekSimpleTest/ |
Small Arduino-style example (FatekSimpleTest.ino) plus LRC_checksum helpers—useful cross-check for framing/LRC behaviour vs main/LRC_checksum.*. |
| Document | What it is for |
|---|---|
trs3232e.pdf |
RS-232 line driver/receiver IC datasheet (level shifting / UART ↔ RS232). |
MT8072iP_Datasheet_ENG.pdf, GME871P30_MT8072iP_Installation_221019.pdf |
HMI / panel datasheet and installation notes. |
FATEK_FB_FBs_B1_B1z.pdf |
FATEK FB documentation (PLC instruction/function blocks—PLC-side programming reference). |
For comparison, troubleshooting serial buses in general, or work on sibling RS485 projects, see Manuale/Comunicare/Curs ModBus RTU/ (Modbus overview, addressing, function codes, troubleshooting PDFs) and Manuale/Comunicare/RS485 proiect/ (RS485 wiring images, MAX485 datasheet, Modbus specification excerpts, older firmware snippets).
Rs232.png,RS232 - banana.jpg,Rs485 COM.png— quick visual references for serial interfaces.
Note: Large binaries under Manuale/ may not be suitable for every Git host; if you mirror only source code elsewhere, copy Manuale/ separately or rely on official FATEK downloads.
main/main.ino- main firmware, scenario logic, display rendering, task creation.main/FATEKRS232.h- RS232 data structures and public API.main/FATEKRS232.cpp- FATEK RS232 polling, parsing, communication state, register decoding.main/LRC_checksum.h- LRC checksum declarations.main/LRC_checksum.cpp- LRC checksum implementation used by FATEK RS232 frames.registrii FATEK utilizati.txt- register usage reference.culori folosite.txt- color reference notes.Manuale/- manuals, datasheets, and communication reference materials (see Documentation (Manuale/) above).
Store the reference images in img/ (project root), then they will render directly in this README.
This project uses:
ESP32-HUB75-MatrixPanel-I2S-DMA(HUB75 library) - MITArduino Core for ESP32(Arduino/ESP32 framework) - LGPL-2.1
- Open the project in Arduino IDE or PlatformIO with ESP32 support.
- Select the correct ESP32 board and serial port.
- Verify RS232 electrical level compatibility with ESP32 UART (use a proper transceiver/adapter when required).
- Upload firmware and monitor serial output at
115200if Serial Monitor debug is enabled.
This repository is licensed under GNU General Public License v3.0 (GPL-3.0).
See the full license text in the LICENSE file.
This project depends on third-party software with compatible licenses:
- HUB75 library (
ESP32-HUB75-MatrixPanel-I2S-DMA) - MIT License - GitHub - Arduino core/framework parts - LGPL-2.1 - GitHub
Compatibility note:
- MIT-licensed code is compatible with GPL-3.0 and can be used in a larger GPL project.
- LGPL components are compatible with this project structure and usage model.
Important obligations kept by this project:
- Original copyright/license notices from dependencies should be preserved.
- Third-party license terms remain valid for their own code parts.
- This project-level license (GPL-3.0) applies to the project as distributed.



