# Arduino Dimmer Shield Schematics Interpretation

I've read so much about Thyristors, Triacs and Rectifiers on the last days that I'm almost understanding my schematic, but I'm not there yet - I need some help.

Overview: I'm making a home automation project, with Android and Arduino. To make that happen I'm using this Dimmer shield. Everything is working fine, i.e., I'm being able to variate the intensity of the lamp of my room from a SeekBar on my cell.

Problem: I want to understand how the dimmer shield works by reading and interpreting its schematics, which you can see here.
Somewhat larger version here

Original here:

Dimmer Shield basic functionality: If you checked the photo of the dimmer shield on the link above you saw that there are four terminal block. Two are called "Vac" and two are called "LOAD". On the "Vac" terminals we simply connect the power source (127V - alternate current), and on the "LOAD" terminals we connect the load, i.e., the lamp. Once the four cables pluged and the dimmer Shield is connected to the Arduino, everything works well.

How far I'm in interpreting the schematics: Ok, I'll try to be clear here. My fundamental problem/question is to understand how charge/electricity flows on the shield.

My first question was: Where are the power source cables connected? And the LOAD cables? After a lot of thinking, I assumed that:

a) The power source is connected to the terminals MKDSN1,5/2-5,08 X1-1 and MKDSN1,5/2-5,08 X1-2;

b) The load (lamp) is connected to the terminals MKDSN1,5/2-5,08 X2-1 and MKDSN1,5/2-5,08 X2-2

This first assumption is correct?

If it is correct, that's how I'm thinking to undertand the charge flow (please correct me and/or advises a better way to do it If you know): let's assume for a moment, as this will change as the frequency, that the voltage is negative on MKDSN1,5/2-5,08 X1-1 and positive at MKDSN1,5/2-5,08 X1-2. Then, eletric charge would start to flow from MKDSN1,5/2-5,08 X1-2.

On the first note (right above the rectifier on the schematics), the charge would divide to the rectifier and to the next node (below the 1K resistor). Seeking the rectifier part, there is only one way where the charge can go - it will pass the two 100K resistors, then the 4N25M Semiconductor Transistor Output Optocouplers, enter again on the back of the rectifier, and there it is another node, and a big question: If the charge can go directly to the ground (resistance zero), why It will pass through the lamp (which I assume offers a minimum resistance)?

I'll stop here. I'm happy I've done some improvement on the last days but I will really be thankfull If someone can explain this to me.

Thanks,

If there is any help, here It is the Arduino Sketch:

int AC_LOAD = 3;
int dimming = 125;
char incomingByte;
int lastValidNumber = 10;
boolean notUsed = false;

void setup(){

Serial.begin(9600);
Serial1.begin(9600);
attachInterrupt(0, zero_crosss_int, RISING);

}

void zero_crosss_int(){

int dimtime = (65*dimming); // 65 equivale a 1 de 128
delayMicroseconds(dimtime); // Off cycle
digitalWrite(AC_LOAD, HIGH); // disparando o Triac
delayMicroseconds(8.33); // Aguarda o tempo de disparo
digitalWrite(AC_LOAD, LOW); // finaliza o pulso do Triac

}

void loop(){

while(Serial1.available() > 0){

if(Serial1.available() == 0){

}

}

} else{
}

dimming = (int) (((-115 * numberReceivedInIntFormat) + 12275)/89);

Serial.println(dimming);

if (notUsed){
delay(30);
}

}

• Wrong site. This belongs on EESE. – Chris Stratton Feb 23 '15 at 7:25
• @OlinLathrop - In this context I consider the use of the terms Shield & Sketch at best unfortunate and the use of "Maker" utterly inane. However, you do yourself no favours personally in carrying on a crusade against the image while failing to discern the real world engineering and real people needing and asking for help which underly the superficial surface ephemera. Here you have somebody who otherwise may NEVER have become involved in electronics making an honest and reasonable attempt to understand a processor driven TRIAC dimmer. The actual problem is caused by pathetic labelling by ... – Russell McMahon Feb 24 '15 at 3:54
• @Olin ... the manufacturers and the product is dangerous and poorly done BUT others have pointed out well implemented versions of the same. In the course of trying to understand a somewhat strange implementation the OP is coming to grips with the real world electronics much more intimately than he would have if it had been straight forward. The experience may well be what it takes to propel him across the notional gap between but-&-use and actual electronic understanding - as long as people do not drive him, and others like him, away in the process of trying to actually learn and understand. – Russell McMahon Feb 24 '15 at 3:58
• @Olin .... All but the last few are available on standard Arduinos once people break through the rather thin crust that 1st lures them in. Generated code review is a free add on. And assembler access is available once people become aware of the need and the power. | And an ATMega328 based reasonable quality fully built and tested (it seems :-) ) PCBA with USB/serial bridge IC, voltage regulator, restart button, 1 x "I'm alive" LED, headers, and installed boot loader and "hello world" (flash LED) test program loaded costs $US3 each in 10's (free postage). This system is a trojan horse tool .... – Russell McMahon Feb 24 '15 at 4:10 • @Olin .... to lure the unwary into what appears to be a copy and stick together system and behind which lurks the full capabilities of a capable microcontroller. COMPLETE development system$US5 ($3 + cable + a Coke). Add PC and go. | Hating a system which has the capability to lure vast numbers of young people away from their TVsiPhonestextingFacebookmindlessmodernwhatever into the real world is a big mistake. Embrace it. Use it. By all means scorn the maker_shield_sketch_... terminology if you must - but look (far) beyond it. – Russell McMahon Feb 24 '15 at 4:14 ## 2 Answers Edited: This is a good example of a question that superficially APPEARS to be Arduino related, but all the material dealt with is 100% EE related. If people are so utterly hateful of all things Arduino (as some truly are) then it behooves them to leave the question alone for others to deal with appropriately. The question has now made the EE -> Arduino -> EE journey pointlessly to nobody's benefit. The interface to this circuit are via optocouplers OK1 & OK2. It is a pure electronics hardware question. What drives OK1 and OK2 is completely utterly and wholly unrelated to the core question. The circuit is designed "strangely" and has a connection shown which may not exist in reality and which is lethally dangerous if actually present. ## DANGER: The wire boxed in orange connects AC side to Arduino side. IF X1-2 is grounded or Neutral nobody and nothing may die. But they may. If X1-2 is Phase or live then Arduino and people may well die. This connection must not be present and may not be in practice. A key confusion in your assumptions is that load current pases through the rectifier bridge. It doesn't. If you take out the bridge and R3 // R3 the TRIAC will be unaffected. The OK2 cct relates to zero crossing detection and is unrelated top TRIAC function. The load appears to be intended to be connected between X2-1 and X2-2, as you say. This places it between the gate side of the TRIAC and one mains leg (usually neutral) which is unusual and risks confusing people who are used to normal arrangements so may be dangerous, but should work OK. When OK1 is turned on by PORTA-3 the gate (connected to OK1-4) is driven on via R5. T1 conducts and a mains to load path occurs via X1-1 - X2-2 - through the load - X2-1 - through T1 - X1-2 Mains is always across rectifier 1KAB to full wave rectified mains drives OK2 via R3//R13 U$1 is a schottky diode in reverse connection across opto LED to stop it having (fatal) reverse voltage applied.

ack.imgur.com/xxR3Z.jpg

• between the gate side of the TRIAC and one mains leg (usually neutral) which is unusual and risks confusing people who are used to normal arrangements What normal arrangement are you aiming at, TRIAC gate at the other side and OK1 "pulling up"? – jippie Feb 23 '15 at 7:53
• @jippie Electrically it's OK - you can "slide the load around the circuit - but what people tend to expect is a TRIAC with gate at about ground potential and load between phase and TRIAC. While you MUST NEVER assume that the gate is safe to touch it often almost is, but this arrangment puts it at about V phase. It will only kill careless people, but we car about them too :-). – Russell McMahon Feb 23 '15 at 16:20
• Found a way to upvote twice for the same answer, once at arduino.SE and once at EE.SE ;o) You can safely remove the first paragraph of your answer now. Agreed with the architecure, disagree with the often almost part. In many countries, like NL, the power plug can be easily swapped around and wall sockets are not standardized when it comes to the position of phase and neutral. – jippie Feb 23 '15 at 18:36

The schematic below is for a similar product, but may be drawn more understandably. In this diagram, you can see that the full-wave bridge delivers a pulsating DC signal to the 4N25 optical isolator, to produce a zero-crossing output signal. The bridge (DF1504S in diagram below) is labeled RECTIFIER-1KAB in the Dimmer_Shield.pdf diagram of OP. The 4N25 is top center in diagram below, and is labeled OK2 in Dimmer_Shield.pdf. The optotransistor in the 4N25 will be turned on most of the time, pulling the zero-cross signal output low. As the rectified signal briefly falls to zero twice per 60Hz cycle, the optotransistor turns off and the 10K pull-up resistor raises the zero-crossing signal.

The MOC3021 optical isolator turns on its output (a "light activated silicon bilateral switch, which functions like a triac" according to the MOC3021 datasheet) whenever its input is driven enough. In turn triac Q1 turns on allowing current to flow through it to the load.

From: ac_dimmer_schematic_v.2.PDF at inmojo.com

• +1 Interesting that they too put the TRIAC in the high side . – Russell McMahon Feb 23 '15 at 16:52
• @RussellMcMahon interesting how similar both circuits are. – jippie Feb 23 '15 at 18:44
• @jippie The thought occurred to me. Similar function products from China are often quite close copies. That's not necessarily bad per se - just happenstance. And the Inmojo design at least is Open source. Other people also copy, of course, but it's not always as visible. The layouts are different and the Inmojo one appears to have taken mains isolation seriously - and the other hasn't. – Russell McMahon Feb 24 '15 at 1:47