Parallax Forums
  HomeLog InRegisterCommunity CalendarSearch the ForumHelp
   
Parallax Forums > Public Forums > Completed Projects > Controlling 120 VAC lights with a Stamp  Forum Quick Jump
 
New Topic Post Reply Printable Version
[ << Previous Thread | Next Thread >> ] | Show Newest Post First ]

RTurley
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2004
Total Posts : 8
 
   Posted 1/26/2005 8:02 AM (GMT -7)    Quote This PostAlert An Admin About This Post.

Controlling 120 VAC lights with a Stamp

 

Dimming lights with a Stamp is relatively easy.  With the help of some additional circuitry, it is possible for the Stamp to perform some very fun feats of lighting control. The nice feature of this circuit is that it is easily expandable and provides very fine (225 useful steps) control over the light level.

 

Background

 

I was looking for some method of controlling the lighting in Halloween haunted house dioramas.  I found an article titled “All-digital circuit fires triac” that appeared in the July 21, 1994 issue of “Electronic Design News”, and can be seen at the link below.

 

http://www.edn.com/archives/1994/072194/graphs/15di3fg1.htm

 

I made some minor additions to the circuit and one change to the timing as shown in the original article.  This circuit works dependably and is great for setting the mood of an event.

 

Possible uses for this circuit

 

Animated holiday light displays

Party lighting

Halloween haunting, lightning effects

Strobe effects

 

AC sine wave

 

In the USA, single-phase alternating current has a frequency of 60 cycles per second.  The voltage curve varies from zero up to +150 volts and back to zero volts and then to -150 volts and returns to zero volts.  The curves are sinusoidal, not circular.  The root-mean-square (RMS) of all points on either curve equals 120 volts.  However, for this circuit, being aware of the voltage at various points in the sine wave is important.

 

General Description

 

The light dimmer circuit consists of 3 functional blocks: timing, control, and 120 VAC switching.  The objectives of the dimmer circuit are:

 

1.                  To be able to pick any point in the positive or negative AC half-wave to switch the current on,

2.                  To repeat turn-on at this point indefinitely until a new turn-on point is selected.

3.                  To electrically isolate the 120 VAC portion of the circuit from the rest of the circuit.

 

120 VAC Devices and AC switching

 

Triac

 

The triac is the device that will switch the AC. The terminals on a triac are labeled Main Terminal 1 (MT1), Main Terminal 2 (MT2) and the Gate (G).

 

From a black box perspective, the triac has four important functional characteristics (assuming the device is operating within its maximum ratings):

   

1.         The triac will conduct in either direction of current flow. This means that current can flow from MT1 to MT2 or from MT2 to MT1.

 

2.         The triac will only begin conducting when triggered by a current applied to the Gate. 

 

3.         The triac automatically ceases conducting when (only if) the voltage across and current through MT1 and MT2 goes to zero, after which the triac must be re-triggered to begin conducting again.

 

4.         Once triggered, the triac will continue conducting until the next zero voltage crossing point in the AC sine wave regardless of the voltage/current applied to the gate. So, once triggered, the Gate input is in a “don’t care” state until after the next zero crossing point.

 

To summarize, the triac will only begin conducting when triggered and will continue conducting regardless of the state of the gate until the next zero voltage crossing point. The triac can be triggered in either the positive or negative part of the AC sine wave.

 

A helpful article titled “Thyristors and triacs - Ten golden rules for success in your application” can be found here:

 

http://www.web-ee.com/primers/files/AN_Golden_rules.pdf&e=7620

 

Triac Trigger (MOC3010M)

 

The triac trigger is a device that provides 5 V inputs to an internal LED (through a suitable current-limiting resistor) on one side and a 120 VAC optically triggered triac on the other side.  This device electrically isolates the 120 VAC side of the circuit from the logic level side of the circuit. Using a triac to trigger the main triac solves the problem of triggering the main triac on the positive or negative voltage portion of the AC sine wave.

 

Zero Crossing detector (H11AA1)

 

This device provides notification of when the AC voltage is zero.  It consists of two cross-coupled LEDs on the AC side and a phototransistor on the logic level side.  Thus the one or the other LEDs is on during any non-zero portion of the AC sine wave.  Both LEDs are off at the zero voltage point. By adding a 10K pull-up resistor to the photo transistor output on the logic level side of the device, the zero crossing detector will pull the output low during the non-zero portion of the sine wave and the 10 K resistor will pull the line up to 5 V when the photo transistor turns off.  The zero crossing detector will produce a positive going pulse every 8.333 milliseconds (1/120 =  .0083333).  This device electrically isolates the 120 VAC side of the circuit from the logic level side of the circuit.

 

Simple 1-channel circuit (Attachment 1)

 

This simple 1-channel circuit can be built using a Stamp for control and timing.  In this configuration, the Stamp has one pin connected to the trigger input of the triac trigger and one pin connected to the zero cross line. The Stamp must poll the zero crossing clock line and when the zero cross line goes high, initiate the change to the triac.  This circuit is not practical for dimming because retriggering the triac at a specific point in the sine wave will totally consume the Stamp and leave no time left for other computing.  The circuit will function adequately to turn the triac full-on or full-off.  The following sample code will blink a lamp at 1 second intervals:

 

Trigger              PIN           0

ZeroCross         PIN           1

 

Main:

DO

  GOSUB            TriacOn

  PAUSE             1000

  GOSUB            TriacOff

  PAUSE             1000

LOOP

 

           [Subroutines]--------------------------------------------------------------------

 

TriacOn:

DO WHILE (ZeroCross = 0)

LOOP

HIGH Trigger

RETURN

 

TriacOff:

DO WHILE (ZeroCross = 0)

LOOP

LOW Trigger

RETURN

 

This circuit does not meet the requirement of being able to trigger the triac at any point in the AC half-cycle and repeatedly turn it on at this point, but does implement simple on-off control.

 

Circuit component costs:

Triac-4Amps                       $1.87

Heatsink                           1.00

MOC3010M triac trigger             0.86

H11AA1 zero cross detector         0.42

4 ¼ watt resistors                 0.20

 

Total                             $4.35

 

Fully functional 1-channel dimmer (Attachment 2)

 

This circuit offloads all timing and control from the Stamp to external circuitry.  By adding a 1MHz TTL crystal and a 14-bit ripple counter with reset, the timing issues are solved.  By adding a comparator that compares two 8-bit terms labeled P and Q and provides a low output when P>Q, the control problem is solved.

 

The 1 MHz crystal output is fed directly into the ripple counter.  The ripple counter is free-running. The first 5 stages (bits 0 through 4) of the ripple counter are not used.  The next 8 output stages (bits 6 through 13) of the counter are the term P fed into the comparator. The first 5 stages of the ripple counter serve to divide the crystal clock rate by 32.  This results in a clock rate of 31,250 Hz fed into the next 8-bit counter stage that makes up the P term. Since the ripple counter’s reset pin is connected to the zero cross line, the counter is reset every 120th of a second. There are 260 clock pulses (31,250 / 120 = 260) going into the 8-bit counter stages that make up the P term. Thus the 8-bit P term counts from 0 to 255, rolls over to zero and continues counting  to 4, when it is reset to zero by the zero cross line.  This repeats for each AC half wave.  The counter roll over slop does not affect the performance of the circuit, since the triac is likely already triggered by this point in the cycle, and any changes on the triac trigger are ignored until the triac resets itself at the next zero crossing point.

 

The 8-bit output of the counter is connected to the P inputs of the comparator.  Pins 0 through 7 of the Stamp are connected to the Q inputs of the comparator.  When the count value on the P inputs is greater than the trigger value on the Q inputs, the triac trigger line is driven low, which fires the triac.

 

So by manipulating the trigger value with the Stamp, you can control the trigger point in the AC half-wave, and this circuit will continually retrigger the triac at this point until the trigger value is changed.

 

In order for the Stamp to know when to change the Q value, it must poll the zero cross line and only change the Q inputs when the zero cross line is high.  Otherwise, changes in Q inputs can occur in mid AC cycle, resulting in lamp flicker.

 

Notice that the trigger values are reversed from what one might intuitively expect.  For example, a trigger value of zero is full-on, while a trigger value of 255 is full-off. This is because the triggering condition occurs when the counter value exceeds the trigger value. So if the trigger value is zero, when the counter value reaches 1, the counter value is greater than the trigger value and the triac is triggered.  Conversely, if the trigger value is 255, the count never is greater than 255 and the triac is not triggered.

 

The following subroutines can be used to implement this dimmer circuit.

 

TrigValue         VAR    Byte                             ‘Trigger value

ZeroCross        PIN     8                                  ‘Pin attached to zero cross line

 

Main:

           This loop will ramp the light on in 225 steps - notice that the count proceeds from 225 to 0

FOR TrigValue = 225 to 0

  GOSUB SendTriac

  PAUSE 100

NEXT

END

 

           [Subroutines]--------------------------------------------------------------------

 

SendTriac:

DO WHILE (ZeroCross = 0)

LOOP

 

OUTL = TrigValue

RETURN

 

The terminal count of 225 is simply the number that represents the last value for which I could observe filament illumination.  So, even though values greater than 225 do indeed turn the triac on during the down-slope of the sine wave, the voltage at that point is insufficient to illuminate a lamp filament.  Thus I reduced the maximum trigger value to 225.  At 225 no visible light is produced, but at any value less than 225 the filament will glow.

 

Circuit component costs:

Triac-4Amps                              $1.87

Heatsink                                  1.00

MOC3010M triac trigger                0.86

H11AA1 zero cross detector            0.42

4 ¼ watt resistors                    0.20

1Mhz TTL crystal                      1.70

CD4020N 14-bit ripple counter         0.60

74LS682 8-bit magnitude comparator    1.10

 

Total                                $7.75

 

This circuit works fine but uses a lot of precious stamp pins.  The next circuit adds two additional devices to reduce the number of Stamp pins needed.

 

Fully functional 1-channel dimmer that uses only three Stamp pins (Attachment 3)

 

This circuit adds a serial to parallel shift register and an 8-bit latch.  This relieves the Stamp of presenting the 8-bit trigger value on eight of its own pins and offloads the zero cross line polling.  The stamp can send the 8-bit trigger value serially.  The serial to parallel shift register will present the 8-bit trigger value to the 8-bit parallel latch.  The latch is used to control the timing of when the trigger value is presented to the comparator, which must by synchronous with the zero cross line to avoid flicker.

 

 

SerialClock                  PIN      0                      ‘Serial transmission clock line

SerialData                    PIN      1                      ‘Serial data line

TriacLatchEnable          PIN      2                      ‘8-bit latch enable pin

 

TriacTriggerValue         VAR    BYTE              ‘byte for holding trigger value

 

Main:

           Ramp the light on

LOW   TriacLatchEnable                                  ‘initialize state of latch enable pin

 

FOR TriacTriggerValue = 225 to 0

  GOSUB SendTriac

NEXT

END

 

           [Subroutines]--------------------------------------------------------------------

 

SendTriac:

SHIFTOUT  SerialClock, SerialData, MSBFIRST, TriacTriggerValue  ‘Send data to shift register

PULSOUT  TriacLatchEnable, 5000                                                  ‘hold pulse for 10 mSecs

RETURN

 

This circuit is simple to program and uses only three Stamp pins.  It is a fully synchronous circuit and will provide flicker free operation.

 

Circuit component costs:

Triac-4Amps                              $1.87

Heatsink                                  1.00

MOC3010M triac trigger                0.86

H11AA1 zero cross detector            0.42

4 ¼ watt resistors                    0.20

1Mhz TTL crystal                      1.70

CD4020N 14-bit ripple counter         0.60

74LS682 8-bit magnitude comparator    1.10

74LS164 Serial-to-parallel

 shift register                       0.45

74LS377 Octal D register              0.70

 

Total                                $9.10

 

Eight-channel light dimmer (Attachment 4)

 

By adding a 3-line to 8-line decoder and three more Stamp pins for addressing, the circuit can be expanded to an eight channel dimmer. The serial-to-parallel shift register is connected to all 8-bit latches.  The three address bits are used to select the specific 8-bit latch to store the trigger value. The following code will drive this circuit.

 

TriacAddr                    VAR    Nib                              ‘Triac latch address (0 through 7)

TriacAddr0                  VAR    TriacAddr.Bit0

TriacAddr1                  VAR    TriacAddr.Bit1

TriacAddr2                  VAR    TriacAddr.Bit2

 

TriacPin0                      PIN      0                                  ‘Triac addr pin 0

TriacPin1                      PIN      1

TriacPin2                      PIN      2

 

TriacLatchEnable          PIN      3                      ‘8-bit latch enable pin

 

TriacTriggerValue         VAR    BYTE              ‘byte for holding trigger value

 

Main:

           Ramp all lights on

HIGH  TriacLatchEnable

 

FOR TriacTriggerValue = 225 to 0

   FOR TriacAddr = 0 to 7

       GOSUB SendTriac

   NEXT

NEXT

END  

 

           [Subroutines]--------------------------------------------------------------------

 

SendTriac:

          Send data to shift register

SHIFTOUT  SerialClock, SerialData, MSBFIRST, TriacTriggerValue  ‘Send data to shift register

 

           Set up address of latch

TriacPin0 = TriacAddr0

TriacPin1 = TriacAddr1

TriacPin2 = TriacAddr2

 

           Latch the data

PULSOUT  TriacLatchEnable, 5000              ‘hold pulse for 10 mSecs

RETURN

 

Circuit component costs:

Triac-4Amps                              $1.87

Heatsink                                  1.00

MOC3010M triac trigger                0.86

H11AA1 zero cross detector            0.42

4 ¼ watt resistors                    0.20

1Mhz TTL crystal                      1.70

CD4020N 14-bit ripple counter         0.60

74LS682 8-bit magnitude comparator    1.10

74LS164 Serial-to-parallel

 shift register                       0.45

74LS377 8-bit latch                   0.70

74LS155 Dual 1 line to four line

 Data distributor                     0.35

Total                                $9.25

 

This final version of the circuit is the best, because of the number of channels supported.  Each additional channel requires addition of:

 

Triac with heat sink                 $2.87

MOC3030M triac trigger,               0.86

2 ¼ watt resistors                    0.10

74LS377 8-bit latch                   0.70

74LS682 8-bit magnitude comparator    1.10

 

Incremental cost of each channel     $5.63

 

I used Teccor triacs.  These are available with isolated tabs in a TO-220 style case. This keeps the AC off of the Heatsink.  Current ratings range from 4 to 15 Amps.  All can be triggered with the MOC3010M triac trigger.  Review the manufacturer’s data sheet regarding heat sink requirements.

 

Attachment 5 is a collection of Parallax USB Oscilloscope images of the zero cross detector output  (blue) and the triac trigger line (red).  The images show the following cases: Full off, ¼ on, ¾ on and full on. Each image shows the activity in one-half of the AC sine wave, the period between zero crossing events.

 

Final notes

 

This circuit can ONLY be used for dimming lights.  Inductive loads cannot be used.  This includes electric motors and fluorescent lamp ballasts. The reason is that the reverse EMF produced by inductive loads produces an out-of-phase wave back to the triac so that the triac never sees zero volts.  Thus the triac never ceases conducting, resulting in total loss of control.  There are snubber circuits that can be added to filter this reverse EMF and restore order to the triac.

 

As with all circuits that use 120 volt AC mains, the circuit should properly fused for the loads to be used.  Due care must be taken when working AC Mains voltage to protect from shock and injury.  Never work on the circuit with Mains voltage applied to the circuit.  Do not bring Mains voltage onto a breadboard.  It is too easy to forget where on the breadboard these voltages are. 

 

You can put the AC side of the circuit on a perfboard or prototype board and bring the logic level signals to/from a breadboard.  Just remember to use adequately sized wire in the AC side for the anticipated current.
 
Corrections:
 
Changed Attachment 4 to correct address and data inputs on device 74LS155 (had them reversed) and changed polarity on Latch_Enable line from LOW at rest to HIGH at rest.  This is an active LOW signal. PULSOUT will invert the output state of the pin for the specified time and then restore to its original state.
 

Post Edited (RTurley) : 2/9/2005 1:30:49 PM GMT


Image Attachment :
Image Preview
Attach1.jpg
  121KB (image/pjpeg)
This image has been viewed 1945 time(s).
Image Attachment :
Image Preview
Attach2.jpg
  108KB (image/pjpeg)
This image has been viewed 1565 time(s).
Image Attachment :
Image Preview
Attach3.jpg
  167KB (image/pjpeg)
This image has been viewed 1274 time(s).
Image Attachment :
Image Preview
Oscope4.jpg
  305KB (image/pjpeg)
This image has been viewed 1381 time(s).
Image Attachment :
Image Preview
Attach4CorrectedLS155.jpg
  328KB (image/pjpeg)
This image has been viewed 1543 time(s).
Back to Top
 

MacGeek117
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Dec 2004
Total Posts : 688
 
   Posted 1/30/2005 10:11 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
Whoa! Cool!
bugg


So many projects, so little time.

Back to Top
 

briano
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2005
Total Posts : 3
 
   Posted 4/29/2005 11:20 AM (GMT -7)    Quote This PostAlert An Admin About This Post.

This is really great stuff.  Thanks for the post.  I have a bunch of lights in the open kitchen/dining/family room area and ideally to have scenes, and decent lighting and control (undercounter lights, general kitchen lighting, a decorative pendant, light just over the dining table, light at the family room, and a light in the little nook) which isn't any crazy or extravagant setup I was looking at about 8 dimmers all side by side on the wall at the entry..so i have been looking for a way to have just a couple dimmers for control if the home automation was down and a way to get everyhting else switched and dimmed via the system.  The stuff on the market is a LOT..nearly 80 bucks for each circuit..500-600 bucks all told.  I think I am going to follow your lead and make something in a can to put in the crawl space. 

 

Thanks again.

 

ps are you interested in getting paid to make a few setups for me?  I am not an electronics whiz and can already see when I went to Jameco that with the part  number it gives me choices and I am am unsure of what to order

Back to Top
 

Paul Baker
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2004
Total Posts : 6323
 
   Posted 4/29/2005 11:27 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
Top notch writeup RTurley, kudos.
Back to Top
 

StarMan
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2004
Total Posts : 301
 
   Posted 4/30/2005 11:53 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
RTurley,
 
If you decide to build some for briano, sign me up as well.
 
Starman
Back to Top
 

Bean
Forum Moderator



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2004
Total Posts : 6367
 
   Posted 4/30/2005 8:03 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
The reason this stuff is so expensive is liability. Any time your messing with household current, your asking for a lawsuit.
Imagine if someone's house burns down because your circuit failed...
Bean.


"SX-Video Display Module" Available Now.
 
"A problem well defined, is a problem half solved."
 

Back to Top
 

briano
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Mar 2005
Total Posts : 3
 
   Posted 5/2/2005 2:07 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
ya, I figure to get one from a manufacturer he has to get a UL listing, build a fancy enclosure, advertise, make a few and have them in stock or ready to go and probably wants to pay for insurance.....etc etc.. hence the beauty for these forums and doing it yourself.
Back to Top
 

larrwilll
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2005
Total Posts : 1
 
   Posted 6/8/2005 12:35 PM (GMT -7)    Quote This PostAlert An Admin About This Post.

Why is the zero cross needed for "Simple 1-channel circuit (Attachment 1)". Couldn't the Triac Trigger simply be set high or low without regard for the zero point if all that is needed is to turn the light on/off?

Thanks

Back to Top
 

Chris Savage (Parallax)
Forum Moderator



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2004
Total Posts : 10864
 
   Posted 6/8/2005 1:31 PM (GMT -7)    Quote This PostAlert An Admin About This Post.

Hello,

   Each time the AC voltage crosses zero volts, the triac stops conducting and needs to be re-triggered.  If this is done at points other than the zero-crossing point, it generates more electrical noise for the device.


Chris Savage
Parallax Tech Support
 

Back to Top
 

grimshady
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2005
Total Posts : 80
 
   Posted 6/10/2005 8:53 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
Chris Savage (Parallax) said...

Hello,

   Each time the AC voltage crosses zero volts, the triac stops conducting and needs to be re-triggered.  If this is done at points other than the zero-crossing point, it generates more electrical noise for the device.

I understand your statement but I'm wondering why it really matters...First scenerieo is that your are dimming something..then by definition you are turning on late in a half cycle  right?  So you have to live with the noise in that case.

If your just simply turning on or off then you only get noise from the "one" half cycle that you turned it on and then from then on the triac is retriggered on the zero crossing since the triac will be gated ON already for every half cycle that comes before you want to turn OFF power (or am I wrong about this?).

 

Todd Snyder

 

Back to Top
 

Chris Savage (Parallax)
Forum Moderator



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2004
Total Posts : 10864
 
   Posted 6/10/2005 9:41 AM (GMT -7)    Quote This PostAlert An Admin About This Post.

Todd,

   Perhaps I missed something somewhere.  If you're turning the light on, then the TRIAC continually needs to be re-triggered.  Triggering based on the Zero-Crossing point shouldn't affect the first cycle as opposed to all subsequent cycles.  I guess I don't see the correlation/point of the first cycle being triggered differently.


Chris Savage
Parallax Tech Support
 

Back to Top
 

grimshady
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2005
Total Posts : 80
 
   Posted 6/10/2005 10:00 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
Chris Savage (Parallax) said...

Todd,

   Perhaps I missed something somewhere.  If you're turning the light on, then the TRIAC continually needs to be re-triggered.  Triggering based on the Zero-Crossing point shouldn't affect the first cycle as opposed to all subsequent cycles.  I guess I don't see the correlation/point of the first cycle being triggered differently.


I'll go back and reread the method...I must have not understood how its working. My thinking was that if you hold the trigger line high on the triac then it will stay on (or will turn on at the zero crossing) and will effectivly stay on.  My point about it only happening during the first half cycle was that the turn on would probably cause a first turn on NOT on the zerocrossing but then it would effectivly never turn off if the trigger line was held high.  

Like I say, I'll go reread the method posted...from your reply I guess the stamp has to revisit the triac to turn it back on at every zero crossing.

Back to Top
 

Chris Savage (Parallax)
Forum Moderator



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2004
Total Posts : 10864
 
   Posted 6/10/2005 10:16 AM (GMT -7)    Quote This PostAlert An Admin About This Post.

Todd,

   I wasn't referring to the Stamp, but rather the Triac being re-triggered, which is where we may be on a different view of this.  I just looked at the circuit, and it appears to be using an existing AC signal as a reference for clocking the TRIAC output.  Obviously there is more involved here, but my comment was based on there being a difference in the point during the cycle in which the triac if triggered being different on the first activation.

   In any event, this is a nice circuit design...Not too many parts, considering what it's doing.  Could easily be adpated into a module form for easy connection to the BASIC Stamp.  As for the parallel interface, that could also be handled with a 74HC595 requiring only 3 pins to talk to the device instead of 8.


Chris Savage
Parallax Tech Support
 

Back to Top
 

jumblo
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2005
Total Posts : 8
 
   Posted 6/27/2005 5:22 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
>>Each time the AC voltage crosses zero volts, the triac stops conducting and needs to be re-triggered. >>If this is done at points other than the zero-crossing point, it generates more electrical noise for the >>device.

This is true, but the software should be turning on the light _after_ the zero crossing point. A triac will turn off the load at zero crossing. The stamp can turn _on_ the load at any point, but the load will only go _off_ at zero (very close to it anyway).

To achieve a fade, you need to monitor "zero crossing" via a detector,
start counting, and "pulse" on the load after some determined time.
The longer the time, the shorter the "on time" before zero crossing,
and the dimmer the light.

If you do not use a zero crossing detector, you wont know when to "turn on" the load and you will get a pretty eratic flicker instead of a nice fade.

Note: these circuits are pretty noisey by nature. Commonly an inductance filter is put inline with the load to reduce the naiose on the line.

jumblo
Back to Top
 

jumblo
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2005
Total Posts : 8
 
   Posted 6/27/2005 5:30 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
It is also worthwhile noting that with a BS-1 or prop-1, you essentially have 256 fade levels (0-255) and some timing limitations.  You will get an acceptable fade for many applications, but don't be surprised, when executing a slow fade, that you see "steps" in the fade.  (unless you go through some extensive programming hoops)
 
 
I would love to see an external serially programmed device that offloads the hard work.  The prop-1 could send out the fade command, and let the device do the work.
 
 
A simpler request is for an external fader that you send a simple on/off signal to.  The fade could be prewired, or adjustable via a pot.  For many of my applications, I just want a simple fade and have no need to adjust the rate once the prop is set up.  Any lines on such a device?
 
jumblo
 
 
 
Back to Top
 

croussi
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2005
Total Posts : 3
 
   Posted 6/28/2005 8:09 AM (GMT -7)    Quote This PostAlert An Admin About This Post.
jumblo said...
It is also worthwhile noting that with a BS-1 or prop-1, you essentially have 256 fade levels (0-255) and some timing limitations. You will get an acceptable fade for many applications, but don't be surprised, when executing a slow fade, that you see "steps" in the fade. (unless you go through some extensive programming hoops)

[snip]


jumblo


I have been usisng some very slow fades (~30s) with
this design, and have not noticed any steps (except the
one from very dim to full off). Were you using large-wattage
lights when you saw this effect? Just curious....

croussi
Back to Top
 

scary terry
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Aug 2005
Total Posts : 14
 
   Posted 8/27/2005 4:18 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
I'd like to thank R. Turley for posting this circuit and the great text to go with it. I built a two channel version of the circuit and it works extremely well. My only modification to the circuit was to eliminate the 74LS155 and use two TriacLatchEnable lines from the Stamp. I put the hot section (triacs) in a metal electrical box and all the control circuitry on a perf board. I also have a ChipCorder on the main board and the sound is perfectly clean, no dimmer noise at all. I found the dimming range is just what he originally posted, from 0 to 225. This will be used for a "Peppers Ghost" type of illusion for Halloween.
Terry
Back to Top
 

LordFransie
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2007
Total Posts : 4
 
   Posted 10/30/2007 6:25 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
now this may come off as ignorant but why can't you just use a digital potentiometer instead of a triac. I don't have a triac, so this would be easier for me. I'm new to electrical engineering, i am a software guy, hardware is something new to me.
Back to Top
 

Larry Sutherland
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2007
Total Posts : 64
 
   Posted 10/30/2007 9:02 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
I am glad that I've found "Completed Projects" - forum.

Excellent - projects/ideas

Good Job !

L Sutherland
Back to Top
 

sam_sam_sam
Soldering Junkie



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined May 2005
Total Posts : 1588
 
   Posted 10/31/2007 2:27 PM (GMT -7)    Quote This PostAlert An Admin About This Post.

RTurley Or Terry

This is a very nice Project

The reason I am asking is because 

I want One Basic Stamp and One Dimmer Circuit as a Stand Lone

 I want to make 3 or 4 of them

Are you going to make a circuit board for your project if so

Please let me know



  Thanks for any idea that you may have and all of your time finding them
 
 
 
 
Sam

Post Edited (sam_sam_sam) : 10/31/2007 9:37:53 PM GMT

Back to Top
 

JonnyMac
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jun 2006
Total Posts : 2456
 
   Posted 10/31/2007 3:18 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
It's much easier and far more flexible to use an SX to handle the dimming control, and the BASIC Stamp could send it serial command -- I did that with our FC-4 (www.efx-tek.com/topics/fc-4.html) and in an 8-channel project that will be in the November issue of Nuts & Volts. Interestingly, I adapted the AC portions of this project for my FC-4 and eight-channel projects; I just replaced the three chips with one.
Back to Top
 

owen683
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined May 2010
Total Posts : 1
 
   Posted 5/26/2010 6:58 PM (GMT -7)    Quote This PostAlert An Admin About This Post.
I have been working on this project for a couple weeks now and am having some trouble. I built the simple triac on/off circuit and it works well. I am having trouble with the first dimmer circuit though. I have removed the triac part of the circuit to see if I could just get the comparator working. I have tested the comparator by manually sending "P" and "Q" terms from the micro controller and this seems to work fine but after connecting the ripple counter I continually get a high on both outputs of the comparator indicating P < Q. I suspected my crystal/ripple counter wasn't working properly so I replaced both and checked all pinouts. I still had the same problem. I actually ordered all new parts from another manufacturer and still I have the same result. I wrote a little program for the STAMP to only output 1 to "Q" and still I have the same result "P" < "Q". The ripple counter's reset pin is not connected right now so I'm operating on the assumption that it will continue to count and wrap and if "Q" is only 1 I should be getting a consistent "Low" on the output of the comparator......Still I continue to get "high" on both outputs. Could anyone shed some light on what I'm doing wrong? I have tried two different 1Mhz crystal oscillators with the same results.
Back to Top
 
[ << Previous Thread | Next Thread >> ]
New Topic Post Reply Printable Version
 
Forum Information
Currently it is Thursday, July 29, 2010 5:21 PM (GMT -7)
There are a total of 462,441 posts in 62,066 threads.
In the last 3 days there were 90 new threads and 802 reply posts. View Active Threads
Who's Online
This forum has 20143 registered members. Please welcome our newest member, ME01.
60 Guest(s), 16 Registered Member(s) are currently online.  Details
John Abshier, Erik Friesen, RossH, Kevin Wood, simpsonmichael1, BradC, David Betz, Julian800, Martin Hodge, RDL2004, prof_braino, Harley, Sapieha, wiresalot, Ravenkallen, Tubular