Prop-controlled light dimmer
Spork Frog
Posts: 212
Recently, I've been working on a project involving the Propeller microcontroller. My goal is to be able to eventually make a computer-controlled music-synchronized light controller, similar to Light-O-Rama boards, but hopefully with a lower cost.
Here I have my interface circuit. It's basically just a triac and opto-isolator, with a few resistors and caps in there as well. I can currently toggle the light on or off, and I'm working on a PWM routine so that I can control the brightness of the light.
Post Edited (Spork Frog) : 12/3/2007 10:01:02 PM GMT
Here I have my interface circuit. It's basically just a triac and opto-isolator, with a few resistors and caps in there as well. I can currently toggle the light on or off, and I'm working on a PWM routine so that I can control the brightness of the light.
Post Edited (Spork Frog) : 12/3/2007 10:01:02 PM GMT
Comments
With AC, you switch on the triac sometime after each zero-crossing. The triac turns off automatically on the next zero-crossing. The amount of time the triac is on for each half cycle of the AC roughly determines the light intensity. Actually, you have to figure in the height of the AC waveform at the time which is approximated by a sine function and the power delivered to the load is a function of the square of that. For incandescent lamps, the resistance varies with the filament temperature (brightness and color) which complicates things even further if you want to specify the brightness rather than the voltage or power to the load.
Ok, this will be more complex than I anticipated.
For test purposes, you could just fill your table with times linearly chosen with 100% = no delay and 0% = just a little less than 1/120 sec delay (to allow for "slop").
Are you sure you even have the basic knowledge necessary to be doing this safely ?
In your diagram for triac control you have the load wired between "Hot" and "Ground".
Sorry, I couldn't resist after the forums recent "heated" discussion on the subject of magic smoke
@Mike Green: ok, that's not so bad. But I have seen other circuits, namely circuits for light dimmers, which control the triac by simply changing the frequency of an oscillator... I'm looking into it to see what I can do.
Post Edited (Spork Frog) : 8/13/2007 9:02:05 PM GMT
Also add a suitably rated fuse at the very minimum, preferably use a proper RCD or some form of current leakage breaker.
Your triac driver breadboard also leaves a lot to be desired, in terms of mains and control signal separation and insulation in general - I'm not talking about the opto-isolator, but the apparent lack of insulation on the copper track side, mains wires which can break off, touch something else, damage/destroy you or the Propeller.
There's no neon or other indicator to let you know mains is on even if the lamp isn't ( quite a likely scenario while trying to get your dimmer working ), and picking the board up while mains powered is an accident waiting to happen.
I would strongly recommend getting that side of things sorted out properly and into an insulated / earthed box as soon as possible.
Once you've got a safe environment in which to work, there's plenty of fun to be had with digital controlled light dimming. Let's just do it safely, on a project you live to see the end of
And I did shock myself yesterday when working with this by accidentally putting my finger underneath the board... but good suggestions for all things. I'll look into finding a suitable box for this thing.
@Mike Green: Ok, the FC-4 is basically what I'm trying to do right now except already completed. Interesting little board. Thanks for the pointer.
Post Edited (Spork Frog) : 8/14/2007 12:44:01 PM GMT
BTW if you are interested in DIY dimming you may want to check out two other forums. There are several people who have created dimmers on these forums and they are more than willing to help. I'm a member of the first one listed below and I'm spearheading the prop based dimmer project.
http://www.christmasinshirley.com/forum/
http://computerchristmas.com/
Post Edited (DynamoBen) : 12/1/2007 5:07:46 PM GMT
Just a thought... Why not use some standard home light dimmers with knobs on them. Perhaps the knob is connected to a simple potentiometer. Replace (or switch-out) the potentiometer with a digital pot. Have a look at this digital pot product selector page at
www.maxim-ic.com/products/digi_pot/.
Advantages of a modified commercial dimmer may be that (at least in the U.S. and/or EU) it is vetted for safety compliance and spurious noise (at-least in its unmodified form). Also, the code may be simpler if the digital pot is relatively easy to talk to. Some of these digital pots seem to have programmable volatile or EEPROM memory, addressability, multiple pots per package, lin or log, 2 or 3-wire serial interface (SPI, I2C or parallel). If you need to connect the dimmers far from the propeller, a serial interface can go a decent distance as well.
Some disadvantages with this approach may be cost (reduced by reverse engineering the dimmer?), size, additional hardware complexity (the digital pot). Of-course opening and modifying a commercial dimmers voids warranties and certainly opens you up to liability as well. These digital pot parts may be expensive in small quantity, $5 USD up each. They seem hard to find too, especially in DIP packages (although DIPs are listed for some parts). You might want to keep on eye on pot tolerance over temperature range with these devices too.
Example: Maxim/Dallas DS1803E-010, Digikey P/N DS1803E-010+-ND (no DIP stock avail.), unit stock 14-TSSOP available at $6.86 USD ea., Maxim 1K price approx. $2.10 USD ea.
search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=DS1803E-010%2B-ND
DS1803 Description:
The DS1803 addressable dual digital potentiometer features two independently controlled 256-position potentiometers. Device control is achieved through a 2-wire serial interface. Three address pins allow up to 8 DS1803's to share the same 2-wire interface. The exact wiper position of each potentiometer can be written or read. The DS1803 is available in a 16-pin DIP, 16-pin SO, and 14-pin TSSOP package. The device is available in three standard resistance values: 10kΩ, 50kΩ, and 100kΩ and is specified over the industrial temperature range.
As an alternative you might want to look at using a MOSFET as a digital pot via a 3-wire D/A from the propeller. But this is more complex and doesn't provide the isolation that (likely) these digital pot chips do.
Regards,
David
The digital pots don't provide any isolation although they make it easier since you can drive them with an optoisolator.
-Phil
I've done a lot more research recently on the whole thing, and now I feel like I understand better exactly what needs to be done and the risks involved. Also, Nuts and Volts Magazine posted an article doing more or less exactly what I want to do using an SX controller, with schematics and code examples. Between those and other information found here, I'm going to adapt those for use with a Prop.
X10 doesn't work well in an application like this it is way to slow and can be inconsistant. Spork is on the right track. While the alternatives are interesting they all fall short of his (and my) end goal. The goal is to create a dimmer pack. The pack would be driven by a computer. In my case all the packs I have made in the past were driven by DMX. Yes there is a risk of getting hurt but it’s not difficult to create the required isolation.
For reference this is basically what he and I are building. http://wolfstone.halloweenhost.com/RemoteControl/dmxint_DPDMX20L.jpg
http://www.dv-fansler.com/Computer%20Lights/dimmers.htm
·
For a fully isolated circuit perhaps the best way is a standard opto feeding back from the mains so that the photo-transistor's collector goes to a prop input via a pullup. When the AC goes very close to zero the prop input will go high and then you can start timing from there as to when to turn the triac on. A brief pulse is all that is needed to turn the triac on after which you can turn the opto off. The triac will turn off automatically when the AC current drops close to zero (Inductive loads can fool the triac which is why you need that RC snubber across it). At 60Hz you have up to 8.33ms before the end and start of the cycle. Maximum power is achieved by leaving the opto on or pulsing it at the start of the cycle. Half power is achieved by turning on half-way through the cycle etc (non-linear but).
If your circuit is powered from the mains via a transformer and if you have access to the AC secondary then you can simply run something like a 1M resistor from there to a prop pin. The signal is a little different but still suitable for deriving timing.
Many of us have been bitten by mains and it's only those of us still alive that can say that (serious). Make sure your circuit is on an earth-leakage circuit breaker (ELCB) but that won't help you if you place your hand across the tracks so if you don't have a case then simply tape a thin plastic sheet to the board. Be aware then your wife or a child might inadvertently touch this board when you just ducked out to get a coffee. Be safety conscious not just for yourself but others also.
Demo software is a simple "wait-for-zero,time then trigger" loop. Depending upon the type of load whether it is a lamp or a fan etc you may have to add in some calculations or table lookup to make the response linear.
*Peter*
1)I presume you meant '400V 3 phase' as opposed 400A 3 phase - using the value you stated would mean that the 'cabinet' would be > 220KW !!?? EDIT: 3ph voltage level stated as 208v in later thread·so 115W in that case
2)To say that it doesn't scare you anymore is fine - but it is important to have a healthy respect for it - IMHO
3)If you were to be working in the 'High Tension' side of·the·business·- 'Once in a while you get "nipped", - means death.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Necessity is the mother of invention'
Post Edited (QuattroRS4) : 12/3/2007 5:19:47 AM GMT
·
If you want to get technical a person can be killed at just about any voltage.
Just·a question - what was a 115KW··dimming cabinet doing exactly ? Massive studio lighting ? or some form of high intensity discharge lighting ?
If so - how did it affect power factor over varying load? - Did this require dedicated automated PFC (power factor correction) panels? What·Kvar PFC was required ? Just wondering as I want to run parallel tests on a power factor correction panel using·a propeller - to compare values and perhaps enhance reaction time for·switching in and out cap. banks·- just have to trial suitable CT's ..·then perhaps look at the harmonics ... the third harmonic distortion is measuring ca. 2.2-2.5% - at this site .. over 3% and there will be issues - so I had better look at load balancing ! fifth harmonic distortion·is surprisingly low at this site@ approx 1.1% - even though there is a lot of SMPSU and computer loads. Substantial savings can be made by the customer if these are addressed and the PF·brought as·close to unity as possible.
Just noticed you·mentioned 208V 3 Phase so KW rating is about 115KW ....for your cabinets
we use (220VAC single phase)/(380-415VAC) 3 PH 50 Hz here ..at these levels we would be talking·min. 220KW·at that·current.
John
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Necessity is the mother of invention'
Post Edited (QuattroRS4) : 12/3/2007 7:00:26 AM GMT
The attached circuit is based on an IGBT, controlled by a PWM input at 20-40KHz. By varying the duty cycle from 0 to 100%, you can vary the output to the load. The arrangement of Rshunt (0.1 Ohms) and Radj (10k Ohms) will trigger the SCR if the current drawn by the load goes beyond a chosen limit, which should provide overload protection. The choke on the load output smooths out the chopped-up waveform and gives a reasonable sinewave output.
Keep in mind this circuit is still theoretical and is yet to be built. You will have to choose suitable components. I will be running this circuit past an electrical engineer friend before I attempt to build it.
I accept no responsibility should your use of this circuit cause injury, death, cats and dogs living together, or whatever.
Theory behind it is here:www.parlights.com/parlights/Downloads_files/strand/Dimming/Sinewave%20Dimmer%20Technology.pdf
IGBT is a great way to do it allows you to do reverse phase dimming. lets use 50% intensity as an example. With forward phase dimming (triac) when a zero cross is sensed a timer starts. At 50% of that cycle the micro turns on the triac, at the next zero cross the triac automatically turns off and the whole process starts again. With reverse phase dimming when the zero cross is sensed the IGBT is turned on and a timer is started. At 50% of the cycle the micro turns OFF the IGBT. The advantage to reverse phase dimming is the lamp isn't "slammed" on which can shorten its life.
Altering the duty cycle will work if you are interested in dimming DC loads. However this won't work for AC dimming, you need to sense the zero cross point and perform one of the two above dimming methods. BTW there is an open source dimming project that has a great IGBT circuit, the project is called Semitone (listed at sourceforge.net).
some time ago I have posted some light dimmer code that should work with your initial schematic.
This can be found at the completed projects.
"Propeller based Alarm clock, that wakes me up with light - includes light dimmer AC phase control "
http://forums.parallax.com/forums/default.aspx?f=21&m=176650
It is not completely perfect, because it generates some flickering, the spin code is perhaps not fast enough.
Please be careful.
Christof
You are having live 220 VAC over your desk, full of things. Under that board seems not to be any insulation. If you knock off that cable... the circuit and lamp fall to the floor. I'd suggest you remove that photo (is a bad example for untrained fellows, and you change it with one of a properly done setup. For instance, fix the board with screws to a 20x20 piece of wood, can be plywood. Fix the main cable there with a header, add a fuse! and a main switch, and fix the lamp's receptacle also to the wood. A setup like that will be easier to handle and safer.
I was only working with 120v, but still I know it's dangerous.
The circuit described should work for an AC load. By running the IGBT at high frequency, you can avoid using it in its linear region (ie where it gets hot), but still get a gradual turn-off (which is one of the advantages of reverse-phase). There is no need to worry about the zero crossing, as we chop the waveform up all along its length.
The PDF I linked to previously has a fairly good explanation of all three types of dimmer (forward-phase/TRIAC, reverse-phase/IGBT and sinewave).