--------------------------------------------------- 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.
----------------------------------------------------------------------------------------------------------------------------
For any new orders/requests please feel free to use as usual: tech (at) esp8266-projects.com.
MPDMv4 Boards are also available on Tindie: AC MAINS Dimmer - MPDMv4
For today we have a short but comprehesive Tutorial on how to drive the MPDMv4 AC MAINS Dimmer board using the Arduino IDE:
Arduino IDE code example for the Youtube Video Tutorial:
/*
Dimmer
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);
}
}
MPDMv4 by ESP8266-Projects.com is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
1 comment:
I went a step further and made the adoption of this totally simplistic using espbasic. Excellent product by the way!
Visit http://www.esp8266.com/viewtopic.php?f=41&t=10958
for more information
Post a Comment