Integrated Gateway For Power Supply Station.

RT-Thread IoT OS
3 min readSep 22, 2020


The existing and newly built five-star power supply station has installed a lot of smart devices, such as photovoltaic energy storage, central air conditioning, smart lighting, smart curtains, access control systems, and so on. Each sub-system interface is different, and there is no unified interface or platform, this project is going to solve this problem, and also settle some specific problems, such as carrier communication, and leakage monitoring, and so on.



Main Control: STM32F767IGT6. External extension of 32-bit SDRAM. External interfaces include:

  • 1 10/100M gateway.
  • 1 RS485 interface.
  • 1 CAN interface.
  • 1 RS232 interface.
  • 1 carrier communication interface.
  • 1 relay switch volume interface.
  • 3 AC voltage measurement interfaces.
  • 1 leakage monitoring interface.
  • 1 TYPEA-USB connector.
  • 1 Micro-USB interface.
  • 1 temperature and humidity measurement interface.
  • WIFI.
  • 4G.


Implementation features:

  • Modbus-TCP docking photovoltaic energy storage system.
  • Modbus-RTU docking the central air conditioning system.
  • Measure the ambient temperature and humidity of the installation.
  • Measure the three-phase voltage value.
  • Measure the leakage value of the switch.
  • QPSI device analog U-stick.
  • LCD displays sub-system data and acquisition data.
  • Timely upload of ucloud leakage value and remote control the power.



  • Inter-thread synchronization: semaphore, mutex.
  • Inter-thread communication: mailbox, message queue.
  • Memory management: memheap management algorithm.
  • I/O Device Management: PIN Device、SPI Device、UART Device、RTC Device、LCD Device、WATCH DOG Device、SENSOR Device.
  • FinSH Console
  • Virtual File System
  • NETDEV NIC(Network Interface Controller)
  • AT Command
  • SAL (Socket Abstraction Layer)
  • UCLOUD Software Package: ucloud_iot_sdk-latest
  • AT Device Software Package: at_device-latest
  • LIBMODBUS Software Package: libmodbus-latest
  • OTA Software Package: ota_downloader-latest
  • Network Package: netutils-latest
  • DHTxx Software Package: dhtxx-latest
  • EASYFLASH Software Package: EasyFlash-latest
  • FAL Software Package: fal-latest

Hardware Architecture

  • ATT7022EU: Measuring three-phase voltage and leakage.
  • W25Q256: One piece for storing word libraries and pictures and another piece for firmware download, factory firmware, EASYFLASH use, etc.
  • AM2301: Temperature and humidity measurement.
  • EC200T: 4G communication.
  • ADM2483: RS485 communication.
  • MAX232A:RS232 Communication.
  • ESP8266: WIFI.
  • LCD: RGB888, screen resolution 800 x 480.
  • IS42S32800G: 32-bit SDRAM, 32M.

Software Architecture

Software Module

The above photo shows the most important task that responsible for refreshing the data displays on the screen, other acquisition tasks and data interaction tasks have their own semaphore, refresh task to get the semaphore waiting for 10MS, and then refresh the corresponding area.


RT-Thread Contact Info:

Website | Github | Twitter | Facebook | Youtube



RT-Thread IoT OS

An Open-Source Community-Powered Real-Time Operating System (RTOS) Project! Let’s develop, DIY, create, share, and explore this new IoT World together!