Dimming Traditional Incandescent Lamps with OpenHAB and Arduino

I’ve always been fascinated by the idea of controlling traditional incandescent lamps through smart home systems. After some research and experimentation, I managed to create a system that allows me to dim these classic bulbs using OpenHAB and an Arduino. Here’s how I did it and what I learned along the way.

The Challenge

Dimming traditional incandescent lamps isn’t as straightforward as with modern LED bulbs. These lamps require phase-cut dimming, which involves controlling the TRIAC to regulate the power supplied to the bulb. This method adjusts the brightness by cutting off a portion of the AC sine wave.

The Solution

I decided to use an Arduino Uno with an Ethernet shield to connect to my OpenHAB system. The circuit includes a TRIAC, an optocoupler for galvanic isolation, and a zero-crossing detector to ensure precise timing. Here’s a breakdown of the components and setup:

Hardware Components

  • Arduino Uno: Acts as the controller.
  • TRIAC Module: Controls the power supply to the lamp.
  • Optocoupler: Ensures safety by isolating the low-voltage Arduino circuit from the high-voltage mains.
  • Zero-Crossing Detector: Detects the point in the AC sine wave where the voltage crosses zero, ensuring accurate phase-cutting.

Software Setup

The Arduino code detects the zero-crossing signal and waits for a specific time before triggering the TRIAC. This delay determines the brightness level. The code also communicates with OpenHAB via MQTT, allowing me to control the dimmer through the OpenHAB interface.

Key Learnings

  1. Safety First: Working with mains voltage is dangerous. Always ensure proper isolation and follow safety guidelines.
  2. Precision Timing: The zero-crossing detection is crucial for accurate dimming. Any delay in triggering the TRIAC can lead to flickering or inconsistent brightness.
  3. Integration with OpenHAB: Using MQTT to communicate with OpenHAB made the system user-friendly. I can now control the dimmer through the OpenHAB app or web interface.

Tips for Success

  • Start Simple: Begin with a basic circuit to understand the principles before integrating it with OpenHAB.
  • Test Thoroughly: Ensure the circuit works reliably before connecting it to the mains.
  • Use Quality Components: Invest in good-quality TRIAC modules and optocouplers to ensure longevity and safety.

Conclusion

This project was a great learning experience, combining hardware hacking with smart home integration. While it required some initial setup, the result is a functional and elegant solution for dimming traditional incandescent lamps. If you’re interested in DIY electronics and smart home automation, I highly recommend giving this a try!

Happy tinkering! :electric_plug: