Schemele de conectare sunt combinatia celor 2:
iar modulul notat in schema "AC dimmer unit" are schema:
Nota: Detalii de realizare a acestuia gasiti in articolul Variator de tensiune pentru bec folosind un Arduino !!!
Am folosit urmatorul sketch (care nu-i "periat", dar e functional):
/*
AC Light Control
Updated by Robert Twomey <rtwomey@u.washington.edu>
Thanks to http://www.andrewkilpatrick.org/blog/?page_id=445
and http://www.hoelscher-hi.de/hendrik/english/dimmer.htm
adapted sketch by niq_ro from
http://www.tehnic.go.ro
http://www.niqro.3x.ro
http://nicuflorica.blogspot.com
IR Remote Kit Test
Uses YourDuino.com IR Infrared Remote Control Kit 2
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=153
based on code by Ken Shirriff - http://arcfn.com
Get Library at: https://github.com/shirriff/Arduino-IRremote
Bluetooth:
// adapted sketch from http://english.cxem.net/arduino/arduino4.php
*/
#include <LiquidCrystal.h>
// use LiquidCrystal.h library for alphanumerical display 1602
LiquidCrystal lcd(13,12,11,10,9,8);
/* -------------------
| LCD | Arduino |
-------------------
LCD RS pin to digital pin 13 | RS | D13 |
LCD Enable pin to digital pin 12 | E | D12 |
LCD D4 pin to digital pin 11 | D4 | D11 |
LCD D5 pin to digital pin 10 | D5 | D10 |
LCD D6 pin to digital pin 9 | D6 | D9 |
LCD D7 pin to digital pin 8 | D7 | D8 |
LCD R/W pin to ground | R/W | GND |
-------------------
*/
#include "IRremote.h"
//-----( Declare Constants )-----
int receiver = 7; // pin 1 of IR receiver to Arduino digital pin 7
//-----( Declare objects )-----
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results; // create instance of 'decode_results'
//-----( Declare Variables )-----
#include <TimerOne.h> // Avaiable from http://www.arduino.cc/playground/Code/Timer1
volatile int i=0; // Variable to use as a counter
volatile boolean zero_cross=0; // Boolean to store a "switch" to tell us if we have crossed zero
int AC_pin = 3; // Output to Opto Triac
int buton1 = 4; // first button at pin 4
int buton2 = 5; // second button at pin 5
int dim2 = 0; // led control
int dim = 128; // Dimming level (0-128) 0 = on, 128 = 0ff
int pas = 8; // step for count;
// version: 4m7 (15.04.2013 - Craiova, Romania) - 16 steps, 4 button & LED blue to red (off to MAX)
// version: 7m6.1 (23.01.2014 - Craiova, Romania) - 16 steps, 2 button & LCD1602
int freqStep = 75; // This is the delay-per-brightness step in microseconds.
char incomingByte; // incoming data from serial 9bluetooth)
void setup() { // Begin setup
Serial.begin(9600); // initialization
irrecv.enableIRIn(); // Start the IR receiver (classic remote)
pinMode(buton1, INPUT); // set buton1 pin as input
pinMode(buton2, INPUT); // set buton1 pin as input
pinMode(AC_pin, OUTPUT); // Set the Triac pin as output
attachInterrupt(0, zero_cross_detect, RISING); // Attach an Interupt to Pin 2 (interupt 0) for Zero Cross Detection
Timer1.initialize(freqStep); // Initialize TimerOne library for the freq we need
Timer1.attachInterrupt(dim_check, freqStep);
// Use the TimerOne Library to attach an interrupt
lcd.begin(16, 2); // set up the LCD's number of columns and rows:
lcd.clear(); // clear the screen
lcd.setCursor(2, 0); // put cursor at colon 0 and row 0
lcd.print("16 steps AC"); // print a text
lcd.setCursor(0, 1); // put cursor at colon 0 and row 1
lcd.print("dimmer for bulb"); // print a text
delay (3000);
lcd.clear(); // clear the screen
lcd.setCursor(1, 0); // put cursor at colon 0 and row 0
lcd.print("this sketch is"); // print a text
lcd.setCursor(1, 1); // put cursor at colon 0 and row 1
lcd.print("made by niq_ro"); // print a text
delay (3000);
lcd.clear(); // clear the screen
}
void zero_cross_detect() {
zero_cross = true; // set the boolean to true to tell our dimming function that a zero cross has occured
i=0;
digitalWrite(AC_pin, LOW);
}
// Turn on the TRIAC at the appropriate time
void dim_check() {
if(zero_cross == true) {
if(i>=dim) {
digitalWrite(AC_pin, HIGH); // turn on light
i=0; // reset time step counter
zero_cross=false; // reset zero cross detection
}
else {
i++; // increment time step counter
}
}
}
//-----( Declare User-written Functions )-----
void translateIR() // takes action based on IR code received
// describing Car MP3 IR codes
{
switch(results.value)
{
case 0xFFA25D:
Serial.println(" CH- ");
break;
case 0xFF629D:
Serial.println(" CH ");
break;
case 0xFFE21D:
Serial.println(" CH+ ");
break;
case 0xFF22DD:
{
Serial.println(" PREV ");
dim=128;
}
break;
case 0xFF02FD:
{
Serial.println(" NEXT ");
dim=0;
}
break;
case 0xFFC23D:
Serial.println(" PLAY/PAUSE ");
break;
case 0xFFE01F:
{
Serial.println(" VOL- ");
if (dim<127)
{
dim = dim + pas;
if (dim>127)
{
dim=128; // in vechiul sketch era 127
}
}
}
break;
case 0xFFA857:
{
Serial.println(" VOL+ ");
{
if (dim>5)
{
dim = dim - pas;
if (dim<0)
{
dim=0; // in vechiul sketch era 1
}
}
}
}
break;
case 0xFF906F:
Serial.println(" EQ ");
break;
case 0xFF6897:
{
Serial.println(" 0 ");
// analogWrite(ledr, 0);
// analogWrite(leda, 0);
// analogWrite(ledv, 0);
}
break;
case 0xFF9867:
Serial.println(" 100+ ");
break;
case 0xFFB04F:
Serial.println(" 200+ ");
break;
case 0xFF30CF:
{
Serial.println(" 1 ");
// analogWrite(leda, 255);
}
break;
case 0xFF18E7:
{
Serial.println(" 2 ");
// analogWrite(ledv, 255);
}
break;
case 0xFF7A85:
{
Serial.println(" 3 ");
// analogWrite(ledr, 255);
}
break;
case 0xFF10EF:
{
Serial.println(" 4 ");
// analogWrite(leda, 122);
}
break;
case 0xFF38C7:
{
Serial.println(" 5 ");
// analogWrite(ledv, 122);
}
break;
case 0xFF5AA5:
{
Serial.println(" 6 ");
// analogWrite(ledr, 122);
}
break;
case 0xFF42BD:
{
Serial.println(" 7 ");
// analogWrite(leda, 0);
}
break;
case 0xFF4AB5:
{
Serial.println(" 8 ");
// analogWrite(ledv, 0);
}
break;
case 0xFF52AD:
{
Serial.println(" 9 ");
// analogWrite(ledr, 0);
}
break;
default:
Serial.println(" other button ");
}
}
void blustuf()
{
incomingByte = Serial.read(); // read byte
if(incomingByte == '0') {
}
if(incomingByte == '1') {
}
if(incomingByte == '2') {
}
if(incomingByte == '3') {
}
if(incomingByte == '4') {
}
if(incomingByte == '5') {
}
if(incomingByte == '6') {
}
if(incomingByte == '7') {
}
if(incomingByte == 'a') { //step up
if (dim<127)
{
dim = dim + pas;
if (dim>127)
{
dim=128;
}
}
}
if(incomingByte == 's') { //step down
if (dim>5)
{
dim = dim - pas;
if (dim<0)
{
dim=0;
}
}
}
if(incomingByte == 'w') { // power is 100%
dim=0;
}
if(incomingByte == 'z') { // power is 0% (off)
dim=128;
}
}
void stelute()
{
if (dim2<1) lcd.print("----------------");
else
if (dim2<9) lcd.print("*---------------");
else
if (dim2<17) lcd.print("-*--------------");
else
if (dim2<25) lcd.print("--*-------------");
else
if (dim2<33) lcd.print("---*------------");
else
if (dim2<41) lcd.print("----*-----------");
else
if (dim2<49) lcd.print("-----*----------");
else
if (dim2<57) lcd.print("------*---------");
else
if (dim2<65) lcd.print("-------*--------");
else
if (dim2<73) lcd.print("--------*-------");
else
if (dim2<81) lcd.print("---------*------");
else
if (dim2<89) lcd.print("----------*-----");
else
if (dim2<97) lcd.print("-----------*----");
else
if (dim2<105) lcd.print("------------*---");
else
if (dim2<113) lcd.print("-------------*--");
else
if (dim2<121) lcd.print("--------------*-");
else
if (dim2>127) lcd.print("---------------*");
}
void loop() {
digitalWrite(buton1, HIGH);
digitalWrite(buton2, HIGH);
if (Serial.available() > 0) blustuf(); // if bluetooth is present
if (digitalRead(buton1) == LOW)
{
if (dim<127)
{
dim = dim + pas;
if (dim>127)
{
dim=128; // in vechiul sketch era 127
}
}
}
if (digitalRead(buton2) == LOW)
{
if (dim>5)
{
dim = dim - pas;
if (dim<0)
{
dim=0; // in vechiul sketch era 1
}
}
}
while (digitalRead(buton1) == LOW) { }
delay(10); // waiting little bit...
while (digitalRead(buton2) == LOW) { }
delay(10); // waiting little bit...
// remote
if (irrecv.decode(&results)) // have we received an IR signal?
{
translateIR();
irrecv.resume(); // receive the next value
}
delay (100);
lcd.setCursor(2, 0); // put cursor at colon 0 and row 0
lcd.print("power is "); // print a text
lcd.print(100*(128-dim)/128);
lcd.print("% "); // print a text
lcd.setCursor(0, 1); // put cursor at colon 0 and row 1
dim2=128-dim; // variable use for graphics
stelute();
}
Am facut si 2 filmulete (primul in romana si al doilea in engleza):- ac light dimmer with Arduino (XXI)
Ce face D2 in soft ?
RăspundețiȘtergeredaca te uti in articolele anterioare, o sa vezi ca acolo se detecteaza trecerea prin zero a tensiunii retelei s e o linie in schetch asa: attachInterrupt(0, zero_cross_detect, RISING); // Attach an Interupt to Pin 2 (interupt 0) for Zero Cross Detection
ȘtergereSalut!
RăspundețiȘtergereSuper fain blogul tau! Felicitari!
O intrebare: As putea folosi acest variator de tensiune pentru a comanda in trepte o resistenta de 500w la un incubator?
Sunt novice in electronica.
sigur ca se poate, dar pentru incubator nu e mai bun un termostat?
ȘtergereBineinteles. Dar ma gandeam, ca daca diferenta de temperatura este mica, sa nu pornesc rezistenta la capacitate maxima. Sa am 2 sau 3 praguri privind puterea de incalzire.
Ștergerei wanna two dimmer control through ir remote pl help me as soon as possible .my problem is i control two dimmer easily but only one remote button but i want press one button then one dimmer is on and then press two button second dimmer is on.but in my case when press one button the two dimmer is on .pl help me as soon as possible.
RăspundețiȘtergerevreau să doi de control dimmer prin pl distanță IR ajută-mă cât mai curând posibil problema .Ma este i controleze două dimmer buton ușor , dar numai o telecomandă , dar vreau apăsați un buton atunci Dimmer este pornit și apoi apăsați butonul de două doilea Dimmer este pornit. dar in cazul meu , atunci când apăsați un butondouă Dimmer este pe .pl mă ajute cât mai curând possible.pl -mi dea un cod de probă .
RăspundețiȘtergereyou want to control 2 lights? just on and off for each? please tell me eaxactly type of control..
RăspundețiȘtergerei want two light dimmer but different remote button.
RăspundețiȘtergereHi, this circuit don't work in case connected to ceiling fan where only one wire is coming into the switch board and another wire from fan goes directly to common connection. This circuit only works if you connect two wires of load directly to the circuit otherwise don't. At my home I have only one wire per load coming to switch board and other wire is connected to common. I tried dozons of solution and tried altering the wires with different different combinations, nothing work. Finally I pulled one more wire from ceiling fan to switch board and then connected these two wires to this circuit to work circuit properly. Can you help me?
RăspundețiȘtergereHi, i need to design me your schematic... send on my mail: nicu.florica@gmail.com
ȘtergereI must understund your connexion for help you...
is an old article for me :D I think is for increase and decrease the light .. try...
RăspundețiȘtergerewhen the dim signal is 128 the bulb turns on at very little brightness, voltage across the load is 20V. it is not completely off.Can you help.. please
Ștergereat you what frecquency in on main supply? 50Hz or 60Hz...
Ștergerein sketch must have freqStep=75; for 50Hz and freqStep=65; for 60Hz
for more details see https://arduinodiy.wordpress.com/2012/10/19/dimmer-arduino/
Buna ziua
RăspundețiȘtergereDe curand am cumparat o placa arduino uno si vreau sa invat cum se lucreaza cu ea.La acest proiect doresc ca in locul intrerupatoarelor de crestere si scadere a intensitatii luminoase sa o faceti prin variatia de tensiune.Spre exemplu sa inceapa deschiderea la btensiunea de 26,5v si la 28v sa fie complet deschis,iar cand tensiunea scade sub 26v sa nu lucreze triacul.
nu inteleg de unde acele praguri de tensiune.. nu inteleg aplicatia..
ȘtergereSa fiu mai explicit,este vorba de un regulator de tensiune cu boost.Un semnal pwm il folosim cand tensiunea ajunge la 27v si trebuie sa comande mosfetii pentru shunt,iar un semnal pwm sa fie generat din arduino in functie de tensiunea de intrare,daca este 10v trebuie cu ajutorul bostului sa o dublam 20v dar cand tensiune este de 25v boostul trebuie sa se opreasca(fara semnal pwm).Bineintele sa fie afisate tensiunea ,curentul,puterea si nivelul in procente a bateriei(cat % este incarcata)
RăspundețiȘtergereCeva de genul asta dar sa folosim arduino https://www.youtube.com/watch?v=TLuQ09rdeew
RăspundețiȘtergerenu inteleg ce legatura are cu variatorul de tensiune comandat de Arduino...
RăspundețiȘtergeredin descriere pare un regulator de tensiune pentru incarcare baterii de 24V...
Asa este,doresc sa stiu daca pot folosi Arduino pentru monitorizarea unei eoliene ,indicand tensiunea de incarcare curentul puterea si in acelasi timp daca se poate folosi si pe post de regulator.
RăspundețiȘtergereTot ma uit pe blogul dumneavoastra poate faceti un scheci pentru un inverter sine wave spwm 50Hz ceva de genul asta http://microcontrollerslab.com/complete-circuit-diagram-pure-sine-wave-inverter/
RăspundețiȘtergereVad ca sunt mai multe persoane entuziasmate de schemele astea, dar de curiositate: a incercat cineva sa le si construiasca, sau toata lumea e la vanatoare de idei???!!!
RăspundețiȘtergereDaca toata lumea ramane doar la teorie, fara testare, nu mai avansam.... Unii muncesc si altii isi dau cu parerea!
Pentru ca tocmai a confirmat autorul ca schema originala este cu MOC3020, cu 3040 sau 3041 nu functioneaza!!!!!
ti-am scris pe mail ca eu am acum pe modul MOC3020... posibil sa fi ramas o eroare de editare.. dar nu e frumos ce faci... o sa verific cand am timp.. nu fac cand vreti voi... punct...
ȘtergereHi,
RăspundețiȘtergereI want to dim the light using RF transmitter and receiver. For this I am using 433Mhz receiver and transmitter pair. What modifications are needed in the code to successfully dim the light using RF?
for TX must put another Arduino board if you want to use RX-TX simple.. easy is to use remote kit.. just put relay contacts to pushbutton ;)
ȘtergereThanks.
ȘtergereI am using 2 arduino boards, trying to send 1, 2, 3, 4 as message from the transmitter circuit. I am using 4 push buttons.
Made some modifications in the receiver code. It is receiving the codes as shown in the serial monitor but dimming is not happening. Please check if I've made the inputs properly.
Thanks.
I am using 2 arduino boards, trying to send 1, 2, 3, 4 as message from the transmitter circuit. I am using 4 push buttons.
How do I change this part:
void translateIR() // takes action based on IR code received
// describing Car MP3 IR codes
{
switch(results.value)
{
case 0xFFA25D:
Serial.println(" CH- ");
break;
to work with RF?
I have modified like this
Void RF ()
{ uint8_t message [VW_MAX_MESSAGE_LEN];
uint8_t messagelength = VW_MAX_MESSAGE_LEN;
if (vw_get_message (message, &messagelength))
{ int j;
Serial.print("Received: ");
for (j = 0; j < messagelength; j++) {
Serial.print(message[j]);
switch(message[j])
{
case 49:
{
Serial.println(" PREV ");
dim=128;
}
break;
case 50:
{
Serial.println(" NEXT ");
dim=0;
}
break;
case 51:
{
Serial.println(" VOL- ");
if (dim<127)
{
dim = dim + pas;
if (dim>127)
{
dim=128; // in vechiul sketch era 127
}
}
}
break;
case 52:
{
Serial.println(" VOL+ ");
{
if (dim>5)
{
dim = dim - pas;
if (dim<0)
{
dim=0; // in vechiul sketch era 1
}
}
}
}
break;
}
}
}
}
On the other hand in the Void loop () you have included the trnaslate rf()
How do I add the RF part in the loop?
This one needs modification too for RF right?
if (irrecv.decode(&results)) // have we received an IR signal?
{
translateIR();
irrecv.resume(); // receive the next value
}
And I also want to dim the light to 8 steps. Here we have 16 steps. If I have to modify it to 8 levels (4 steps for increasing the brightness and 4 steps for decreasing), where the levels will stop by at 80%, 50% and 30% of the rated voltage (220V ac, 50Hz) what should be done?
RăspundețiȘtergereoriginal is
Ștergereint pas = 8; // step for count;
must change to
int pas = 16; // step for count;
I changed it to 16. It works with buttons and IR. Having difficulties with RF.
ȘtergereI haven't time now, but look at http://electronics-diy.com/arduino-rf-link-using-433mhz-transmitter-receiver-modules.php
ȘtergereHi,
ȘtergereUsing the relay modules is not an option because I am concerned about the size of the circuit and cost effectiveness. I just want to know how to control Triac firing using RF. I have got a transmitter and receiver pair and want to incorporate it in the circuit posted by you. Your help will be really appreciated. Please give me some hint, how do I control the Triac firing resulting in Dimming Ac light using RF transmitter and receiver?
read this: http://electronics-diy.com/arduino-rf-link-using-433mhz-transmitter-receiver-modules.php
ȘtergereSalut.
RăspundețiȘtergereDaca schimb
int pas = 8; // step for count
cu
int pas = 4; // step for count
o sa am 32 de trepti?
da, acolo se umbla, maxim de pasi e 128 deci la pas se jongleaza
ȘtergereMultumesc de ajutor.
Ștergere