This is a project based on the Nucleo-F429ZI microcontroller board and the SVM30 sensor module. The programming language is C. The aim is to capture several environmental parameters, and send them through the Ethernet to a data-logging system/computer. This project contributed to a research at the ISEA institute of RWTH Aachen University, Germany.
Tasks
Sensor measures: Temprature, Relative Humidity(RH), Carbon Dioxide equivalent(CO2eq) and Total Volatile Organic Compounds(TVOC).
Board processes raw data to get calculated, readable values.
Board transmit data through the UDP protocol to a designated IP address.
Additional features
Dedicated sensor library
Sleep mode for board -> active only during a defined, recurring period of data capture, calculation, and transmission
Real-time data visualization -> Matlab script
Network packet capture -> Wireshark
2 - Required Software
Name
Usage
LwIP
Network stack
STM32CubeIDE
Programmer and debugger
STM32Cube FW_F4 V1.25.2
Board firmware package
MATLAB2020b
Real-time data monitoring
Wireshark
Real-time UDP packet monitoring
3 - Required Hardware
Name
Usage
SVM30
Sensor module
Nucleo-F429ZI
Microcontroller board
Computer
Data-logging
Compatible board alternatives with the following resources:
I2C bus * 1
Sleep mode capability
Power supply: 5V, 49mA
Ethernet with lwIP stack support
General purpose interrupt timer * 1
4 - Hardware setup
Pin (board)
To Pin (Sensor)
CN8 - 5V
3 - VDD
CN7 - PB_8
1 - SCL
CN7 - PB_9
4 - SDA
CN7 - GND
2 - GND
Also
To...
Ethernet port
Local network
ST-Link USB PWR
Computer usb port for programming
Any standard usb port (PC, powerbank) for operation
5 - Software setup
Method 1 - Complete package
Step 1
Extract Clean_UDP_Remote.rar
Step 2
Import project to CubeIDE
Step 3
Connect board and run program
Method 2 - Essential files
Step 1
Create a new Nucleo-F429ZI project on CubeIDE
Step 2
Put all essential files into their respective folders according to 8 - Folder Structure
Step 3
Open .ioc file and generate code through CubeMX
Step 4
Connect board and run program
6 - Code & Settings
*Below are settings that could be tweaked to quickly adapt to different setup environments. For full settings, please check the files.
Clock settings - Clean_UDP_Remote.ioc
Network settings - Clean_UDP_Remote.ioc
Packet message settings
main.c
All four measurements are sent in one single packet as char. strings.
Modify measurement string separators in sprintf() in void doTasks(struct pbuf *pbufPtr),
7 - Operation
Start
Step 1
Turn on board power supply
Step 2
Wait for >15s
Step 3
Alternating blue and red LED -> board is now capturing and sending data
Monitoring
Data update
Outgoing/Incoming measurement data every 1s
Matlab script
Automatically shows live plots and saves data to a matrix type
Wireshark
Enter "ip.addr == 10.183.93.46" into filter to display packets from the board
End of program
Board turn-off
Directly turn off power source
Examples - Wireshark and Matlab
8 - Known issues
I2C pin mismatch
After every code generation from editing the .ioc file
Need to change GPIO_PIN_6 to GPIO_PIN_8 in i2c configurarion file (e.g. i2c.c or main.c)