🛠 Autonomous IoT Weather Station with ToughC5
Objectives
This tutorial aims to create an autonomous weather station using the M5Stack ToughC5. You will learn to configure external power, communicate with a sensor via the RS485 bus, and display data in real-time on the 2.0-inch IPS LCD screen. This use case leverages the outdoor robustness of the PC+ABS housing and multi-protocol connectivity.
Required Materials
- 1x M5Stack ToughC5 board (ESP32-C5HR8)
- 1x RS485 compatible environmental sensor module (e.g., temp/humidity)
- 1x 12V DC power supply or 3.7V Li-ion battery
- Cables for HY2.0-4P connectors
- Arduino IDE with ESP32-C5 support installed
Steps
- Hardware Configuration: Connect power via USB Type-C or RS485 terminals (6-24V). Ensure the CR2032 battery is inserted for the RX8130CE RTC.
- RS485 Wiring: Use a dedicated HY2.0-4P connector. Connect the sensor's A and B lines to the corresponding ToughC5 pins. Note that the M5IOE1 manages communication mode switching.
- Software Environment: In Arduino IDE, select the "M5Stack ToughC5" board. Install the
M5GFXlibrary for ILI9342C screen control andM5RS485for serial communication. - Display Initialization: Code the initialization of the capacitive touch screen. Configure brightness (max 853 nits) for outdoor visibility.
- Data Reading: Implement a reading loop on the RS485 serial port. Parse received sensor frames (Modbus RTU or ASCII protocol depending on your module).
- Data Display: Update the graphical interface with temperature and humidity values. Use the passive buzzer for a local alert if thresholds are exceeded.
Verification
Open the serial monitor at 115200 bauds. You should see raw sensor data displaying. On the ToughC5 screen, values must be readable without flickering. Test weather resistance by placing the housing in a humid environment (non-submersible).
Going Further
Exploit dual-band Wi-Fi 6 to send data to an MQTT server. Activate deep sleep mode (10.41 µA) between readings to maximize battery life. You can also integrate the Zigbee protocol via IEEE 802.15.4 to create a mesh network of sensors.
Other tutorials for this board
Code examples for this board
toughc5_gpio_button_buzzer.inoC++ (Arduino)toughc5_wifi6_scanner.inoC++ (Arduino)toughc5_rtc_battery_log.inoC++ (Arduino)toughc5_ili9342c_touch_ui.inoC++ (Arduino)toughc5_rs485_modbus_master.inoC++ (Arduino)toughc5-rs485-modbus-master.inoArduino C++