using the CD4017 as a one touch relay switcher?

Discussion in 'The Projects Forum' started by Belteshazzar, Mar 16, 2010.

  1. Belteshazzar

    Thread Starter Member

    Mar 16, 2010
    34
    0
    Can someone draw me a simple circuit to drive a few relays (I don't know how many outputs the 4017 has, I think it is 8).

    I saw it somewhere on a site and lost it.

    I remember it was a simple circuit with the outputs of the CD4017 saturating the transistors and then to the relay.
    I understand the 4017 can push 9mA per output...to drive the transistors.

    It was for 4 relays, and had 5 transistors, one diode, and about 5 resistors I think.

    You could change from relay to relay in sequence with one touch of a button with 4 LED pilots.
     
  2. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    One problem... do you have the components and what type of relay and voltage are you planning to use
     
  3. Belteshazzar

    Thread Starter Member

    Mar 16, 2010
    34
    0
    Yes, I have planty of components and what i don't have I'll buy.

    I will be using a awsome relay by MEDER. Utilizes a 5v coil uses only 10mA
    and can hold 200VDC or peak AC 1A. (the resistance is only 500ohms....thats why it uses only 10mA) It is magnetically shielded, has a "anti-spark diode" built-in and is very small.

    Anyway...5V is the coil and I need transistors off the 4017 to put out only about 20mA....10mA for the coil and 10mA for a LED....at 5V

    From what I understand from the 4017, it seems it can drive 9mA per output...I almost wouldn't need any transistors and use only relays without the leds....but I need them.

    I have a 5V Reg so I can feed the whole thing from 5+

    I have some diagrams on part of the circuit (because it was designed for another application) and I trying to put it all together)

    Can you draw me a complete diagram?
     
  4. Belteshazzar

    Thread Starter Member

    Mar 16, 2010
    34
    0
    Oh...actually I take it back, I need more than 20mA, on some outputs I will feeding 3 or 4 relays...so I need a suitable transistor.

    By the way I plan to switch in sequence 7 channels...so the pin after the last one used which I believe will be #8 on the 4017 gets tied to pin 15(reset) correct? And pin 11 NC ?

    Thanks
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Instead of a bunch of discrete resistors and transistors, I'd just use a ULN2003A or ULN2004A Darlington driver IC. They are cheap, and one IC will replace 7 resistors, 7 Darlington transistors, and seven protection diodes.
     
  6. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    or 7 resistors 14 transistors and 7 diodes.

    Considering the darlingtons as 2 BJT's
    But SgtWookies idea is the way to go.
     
  7. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    @ retched & Sarge
    So any one of you above is planning to draw the circuit for the OP.
    Just let me know, cause I have my hands full right now. It might take a little time from my side to wip up a schema.
     
  8. Belteshazzar

    Thread Starter Member

    Mar 16, 2010
    34
    0
    Thanks guys, I appreciate it.
    I'm checking out the data sheet for the ULN2003 (5V Input series)

    Fantastic...500 mA per channel x7 , I think I just saved a ton of work, space and money not have to use an army of discrete componets...THANKS SgtWookie!

    Now if I can get it to work with the output channels of the CD4017....what a combo
    design.

    On the ULN2003, If I use 5v for my + input means I get an output of 5v? Need 5v for my relay coil. I saw from the data sheet absolute max of 50v output?

    I believe I understand the IC, looks like multiple transistors, with B C and E but can you explain what pin 9 (common free wheeling diodes) is for?

    I will attempt to draw a complete schematic of my intended "push-button sequencial switcher" using transistors first for a basic design...then using the ULN2003A.

    I'll post it soon and maybe you guys can tell me if I am somewhere in the ballpark.
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The basic schematic is attached.

    Only one relay and LED w/resistor is shown for simplicity's sake; the rest are just duplicates of what is shown.

    Note that the Vdd and Vss pins of the 4017 are not shown; but documented.

    Ignore the pin numbers for the relay coil. I do not know which relays you are using; so you can figure those out yourself. If you connect the relay coils up backwards, you will probably damage either the relay's diode or the ULN2803A IC.
     
  10. Belteshazzar

    Thread Starter Member

    Mar 16, 2010
    34
    0
    Thannks for the schematic, I'll start on it immediately. Need to order some parts.

    Attached is the schematic I drew...I worked on it all morning, minus well post it.

    I used transistors instead of the IC.

    A quick question on ICs. Why is Vcc and Vdd used interchangeably in some schematics I seen.

    They seem to be both +V voltage supply?
     
  11. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Vdd is used with FETs for Voltage on drain.
    Vcc is Voltage on collector
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Note that in the schematic I posted, a ULN2803 is used. It is very similar to the ULN2003, except the 2003 has 7 channels, and the 2803 has 8 channels.

    You're welcome. Keep in mind that the quoted 500mA is a maximum rating. It is best to not go above 350mA, or the Vce (collector-emitter voltage) will become quite high, and you will experience excessive power dissipation in the IC.

    The ULN2x0x series ICs (there are a number of them) do not source current, they sink it. You connect your load permanently to +V, and the IC switches the ground path.

    That can provide multiple functions.
    If your load is inductive (like your relays, or motors, solenoids, etc) the COM terminal should be connected to +V/Vcc/Vdd to protect the outputs of the Darlingtons.
    If your load is non-inductive, like LEDs, you can ground it to provide a TEST function to see if your LEDs are all working. However, since you are using it for relays, there must always be a path from that terminal to +V/Vcc/Vdd. Otherwise, when the current through an inductive load is cut off, the reverse-EMF spike will likely kill the output transistors, as it can reach several hundred volts.

    If you wish to include such a test function, then connect a diode such as a 1N5401 or 1N5404 (3A 100v to 400v rectifier) cathode to +V/Vcc/Vdd anode to COM. Then connect a N.O. pushbutton from COM to GND/Vdd. Pressing the button will turn on all of the outputs, independent of the transistors and the inputs.
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, you used the transistors as emitter followers instead of saturated switches. That would not have worked very well, I'm afraid.

    Yes.
    Vdd is when FET, MOS, MOSFETs, CMOS, DMOS are used in a circuit.
    Vcc is when transistors are used in a circuit.
    With Cadsoft Eagle, the software I used to draw the schematic, if you use the same supply name as the IC's being used, the power pins are connected by "air wires" automatically. The standard logic libraries for Eagle don't show the power/ground pins in the schematic capture portion to keep the schematic less cluttered.
     
  14. Bernard

    AAC Fanatic!

    Aug 7, 2008
    4,175
    397
    Think of + voltage markings cc as collector on NPN BJT, dd - drain on N ch FET.
    On Sgt Wookie's PB switch input , the count will be advanced when sw is released as the 4017 counts on rising edge- i think.
     
  15. Belteshazzar

    Thread Starter Member

    Mar 16, 2010
    34
    0
    Thanks, StgWookie for all the explanations in detail, thanks also guys for all the input. I am learning..and at a fast pace thanks to all your help. I'll be getting the chips by mid week...can't wait to start. I am building a "special mutimeter"; part of a diagnostic tool I am designing.

    I have a question, StgWookie, in your schematic at the 5+ power supply input you have 2 caps in parallel, C1 at .1uF and C2 at 100uF.
    Being in parallel, aren't they added...to 100.1uF total? If the supply must have a good 100uF, why the extra fraction of a .1uf. Does it serve another purpose that just the added values? Maybe, 2 caps must be in sequence for a reason?

    And..electrolytic or not? Or it doesn't make a difference.
    I always though filtration and stability comes only by using a electrolytic in a DC power supply...or voltage regulation stability, etc.
     
  16. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The idea is that the large 100uF cap takes care of the low frequency transients, and the small 0.1uF cap takes care of high frequency transients.

    The small cap should be metalized poly film. Ceramic or "green caps" will work. Tantalum will also work. Tantalums have a very low ESR, but can be finicky; they may explode once in a while.

    The larger cap can be an aluminum electrolytic.
     
    Last edited: Mar 21, 2010
  17. Belteshazzar

    Thread Starter Member

    Mar 16, 2010
    34
    0
    I understand.

    My voltage will come from a 12V battery then via a V Reg fixed 5V 250mA, I believe this should be plenty of current for the IC's and all outputs of the 2803 since they will be activated one at a time...around 50mA-70mA per output.
    Now my V Reg calls for a 1uF to 10uf on the output so our C1 and C2 should already take care of this requirement correct?

    On the outputs I would like the availability of all 8 channels, but for now if I need only 6 for example, do I leave pins 7 and 8 NC and/or should leave 8 NC and connect 7 to.....?

    Output Q0 (pin3) on the 4017 is NC, leaving it unconnected will not affect the sequence?..meaning jump one sequence with a delay?

    By the way, thanks for that extra switch 2 to turn off all relays, I wasn't expecting that treat....it will be very useful much for my application!!!!
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes.
    You can cut the 100uF cap back to 10uF if you would like. The regulator should be able to keep up with it just fine.
    Do not assume that you can combine the 10uF with the 0.1uF cap. This is a common error.

    You can leave them disconnected if you'd like. If you want the reset to occur sooner, you can connect the RESET pin to the last used output.

    That is the "ALL OFF" position, right after the 4017 has been reset. Not knowing your application, this was the most safe assumption to make.

    You can use a big red "panic button" connected to the RESET input to turn all the relays off. When the 4017 is reset, pin 1 is the only pin that is high.

    Glad you liked it. Use that with the big red "PANIC BUTTON", and leave Q0 disconnected.
     
    Last edited: Mar 22, 2010
  19. Belteshazzar

    Thread Starter Member

    Mar 16, 2010
    34
    0
    I see, the reset SW2 actually does not turn off all outputs, it resets everything to start the sequence from the beggining. And that by starting from setting Q0 high (on); the IC's first output.
    Thats why you left it disconnected, for an "All Off" option via SW2.
    Is this correct?

    Now I believe I can configure the 4017 at will.

    So, is that so, I should not connect a 10uF in parellel to a .1uF for the frequency transients effect you mentioned priviously with a 100uF together with a .1uF.

    Always a higher uF if in parrallel with a .1uF? (If I want to filter/stabilize the high/low freq)
     
  20. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Right.
    With a 4017 Johnson counter, one output is always high, the rest are always low.
    When power is first applied, the counter may be in a random state; any one of the outputs may be high.

    If you want to make certain that they are all off when you power it up, connect an 0.1uF capacitor from the RESET input (pin 15) to Vdd (+V).

    You can connect either a 100uF or 10uF in parallel with a 0.1uF cap at the output of the regulator. You still need the 0.33uF cap at the input. If you really want to, you could use all three. However, just the 10uF and 0.1uF should be plenty.

    If you find yourself low on board space, you can omit the 10uF or 100uF cap. Your 5v supply won't be as well filtered, but it should work.

    You should always have 0.1uF caps across the power supply and ground terminals of each IC in your circuit. If you leave them out, you will likely have problems.

    You can use the larger capacitors too, if you want. However, you don't want a LOT of large caps on the board, as they can cause problems when you are first trying to power up the board. They can also cause the regulator to fail if the input supply is shorted.

    See the datasheet for more details.
     
Loading...