Software

I wrote the software of the Central Unit in embedded C. I used a Segger J-Link EDU debug probe for programming and debugging, and a digital oscilloscope was used for signal measurements and for inspecting communication, and I also used an STM32F4 Discovery board for assisting purposes. It tended to be very useful, because the Discovery has the same ARM Cortex-M4 microcontroller as the Central Unit, thus I could immediately compile and download the source code to the Discovery, and I could set up a small network between the devices. Moreover I could try out my functions and libraries separately on the Discovery before I integrated them into the growing and complex software of the Central Unit. The whole source code consists of more than 8000 C rows (without microcontroller-specific libraries and peripheral libraries), and the compiled binary code is over 100kB.

Libraries

Although I used the popular FatFS library from Chan for implementing the Fat32 file system on the microSD card, I wrote all the required initializing and handling functions of all peripherals. Probably the most tricky task was to handle the FT800 graphical processor to control the LCD touch screen. At the time I started the project, FTDI (who manufactures the FT800 chips) didn't provide any kind of sample code or a guide how to program the FT800 chip. I built up the entire FT800 library completely on my own with a lot of hard work. During the development I implemented the essential functions required to handle the display and the touch gestures, and I decided to make the library portable and easily expandable. I published this library at GitHub, separately from the source code of the Central Unit.

View FT800 Library

Menu System

After switching on the Central Unit (and navigating through the starting screen), the main menu appears on the screen. Here the user can find all the essential information about the current state of the system, including the measured data from the external devices, the date & time, and the notifications & alerts.

HC display main

In the middle column there are the information received from the external units. The three boxes are selectable, and by tapping on a box, the current temperature and the desired target temperature values are displayed in the left column on the screen. In the right column there are the date and the submenu buttons. By tapping on the date, a date-picker screen appears where the user can set the current date and time. In the status menu the user can review the connected peripherals and their status. The values and alert limits, device names and connection interfaces can be set in the settings menu for each external units. The settings are saved on the microSD card, and these values are loaded into the memory on system startup, thus the user doesn't have to re-configure the system after reset. The settings can also be edited on PC by editing the config files on the microSD card. In the notifications menu the user can review the most recent notifications about the system.

Alerts

When a value exceeds the previously set limits, an alert is fired, and (if the alerts are enabled in the settings menu) a pop-up window appears on the screen and a beep-sound is played on the speaker to inform the user about the critical values. These alerts are logged, and the user can review these in the notifications menu.

HC display alert multiple

Communication

The system communicates with the external units on the individually selected interfaces. The system sends a query to each external unit in a 10sec "round", and the units respond with their measured data. The system is also capable of an event-based communication system. The Central Unit can receive data from the external units on every communication interface and at any time, therefore when a critical value is measured, the external unit sends the data to the Central Unit (there is no need to wait for the query from the Central Unit), and the system can react immediately.

Source Code

The whole source code of the Central Unit is available on GitHub where it can be viewed, downloaded or cloned.

View Source Code

Pictures