Pages: [1] 2   Go Down
Author Topic: Dimming AC lights  (Read 8364 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Arduinos,
I'd like to use the arduino with sensors to dim AC lights. I've never interfaced a microcontroller to dim AC and would like to know some tips and tricks and bypass the traps that you might have encountered while doing so.
Thanks!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can recommend buying a  velleman K8064 dimmer kit as suggested by Massimo:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1150063488

it was really quick to get everything up & running...
Logged

Berlin
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As someone who's gone the light&arduino path.. it only really ended when i bought dmx equipment..
which by itself is a fragile protocol, but as least it dims lamps easily..

I've also built the arduinoDmx (http://www.arduino.cc/playground/Learning/DMX)
it worked but i had a lot of sync problems with my dmx lamp - although to really debug these problems you
must have a dmx testing device, or at least some more dmx equipment to try on.

Ciao, oori
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Oori,
For this project, I wanted to control normal house lamps and not rely on DMX equipment.
I've gone the DMX way and had my share of DMX problems, btw search for my posts on DMX for a more precise code for Arduino DMX if your DMX lamps are picky.

also Thanks Tomski for the velleman kit reference.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 203
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

X10 with a "firecracker" controller? That should be easy to drive from an Arduino. You can get the firecracker, transceiver, hand held remote, and a dimmer for $20. Looks like extra dimmers go for about $10 each. Those are 110v 60hz units, I presume there are variants for folk with more deadly mains.

It looks like the firecracker works by using RTS and DTR as both power and signaling. I don't know if you'd have to drive them with more than 5v. http://www.rentron.com/FireCracker.htm As if I didn't have enough to do.. it looks interesting.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

This might be a useful link for people trying to dim AC lights through a Velleman K8064 kit and an arduino:

http://www.brakmolotov.net/blog/Meriol_Lehmanns_blog/Entries/2009/2/23_How_to_control_an_AC_dimmer_with_an_Arduino.html

It includes sample code and circuit diagram, and it works.

Jaap
« Last Edit: April 09, 2009, 08:46:49 am by jeep1984 » Logged

Denver
Offline Offline
God Member
*****
Karma: 20
Posts: 779
Inactive - PM
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@jims
I've already interfaced to the firecracker -
http://www.arduino.cc/playground/X10/CM17A
Logged

"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I used an Arduino and a Velleman K8064 to make my own WakeUpLight.

The electric circuit scheme of brakmolotov.net posted by jeep1984 above was very helpful, thanks!

Everything works fine, I've placed a .

Code:
// Define pins

int pwmPin    = 9;    // select the output pin for the dimmer
int analogPin = 1;    // select the input pin for the alarmclock
int ledPin    = 13;   // select the pin for the LED

// Program variables

int pwmVal    = 0;     // Variable to store the value to send to the pin
int analogVal = 0;     // Variable to store the value read from the analog pin
int fadeCount = 0;     // Loop counter
int stopCount = 0;
int wait      = 250;   // 250ms delay; shorten for faster fades

void setup()
{
  pinMode(ledPin, OUTPUT);   // declare the ledPin as an OUTPUT
  pinMode(pwmPin, OUTPUT);   // sets the pins as output
  analogWrite(pwmPin,   pwmVal);   // Write current values to pwm pin
}


// Main program
void loop()
{
  analogVal = analogRead(analogPin);   // read the value from the sensor
  if (analogVal==0)                    // if no alarm beep is received
  {
    stopCount += 1;
  }
  else                           // if alarm beep is received
  {
    fadeCount += 1;
    stopCount = 0;
  }
  
  if (fadeCount==20 && pwmVal!=255)
  {
    fadeCount=0;
    pwmVal += 1;
    analogWrite(pwmPin,   pwmVal);   // Write current values to pwm pin
    digitalWrite(ledPin, HIGH);   // turn the ledPin on
  }
  else
  {
    digitalWrite(ledPin, LOW);   // turn the ledPin off
  }
  
  if (stopCount==60)
  {
    stopCount=0;
    fadeCount=0;
    pwmVal = 0;
    analogWrite(pwmPin,   pwmVal);   // Write current values to pwm pin
  }
  
    delay(wait); // Pause for 'wait' milliseconds before resuming the loop

}

Tim
« Last Edit: May 11, 2009, 09:43:05 am by t.m.assman » Logged

berlin
Offline Offline
Full Member
***
Karma: 0
Posts: 154
fubbi.com
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have built the circuit exactly like in brakmolotov's example.

I can see the value going up and down between 0v and 5v nicely on pin 9 when I run his code.

But I am not getting past the transistor. When I measure at the output to the velleman I see a constant 6v

Any clues as to why this might be? Have I got something the wrong way around?

Thanks

here's the schematic

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I noticed the schematic has a GND connection going to the Velleman. This is wrong it should go to the analogue input line on SK3. These are not the same as gnd on the Velleman
Logged

berlin
Offline Offline
Full Member
***
Karma: 0
Posts: 154
fubbi.com
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SK3?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
SK3?

That's what it says on the data sheet.
Logged

berlin
Offline Offline
Full Member
***
Karma: 0
Posts: 154
fubbi.com
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Mike

I get what you mean, but not what it means...

The SK3 has "+" and "-" connectors, "-" is not ground?

thanks

fubbi
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The SK3 has "+" and "-" connectors, "-" is not ground?

No it is the other side of an opto isolator. So it needs to be connected to this and not ground as shown in the diagram. In fact the 1M and capacitor are rubbish. But it will work if you connect what is marked gnd to the SK3 - and the 5V to the SK3 +

« Last Edit: June 25, 2009, 11:06:41 am by Grumpy_Mike » Logged

berlin
Offline Offline
Full Member
***
Karma: 0
Posts: 154
fubbi.com
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

most excellent sir

thank you

fubbi
Logged

Pages: [1] 2   Go Up
Jump to: