Shop OBEX P1 Docs P2 Docs Learn Events
code and triacs — Parallax Forums

code and triacs

webbj548webbj548 Posts: 6
edited 2008-03-21 18:57 in BASIC Stamp
hey all
i need a little bit of help, im working on a display for halloween and im using the BS2 and BOE for the control this year. i have 2 question i cant find the answer to anywhere else

my first question is can i run a triac directly off of the microcontroller, its a L2001L3 Sensitive Gate Triac 200 Volt 1 Amp, it says it can be directly coupled to a TTL signal, so im wondering if its safe for the microcontroller.· It get expensive to octptically isolate every output and if all i need was mabye a diode on the ground line. that would save me alot of money. im gonna be driving 120 volt lights and mabye power bricks as the load on the triac.

My second question is some coding on the basic stamp, i have a 4 channel rf remote linked to pins 0-3 and i will also have PIR tirggers on top of that. so i can trip a prop with the remote or just let them walk thought.. the problem i have is the multible inputs in the code,
i wrote what i thought would work but im still alittle unsure if i got it right.
do
if (in0=0) then
· gosub prop1
if (in1=0) then
· gosub prop2
if (in2=0) then
··gosub prop3
if (in3=0) then
· gosub prop4
endif
end

and help would be greatly appriciated
thanks
josh

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-18 20:37
    DO NOT run the triac off the microcontroller. That means that you would have AC floating around your controller and it's too easy to get electrocuted or at least blow up the microcontroller (literally). Use a solid state relay where the logic input (which the BS2 can directly control) is isolated from the triac itself. Have a look at EFX-TEK's RC-4 (there's a link at the bottom of Parallax's website) for an example of how to do it.

    On your code, you need a matching ENDIF for each IF/THEN. Also, keep in mind that the RF remote and the PIR will stay triggered for a while. If you call the subroutine whenever the I/O pin is zero (or one), the subroutine can be called multiple times for one actuation of the sensor. It's better to keep a copy of the input pin values and call the subroutine only when the previous value is off and the current value is on. Think about it.
  • webbj548webbj548 Posts: 6
    edited 2008-03-18 23:04
    SO i need to put an endif with each of the if statements, im not worried about the triggering mutiple times, the relays are only momentary and the pir returns to a wait state as soon as the beam is reestablished.

    how can the ac current get near the microcontorller, the only common is the ground, dosent the live wire stay isolated,
    ·Could i use a high voltage rated diode to keep any of the high voltage from flowing in the diection of the controller.


    im still very new to electronics for this uses
    so and advice is greatly apprciated
    thanks
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-18 23:15
    With electric power wiring, the ground is not always wired correctly. You only need to be electrocuted once.

    Another issue is that there can be noise on the ground wire due to poor connections somewhere. With a 120VAC circuit, it only takes a few Ohms' resistance to produce several volts of noise on the ground wire and this can couple into your logic circuit. Unless you understand thoroughly the issues involved, do not skip the isolation provided by a solid state relay or optoisolator. Also, keep the AC isolated from where you can accidently contact it. Usually the solid state relay is placed near the outlet or part of your box with the power wiring and the power wiring is as insulated as you can make it with electrical tape or plastic covers protecting you and the rest of the unit from accidental contact. Often this is in a separate box with only the control lines (which are logic level and isolated from the AC) coming out of the box to your control unit.
  • webbj548webbj548 Posts: 6
    edited 2008-03-19 16:45
    Would a ULN2003 Provide adaquate isolation from the microcontroller, i use them to run some relays on another board, it would make it so that if somethings goes wrong, the only thing that could blow would be the darlinton array?
    thanks
    josh
  • MikeSMikeS Posts: 131
    edited 2008-03-19 18:07
    Use an optoisolator like the MOC3010. cost less than 1$

    see attached schematic
    482 x 198 - 19K
  • webbj548webbj548 Posts: 6
    edited 2008-03-19 18:29
    http://exdwh.com/H11AA1.pdf would this be a sufficent optoisolator?
  • MikeSMikeS Posts: 131
    edited 2008-03-19 18:48
    I would not use it to interface to a Triac. The MOC3010 is made for this purpose. Read the data sheet for it.
  • webbj548webbj548 Posts: 6
    edited 2008-03-19 20:37
    Would the MOC3011 which appears to have very similar specs work for this, i dont really see any difference except for the moc3011 is 40 cents cheaper.
  • MikeSMikeS Posts: 131
    edited 2008-03-20 16:37
    webj548,
    Yes it will work.
    Be careful.
    Mikes
  • webbj548webbj548 Posts: 6
    edited 2008-03-21 18:57
    http://cgi.ebay.com/H11D2-6-DIP-Optocoupler-Motorola-LOT-of-10_W0QQitemZ220211756319QQihZ012QQcategoryZ50917QQrdZ1QQssPageNameZWD1VQQ_trksidZp1638.m118.l1247QQcmdZViewItem

    Would this optocouple work in place of the MOC3010, They arnt speciafcally meant for triac driving, but if i read the data sheet right it provides a low power to run, and isolation protection up to 300 volts ?
Sign In or Register to comment.