DEV Community

loading...
Cover image for How to Build an Integrated Gateway For Power Supply Station.

How to Build an Integrated Gateway For Power Supply Station.

abby06 profile image Abby ・2 min read

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.

Hardware

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.

Kernel

  • 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

Alt Text

  • 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

Alt Text

Software Module

Alt Text

Alt Text

Alt Text

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.

Presentation

Alt Text

Alt Text

Alt Text

RT-Thread Contact Info:

Website | Github | Twitter | Facebook | Youtube

Discussion (0)

pic
Editor guide