Universal AC MAINS Dimmer Board - MPDMv4

If you need for your projects a AC MAINS Dimmer Board that can be used without any hassle and any extra overhead from the Phase Control and Zero Crossing Detection functions on your Arduino/ESP/STM/etc MCU then this is the board that you are looking for:

The MPDMv4, is a new generation of AC MAINS Dimmer drivers that have some unique characteristics as:

  • all the required functions onboard :

  • Phase control

  • Zero Crossing detection

  • Isolated MAINS

  • Voltage controlled unit, so you can drive it with you MCU, PWM, DAC, even a simple voltage divider with a 10k potentiometer on the VCNT input pin is enough to drive it!

  • build with safety in mind

-deadly simple to use. See code below:

/*
 Fading
 
 This example shows how to fade a standard 100W 240VAC lightbulb using the MPDMv4 Driver 
 and the analogWrite() function.

 The circuit:
 VCNT attached from digital pin 3 to ground. 
 On the putput pin use also a 100-200u electrolitic cap for PWM smoothing.
 
 Created 1 Nov 2008
 By David A. Mellis
 modified 30 Aug 2011
 By Tom Igoe
 modified 14 Apr 2016
 by TJ for the MPDMv4 - AC MAINS Power Dimmer Driver
 more details at:  
 http://www.esp8266-projects.com/2016/04/mpdmv4-mains-dimmerswitch.html
 
 This example code is in the public domain.
 http://arduino.cc/en/Tutorial/Fading
 
 This example code is in the public domain.
 
 */


int VCNT = 3;    // MPDMv4 Voltage Control Pin (VCNT) connected to Arduino PIN3

void setup()  { 
  // initialize the VCNT pin as an output:
  pinMode(VCNT, OUTPUT);  
} 

void loop()  { 
  // fade in from min to max in increments of 5 points:
  for(int fadeValue = 0 ; fadeValue <= 190; fadeValue +=5) { 
    // sets the value (range from 0 to 190): MPDMv4 Calibrated range
    analogWrite(VCNT, fadeValue);         
    // wait for 100 milliseconds to see the dimming effect    
    delay(100);                            
  } 

  // fade out from max to min in increments of 5 points:
  for(int fadeValue = 190 ; fadeValue >= 0; fadeValue -=5) { 
    // sets the value (range from 0 to 190): MPDMv4 Calibrated range
    analogWrite(VCNT, fadeValue);         
    // wait for 100 milliseconds to see the dimming effect    
    delay(100);                            
  } 
}

Using a Serial Input for the Dim Value:

/*
 AC MAINS Dimmer - MPDMv4 
 
 Demonstrates the sending data from the computer to the Arduino board,
 in this case to control the brightness of a standard 100W 240VAC lightbulb using the MPDMv4 Driver
 and the analogWrite() function.
 
 It's using the Serial parseInt() function for interactive Serial Data Input.
 
 The circuit:
 VCNT attached from digital pin 3 to ground. 
 On the output pin connect also a 100-200u electrolitic cap for PWM singnal smoothing.
 
 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 the MPDMv4 - AC MAINS Power Dimmer Driver
 more details at:  
 http://www.esp8266-projects.com/2016/04/mpdmv4-mains-dimmerswitch.html
 
 
 This example code is in the public domain.
 http://www.arduino.cc/en/Tutorial/Dimmer
 
 */

int VCNT = 3;    // MPDMv4 Voltage Control Pin (VCNT) connected to Arduino PIN3


void setup()
{
  // initialize the serial communication:
  Serial.begin(9600);
  // initialize the VCNT pin as an output:
  pinMode(VCNT, OUTPUT);
}

void loop() {
  byte brightness;

  // check if data has been sent from the computer:
  if (Serial.available()) {
    // read the most recent byte -> range from 0 to 190 : MPDMv4 Calibrated range
    brightness = Serial.parseInt();
    Serial.print("Command received : ");
    Serial.println(brightness);    
    // set the brightness -> range from 0 to 190 : MPDMv4 Calibrated range

    analogWrite(VCNT, brightness);
  }
}

Arduino Examples are available also on GitHub:
MPDMv4 GitHub Repository

Below is a short example of how easy is to build a WIFI Dimmer unit with a ESP8266 Module and a Universal AC MAINS Dimmer Driver like the MPDMv4:

And the realated articles, explaining in more details about:

--------------------------------------------------- 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.

Creative Commons License

MPDMv4 by ESP8266-Projects.com is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.