The W55MH32L-EVB is a powerful Ethernet-enabled microcontroller evaluation board featuring the W55MH32L chip. At its heart is a 32-bit Arm® Cortex®-M3 core running at up to 216MHz, with 1024KB of flash memory, 96KB of SRAM, and a fully integrated hardware TCP/IP offload engine (TOE).
In this project, we'll build a temperature monitoring system that:
- Reads temperature data from a DHT22 sensor
- Displays the temperature on a TM1650 4‑digit 7‑segment display
- Automatically turns on a motor and an LED when the temperature exceeds 23°C
- Provides clear console feedback for debugging
This is a perfect starting point for environmental monitoring, smart home automation, or any project that requires conditional actuation based on sensor input.
Pin ConnectionsComponent Pin W55MH32L-EVB Pin
DHT22 VCC 3.3V
GND GND
DATA PC6
TM1650 CLK PB10
DIO PB11
VCC 3.3V
GND GND
Motor Module INA PG8
INB PG7
VCC 5V
GND GND
LED Module VCC 3.3V
GND GND
Signal PC7SetupInstalling Required Libraries
The DHT22 and TM1650 drivers are needed:
DHT22– The dht module is included in standard MicroPython. Usefrom dht import DHT22.TM1650– Download the TM1650 MicroPython driver from the W55MH32 GitHub repository.
Upload both main.py and tm1650.py to your board's root directory.
Code Explanation1. Imports and Pin Definitions
from machine import Pin, I2C
from dht import DHT22
from tm1650 import TM1650We import the necessary modules:
- machine.Pin for GPIO control
- machine.I2C for I2C communication with the TM1650
- dht.DHT22 for reading the DHT22 sensor
- tm1650.TM1650 for the 4‑digit display driver
2. Hardware Initialisation
# ===== Pin definitions =====
# DHT22
DHT_PIN = "PC6"
sensor = DHT22(DHT_PIN)
# Motor
MOTOR_INA = Pin("PG8", Pin.OUT)
MOTOR_INB = Pin("PG7", Pin.OUT)
# LED
LED_PIN = Pin("PC7", Pin.OUT)
# TM1650 display (CLK = PB10, DIO = PB11)
i2c = I2C(1)
display = TM1650(i2c)
display.set_brightness(5)The DHT22 is connected to pin PC6, and the TM1650 is initialised on I2C bus 1 with brightness level 5.
3. Helper Functions
motor_on() / motor_off()– Control the motor driver by setting INA and INB pinsled_on() / led_off()– Control the LED on PC7display_temp()– Formats the temperature for the 4‑digit display
4. Display Formatting
def display_temp(temp):
val = int(round(temp * 10, 0))
d1 = (val // 100) % 10
d2 = (val // 10) % 10
d3 = val % 10
display.write_digit(1, d1, dp=False)
display.write_digit(2, d2, dp=True)
display.write_digit(3, d3, dp=False)The temperature is displayed with one decimal place. For example, 23.6°C becomes "23.6" with the decimal point on the second digit.
5. Main Loop
while True:
sensor.measure()
temp = sensor.temperature()
if temp >= 23.0:
motor_on()
led_on()
else:
motor_off()
led_off()Every 2 seconds, the code:
- Measures temperature and humidity from the DHT22
- Updates the display
- Checks if the temperature exceeds 23°C
- Activates the motor and LED if above the threshold, or deactivates them if below
This project demonstrates how easily you can combine sensor input, display output, and actuator control on the W55MH32L-EVB using MicroPython. With the hardware TCP/IP offload engine, you can later extend this system with Ethernet connectivity, MQTT, or a web interface – all without sacrificing performance.







Comments