Arduino - MPDMv4 - Universal AC MAINS Dimmer




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 AC MAINS Power Dimmer MPDMv4 Driver This example code is in the public domain. */
const int vcntPin = 3;      // the pin that the MPDMv4 VCNT pin is attached to
void setup()
  // initialize the serial communication:
  // 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 : ");
    // set the brightness of the LED:
    analogWrite(vcntPin, brightness);


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:

Internet of Things Contest 2016

Participated in the
Internet of Things Contest 2016

Be the First to Share


    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020
    • Maps Challenge

      Maps Challenge

    4 Discussions


    2 years ago

    Thanks for your explanation of postage costs. We have become used to free or minimal cost postage from China of Ebay goods, where they must still make a profit. The Arduino Nano cost £6 including postage. To ask double that for the dimmer board and then the same amount again for postage may help to put things in perspective.


    Reply 2 years ago

    I am really sorry, but 15 USD shipping it's a real cost that can be proved with an Invoice. This is something out of my control.
    China is a special case, their government is covering/sposoring the shipping costs and a lot of other fees as their Wordwide Commerce policy. It's no "free" thing in the World.


    2 years ago

    The postage from the US to Uk for the MPDMv4 board is more than the board costs (Tindie). Or is there a UK source?


    Reply 2 years ago

    Hi Nigel,

    For UK I can send them from inside EU, from Bucharest, Romania. Unfortunatelly, totally out of our control, after 15 Aug the "small packets" option is no more available.

    Inside EU shipping cost is 15USD for priority shipping with tracking number or 28USD Express EMS flat. flat (means that you can order 1-2..10) and price remains the same and no extra taxes, VAT or anything else to be paid by your side!). Combined shipping also welcomed! Same prices.

    For ordering more than 3-4 pcs the shipping cost is even better than before with the previous "small packets" option.

    Happy breadboarding,