Introduction: Arduino - MPDMv4 - Universal AC MAINS Dimmer

----------------------------- DISCLAIMER -----------------------------

WARNING!! You will play with LIVE MAINS!! Deadly zone!!

If you don't have any experience and are not qualified for working with MAINS power I will not encourage you to play arround!. The author take no responsibility for any injury or death resulting, directly or indirectly, from your inability to appreciate the hazards of household mains voltages.

The circuit diagrams are as accurately as possible, but are offered with no guarantees whatsoever.

There is no guarantee that this design meets any Rules which may be in force in your country so please check before your local rules/regulations.

----------------------------------------------------------------------------------

As anybody else with and interest about AC Dimmers, I was also looking for the easiest and safest way to interface my Arduino MCU with a AC MAINS Lightbulb and to be able to do smooth, flicker-free Dimming control for my lights.

After more that a year of experimenting with AC Dimming , I think I can come with a conclusion: the new MPDMv4 Universal AC MAINS Dimmer Module.

I don't know if is out there a easier to use AC Dimmer module, but this one definitelly is very easy to use and control. It is a voltage controlled unit and it contains onboard all the necessary functions (Phase detection, Zero Crossing detection, Sync, etc) to make your AC Light Dimming experience way simpler than before, in both ways, software programming and also wiring.

Step 1: What Do You Need

Step 2: Setup & Wiring

As you can see in the picture above, wiring is very simple:

  • Connect MAINS line wires to the corresponding AC MAINS input connector:
    • LIVE (BROWN)
    • Neutral (BLUE))
  • Connect the Lightbulb to the AC MAINS Output connector
  • Connect your Arduino Board to the Control connector:
    • VCNT - Control pin -> Arduino PWM output pin (YELLOW wire)
    • VCC - 3.3V (or 5V, depending on your Arduino Type you use) (RED wire)
    • GND - Ground connection from your Arduino Board (BROWN & ORANGE wire)

Step 3: Software

As you can see in the code example below, because all the MCU and Interrupts intensive fancy stuff (Phase detection, Zerocrossing Detection, Sync, etc) are all done at the MPDMv4 Universal AC Dimmer Board level, the Arduino software side is deadly simple and without any kind of overhead added by the Dimming processing functions:

/*
Dimmer This simple Sketch demonstrates the sending data from the computer to the Arduino board, in this case to control the brightness of MPDMv4 AC MAINS Dimmer. The data is sent in individual bytes, each of which ranges from 0 to 255. Arduino reads these bytes and uses them to set the VCNT brightness command . The circuit: MPDMv4 Board attached from digital pin 3 to ground. Serial connection to Processing, Max/MSP, or another serial application created 2006 by David A. Mellis modified 30 Aug 2011 by Tom Igoe and Scott Fitzgerald modified 14 Apr 2016 by TJ for esp8266-projects.com AC MAINS Power Dimmer MPDMv4 Driver This example code is in the public domain. http://www.arduino.cc/en/Tutorial/Dimmer */
const int vcntPin = 3;      // the pin that the MPDMv4 VCNT pin is attached to
void setup()
{
  // initialize the serial communication:
  Serial.begin(9600);
  // initialize the VCNTPin as an output:
  pinMode(vcntPin, OUTPUT);
  // set default brightness value
  analogWrite(vcntPin, 230);
}
void loop() {
  byte brightness;

  // check if data has been sent from the computer:
  if (Serial.available()) {
    // read the most recent byte (which will be from 0 to 255):
    brightness = Serial.parseInt();
    Serial.print("Command received : ");
    Serial.println(brightness);    
    // set the brightness of the LED:
    analogWrite(vcntPin, brightness);
  }
}

Step 4: CONCLUSION

I have only one conclusion: Probably the simplest and easiest to use AC MAINS Dimmer Board available. I am looking forward for your feedback about :)



For more details you can see the related AC MAINS Dimming Articles/ Videos:





The MPDMv4 Board is available also on Tindie: https://www.tindie.com/products/nEXT_EVO1/universal-ac-mains-dimmer-mpdmv41/

Internet of Things Contest 2016

Participated in the
Internet of Things Contest 2016