After moving into a new home, I’ve been working on connecting as many household appliances as possible to the network — enabling remote control and monitoring to make the home smarter, more flexible, and simply more fun to use.
This project focuses on adding Wi-Fi connectivity to a Midea electric water heater, integrating it into a smart home system.
The project uses the Ai-M61-32S-Kit (thanks to Ai-Thinker for providing the board).It’s a very powerful development board — the processing speed is impressive, and it runs a web server smoothly without any issues.
Based on suggestions from previous projects, I decided not to replace the original main MCU of the water heater this time.Reference:https://bbs.ai-thinker.com/forum.php?mod=viewthread&tid=47239
Instead, I chose to control the heater via infrared (IR) by using the Ai-M61-32S to transmit IR codes.
All connections were made with flying wires and manually soldered.
The Ai-M61 runs a web server and connects to Wi-Fi. The system includes:
- DS18B20 temperature sensor to measure water temperature
- IR transmitter to control the water heater
- Optocoupler input to detect whether the heater is currently heating
- DS1302 RTC chip to maintain timekeeping when Wi-Fi is unavailable
IR remote control signals were captured using a logic analyzer with an IR receiver module.
IR Protocol AnalysisAnalysis showed that the IR protocol is custom, not standard NEC.Therefore, the Ai-M61 simply transmits the captured IR codes directly.
Protocol details:
- Leader code: 12 ms + 4.5 ms
- 42-bit data:
- “0”: 560 μs + 560 μs
- “1”: 560 μs + 1680 μs
End code: 560 μs + 23000 μs + 18 μs + 4500 μs + 820 μs
IR Codes:
- Power ON/OFF:0x58853B D0AF1A A1 DC 0B F5 80
- Temperature +:0x58853B F08F1A A1 DC 0F F1 80
- Temperature −:0x58853B F48B1A A1 DC 2F D1 80
- Medium level:0x58853B C8B71A A1 DC 13 ED 80
- Timer:0x58853B D8A71A A1 DC 1B E5 80
The system is powered directly from the water heater’s internal 5V supply, confirmed using a multimeter.
After opening the heater control board:
- The optocoupler input is connected to the heating indicator LED
- The IR transmitter is fixed next to the original IR receiver using hot glue
The module is then installed inside the water heater.
This is a low-cost DIY solution with no additional hardware cost, though long-term reliability may be lower than a commercial design.
After flashing the firmware with initial OTA support, the system was fully assembled. There is plenty of remaining flash space.
Firmware DevelopmentThe software was developed module by module, referencing excellent examples shared by community members:
- Added a button on IO08 (long press, single click, double click, release)
- Used FlashDB to store Wi-Fi SSID and password
- LittleFS file system to store DS18B20 temperature records
- DS18B20 temperature sensing
- OTA firmware update implementation
Project Showcase
![[DIY] Adding Wi-Fi to an Electric Water Heater- Ai-M61-32S](https://prod.hackster-cdn.online/assets/transparent-a0c1e3063bcabc548a5f3fa7328f3c1c97f747e6e764da4c14439567baa79ae1.gif)








Comments