110VAC light control
tractionfan
Posts: 4
I have been looking for a STAMP based circuit to control light dimming (couple of hundred watts of flood lights for a diorama scene).· I have previously used a kit put out by Vellman (Slow ON/ Slow OFF Dimmer) cycled by a STAMP which worked well but that kit is no longer available.· Incidentally all attempts at using X-10 technology have not yielded as smooth a dimming as I need.)
It would seem that a STAMP circuit, detecting AC line zero crossing and providing variable time delay in firing a solid state AC power relay might work.
The key I think is to get a circuit to detect the AC line zero crossing.· I know the X-10 series devices has a zero-crossing detector but that seems like an expensive approach.· Any suggestions on a simple circuit of a couple components to feed the STAMP to detect the zero crossing?
Any other suggestions for alternative approaches to controlling the flood lamps.· I really would like to keep in STAMP based and in fact have a master STAMP (or PC) controlling slave STAMPs, each controlling a couple of floods.· That way I could create interesting "sun rise/seting" effects for my diorams.·
It would seem that a STAMP circuit, detecting AC line zero crossing and providing variable time delay in firing a solid state AC power relay might work.
The key I think is to get a circuit to detect the AC line zero crossing.· I know the X-10 series devices has a zero-crossing detector but that seems like an expensive approach.· Any suggestions on a simple circuit of a couple components to feed the STAMP to detect the zero crossing?
Any other suggestions for alternative approaches to controlling the flood lamps.· I really would like to keep in STAMP based and in fact have a master STAMP (or PC) controlling slave STAMPs, each controlling a couple of floods.· That way I could create interesting "sun rise/seting" effects for my diorams.·
Comments
The high order eight bits of the counter are fed·into an 8-bit magnitude comparator using the "P" inputs.· An 8-bit latch is used to hold the trigger value.· The 8-bit trigger value is fed into the "Q" inputs of the magnitude comparator.· The "P>Q" output of the comparator drives an opto-isolator which drives the gate of the triac.
When the "P>Q" output goes low, the triac·fires and·conducts.· This repeats at the same point in the A/C half-cycle until the trigger value is changed.
A trigger value of zero results in the triac conducting for the full half cycle.· Any trigger value greater than 225 results in the triac never firing (appearing to never fire) during a half-cycle.· Any trigger value between these numbers represents a proportional period of on time per half-cycle.·
The trigger value is latched by the combination of the zero-cross signal (clock pin on the latch) and a /latch enable line from the BS-2. The /latch enable·signal is held low for 10 ms to insure that at least one zero-cross signal (which occurs every 8.333 ms) is coincident with the /latch-enable signal.
A loop beginning at 225 and ending at·0 decrementing by 1 will bring up the light from·non-visible to full on in imperceptible steps.· I use this in the halloween diorama.· Shortly before the "scary moment", I turn the light full off.· The "victims" pupils are fully closed when the lights go out, rendering an inky darkness before the animatronic fires.
I've also simulated lightning, by shooting random numbers into this system.· The transition from trigger value to trigger value is seamless because the change in trigger value is synchronous with the zero cross clock.
Parts used:
1 Mhz TTL oscillator, 1/2 D-flip flop to divide count by 2 giving 500 hz clock
4040 12-bit counter, 74LS377 8-bit latch, 74LS682 8-bit magnitude comparator, H11AA1 Zero-Cross detector
MOC3010M Triac opto trigger, Teccor 4 amp 400 volt triac.
This circuit is ONLY suitable for resistive loads.
I use two of these circuits and run two independently controlled dimmers.· It takes 4 pins on the stamp.· I use a serial to parallel converter and clock the appropriate latch based on a 1-bit address.· The four pins are labeled: Pin 1-Triac data (serial 8-bit trigger value stream), Pin 2-Triac serial clock (clock pulses to transmit serial trigger value to serial-to-parallel latch, Pin 3-Triac Address (selects the 8- bit latch to load with trigger value) and Pin 4-Triac latch enable (signal to latch trigger value into 8-bit latch).
Hope this helps.
Post Edited (RTurley) : 12/13/2004 12:07:38 AM GMT
There are three sheets.
Can you post code for your haunted house application?
Chris Isaacson
First routine turns both triacs off,
second routine does lightning with different patterns for each triac,
third routine ramps one triac up while the other triac ramps down and
the final routine steps the triacs thru fixed steps.
Have fun.
RTurley
' PROGRAM: Code snippets for light dimmer
·
'{$STAMP BS2}
·
'·
[noparse][[/noparse]Variables & Constants]
·
k······ ······· ······· var···· byte
TInt··········· ······· var···· nib
RandNo········· ······· var···· word
RandNoHi······· ······· var···· RandNo.highbyte
RandNoLo······· ······· var···· RandNo.lowbyte
·
TriacVal······· ······· var···· byte············'working value for setting triac
'· Redefinition of TriacVal
TriacValB7············· var···· TriacVal.bit7
·
DeviceAddr············· var···· nib············ 'Triac dimmer latch address
DeviceAddrB0··········· var···· DeviceAddr.bit0
·
Triac_AddrPin·········· con···· 2·············· 'pin number for Triac address line
Triac_DataPin·········· con···· 3·············· 'pin number for Triac Data line
Triac_Serial_ClockPin·· con···· 4·············· 'pin number for Serial Transfer Clock line
Triac_LatchEnablePin··· con···· 5·············· 'pin number of Triac Latch enable line (active hi)
·
'· Addresses of devices
Triac0Addr····· con···· $00
Triac1Addr····· con···· $01
·
·
'· Triac on/off values
·
'· Triac is off with any value of 225 through 255
TriacOff······· ······· con···· 255···················· ‘FULL OFF
Triac18On······ ······· con···· 225/8*7················ ‘1/8 ON
Triac1QtrOn···· ······· con···· 225/8*6················ ‘1/4 ON
Triac38On······ ······· con···· 225/8*5················ ‘3/8 ON
TriacHalfOn···· ······· con···· 225/8*4················ ‘1/2 ON
Triac58On······ ······· con···· 225/8*3················ ‘5/8 ON
Triac3QtrOn···· ······· con···· 225/8*2················ ‘3/4 ON
Triac78On······ ······· con···· 225/8*1················ ‘7/8 ON
TriacOn········ ······· con···· 000···················· ‘FULL ON
·
‘·
[noparse][[/noparse]Program]
·
Setup:
·· RandNo = 123
·
Main:
'· Turn Triacs off
·· DeviceAddr = Triac0Addr
·· TriacVal = TriacOff
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = TriacOff
·· GOSUB SendTriac
·
·· PAUSE 500
·
'· Do Lightning
·· FOR k = 1 TO 60
'· Do Triac 0
····· DeviceAddr = Triac0Addr
·
Main10:
····· RANDOM RandNo
····· IF RandNo.lowbyte > 225 THEN Main10
····· TriacVal = RandNo.lowbyte
····· GOSUB SendTriac
····· PAUSE RandNo.highbyte/4·········· 'pause random·time for effect
'· Do Triac 1
····· DeviceAddr = Triac1Addr
·
Main20:
····· RANDOM RandNo
····· IF RandNo.lowbyte > 225 THEN Main20
····· TriacVal = RandNo.lowbyte
····· GOSUB SendTriac
····· PAUSE RandNo.highbyte/4·········· 'pause random·time for effect
·· NEXT
·
Main30:
'· Ramp up Triac 0 and ramp down Triac 1
·
·· FOR k = 0 TO 225
····· DeviceAddr = Triac0Addr
····· TriacVal = k
····· GOSUB SendTriac··
····· DeviceAddr = Triac1Addr
····· TriacVal = 225 - k
····· GOSUB SendTriac
····· PAUSE 250
·· NEXT
·
'· Turn Triacs off
·· DeviceAddr = Triac0Addr
·· TriacVal = TriacOff
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = TriacOff
·· GOSUB SendTriac
·
'· Set triacs 1/8th on
·· DeviceAddr = Triac0Addr
·· TriacVal = Triac18On
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = Triac18On
·· GOSUB SendTriac
·· PAUSE 500
·
'· Set triacs 1/4th on
·· DeviceAddr = Triac0Addr
·· TriacVal = Triac1QtrOn
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = Triac1QtrOn
·· GOSUB SendTriac
·· PAUSE 500
·
'· Set triacs 3/8ths on
·· DeviceAddr = Triac0Addr
·· TriacVal = Triac38On
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = Triac38On
·· GOSUB SendTriac
·· PAUSE 500
·
'· Set triacs half on
·· DeviceAddr = Triac0Addr
·· TriacVal = TriacHalfOn
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = TriacHalfOn
·· GOSUB SendTriac
·· PAUSE 500
·
'· Set triacs 5/8ths on
·· DeviceAddr = Triac0Addr
·· TriacVal = Triac58On
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = Triac58On
·· GOSUB SendTriac
·· PAUSE 500
·
'· Set triacs 3/4ths on
·· DeviceAddr = Triac0Addr
·· TriacVal = Triac3QtrOn
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = Triac3QtrOn
·· GOSUB SendTriac
·· PAUSE 500
·
'· Set triacs 7/8ths on
·· DeviceAddr = Triac0Addr
·· TriacVal = Triac78On
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = Triac78On
·· GOSUB SendTriac
·· PAUSE 500
·
'· Set triacs full on
·· DeviceAddr = Triac0Addr
·· TriacVal = TriacOn
·· GOSUB SendTriac
·
·· DeviceAddr = Triac1Addr
·· TriacVal = TriacOn
·· GOSUB SendTriac
·· PAUSE 500
·
·· GOTO Main
·
'·
[noparse][[/noparse]Subroutines]
·
SendTriac:
'· Address is in TriacAddr
'· Data is in TriacVal (TriacVal is destroyed)
·
'· Send data serially to shift register - shift bits out of TriacVal starting with highest bit to lowest
·
·· FOR Tint = 0 TO 7
····· OUT3 = TriacValB7················ 'Put high order TriacVal data bit on pin 3
······································· '· (TriacValB7 is high order bit of TriacVal)
····· PULSOUT Triac_Serial_ClockPin,1·· 'Clock out the data bit
····· TriacVal = TriacVal << 1········· 'Shift TriacVal 1 bit left
·· NEXT
·
'· Set up address of triac to enable
·· OUT2 = DeviceAddrB0················· 'Put device address on Pin 2
·
'· Latch data from shift register into 8-bit latch
·· HIGH Triac_LatchEnablePin
·· PAUSE 10···························· ‘Hold high for at least 10 mSecs to catch zero_cross
·· LOW Triac_LatchEnablePin············ ‘Could have used·PULSOUT but I like the way '········································· this shows what’s happening
·
·· RETURN
'·
·
·
·
Post Edited (RTurley) : 12/12/2004 6:01:30 PM GMT