DIY Smart Fan Project and MQTT Integration Tips

Hey everyone, I wanted to share my recent project where I transformed a ‘dumb’ fan into a smart device using an ESP8266 board and MQTT integration. It’s been a fun and educational journey, and I hope you find it inspiring!

Project Background
I’ve always been interested in home automation, but I couldn’t justify buying a smart fan outright. Instead, I decided to take matters into my own hands. My goal was to control my fan wirelessly using my smartphone, and even integrate it with my existing SmartThings setup. The ESP8266 board seemed like the perfect solution—it’s tiny, affordable, and packed with features.

The Setup
I started by purchasing an ESP8266 NodeMCU board, a small breadboard, and an IR sensor kit. The fan I wanted to control uses an IR remote, so I knew I could leverage this to send commands wirelessly. I programmed the ESP8266 using the Arduino IDE and the IRremoteESP8266 library. The process involved capturing the IR codes from the fan’s remote and hardcoding them into the ESP8266’s firmware.

Challenges and Solutions
One hurdle I faced was ensuring the ESP8266 could communicate with my SmartThings setup. I discovered that creating a web server on the ESP8266 and using a HTTP Device Handler in SmartThings allowed me to send GET requests to trigger the fan’s IR commands. This was a bit tricky, but with some trial and error, I got it working!

Integration with MQTT
I also explored integrating the fan with MQTT, which opened up even more possibilities. By setting up a MQTT broker, I could control the fan from any device connected to my network. This was a great way to ensure compatibility with other smart home ecosystems like Alexa and Google Home.

Lessons Learned
This project taught me a lot about DIY electronics, MQTT, and the importance of thorough testing. I also learned the value of community support—without the guidance from forums and GitHub repos, I wouldn’t have made it this far.

Final Thoughts
While the project required some initial setup, the end result has been worth it. My fan is now fully integrated into my smart home, and I can control it from anywhere. I’m already brainstorming my next project—maybe a smart TV remote or an automated lamp!

If anyone has questions or wants to share their own DIY projects, feel free to reach out. Happy tinkering! :rocket: