Help with one button relay input switching

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
You can use PNP but then everything is backwards so to speak.

The emitter goes to VCC.

The collector goes to the relay coil (+ side if any)

The other side of the relay coil is grounded.

The base needs a low value resistor in the hundreds of ohms range and turns on the relay by taking that resistor to ground or below 0.6v, opposite of the NPN version where the relay turn on by taking the resistor to V+.

You should pull the base up to VCC with about 47K to make sure it stays off when expected to.

You still need the diode with the anode to ground and the cathode to the PNP collector.

If still using the 4017, now you need and inverter for each relay driver. Far better IMO to just buy some 2N3904's. They cost pennies.

Thanks for the explanation. I'll just pick up some 2N3904's! The relay input board I'm using already has a diode for each relay (see the link in my first post) do I need another diode?
 
Missed your reply yesterday.

As the others have said, the transistor has to be NPN for simplicity.

You could use two PNP's plus another resistor per relay but then you more than double the component count.

No problem, I'll get the NPN's.

Just to clarify- I connect one lead of the a 5,6K resistor to pin Q1 on the 4017 and the other side of that resistor to the center lead of the transistor. One of the remaining transistor leads goes to ground and the other to one relay V+ in. Repeat for Q2 and Q3 and connect the reset on the chip to Q3. Right?


Thanks
 
Administrator
Joined 2007
Paid Member
Middle legs, left legs, right legs... no no no :) I can't work like that :D

Look at the data sheet for the transistors you are going to use. The base of the transistor connects via a resistor to the desired output pin of the 4017.

2N3904 Data Sheet

The collector of the transistor goes to the positive voltage supply.

The emitter drives the load, your relay. It is important to get the relay the correct way around if it has an integral diode. Get it wrong and the diode will short the supply out as the relay operates.

You should try rigging up one relay to the supply and make sure it works OK. Just one relay, one transistor and one resistor.

Then wire it to a transistor and make sure that the relay clicks on and off as you connect a 5k6 resistor from the base to the positive supply.
 
The 2003 is simply an array of transistors connected in a Darlington configuration. Its an ideal solution if you want to go that route.

The common diode pin of the chip would connect to the ground pin.

Ok, just so I'm clear.

The 2003 does need a logic input, correct? But no additional parts?

The 4017 doesn't need the Arduino, but will require a number of discrete parts.

It does sound like the 2003 might be the simpler, cleaner solution.
 
No Arduino needed for any for this.

Yes, the 2003 needs a logic input in the 5 to 15 volt range. No other parts needed for the 4017 beyond the switch and a resistor.

Ok I'm confused now. I thought the 4017 needs a resistor and transistor for each input?

Also, what would I use for the logic input for the 2003 if not Arduino?

Sorry that I'm not getting this, but using IC's is all new to me.
 
And don't forget the simplest solution of all. A four way rotary switch connected to the relays or four push buttons connected to another equally simple logic circuit.

I may end up just going this route. I have the selector that came with the input relay board and it works fine. I was just wanting to have push button selection, but I didn't realize it was going to be such a hassle.
 
Administrator
Joined 2007
Paid Member
The 4017 is a stand alone 'decade counter' chip. You wire it so that each push of the button advances the count by 1 thus changing the output pins in turn from a logic zero to a logic one. Only one of the output pins is ever high at any one time.

The transistors (or 2003) connect to each output pin to enhance the current capacity of that output and so allow it to drive a relay.

Here is another circuit that I think member Lineup posted years ago. I've never tried this one but it looks reasonable. This uses four buttons, one for each input.

You can also do something like this with a 4017... something I have done successfully.
 

Attachments

  • Input Selector using 4028.JPG
    Input Selector using 4028.JPG
    66.3 KB · Views: 179

PRR

Member
Joined 2003
Paid Member
...If you want a single pushbutton to cycle through the 3 relays then you need a microprocessor....

It is possible to do the job with just relays.

It aint easy.

It does not help that this field has been forgotten since PLCs were discovered.

What would usually be done is a Ratchet Relay. Each pulse worked a rotary ratchet. Cams on the rotary shaft pushed contacts. The most common are 2-state. I have one here. Attached old and new styles. They are used in France (nowhere else!) for light control. See also Omron G4Q-212S. Mine (most) is actually 4-state. ON/OFF repeats twice each revolution. A custom cam and different contacts would give a 4-choice repeating. There's usually 2 cams so some thought would give 6 choices in 2 revolutions, which can give essentially 3 choices repeating.

There are also "pure relay" techniques. Relays can do AND/OR/NOT and thus can do anything a "computer" (microprocessor) can do. If you have enough relays, enough time, and enough brain-pain. Some cheat-tricks may simplify the work. The old circuit below is a 2-state flip-flop. It "cheats" because while the button is pressed, each relay must hold with half voltage. If the supply is full nominal voltage, nearly all relays once-pulled will hold-in with half voltage.

For decades, elevator controls did very elaborate logic with only relays.

A flip-flop can always be extrapolated to any count. Just need more of them. Being binary beasts, the next number past 2 is 4, and at-least double complexity. A 4-count can be short-cut to a 3-count but that needs even more parts (in this thread I would just add a dummy input "for future expansion").

Oh, absolutely: relay sequencing is today the HARDest way to do it. For the basic function wanted, a 3-throw rotary is sweet, a '4017 will take a (debounced!) push-button, a BASIC Stamp can do more than is asked without months of study.
 

Attachments

  • onof2a.png
    onof2a.png
    5.1 KB · Views: 174
  • s-l300.jpg
    s-l300.jpg
    14 KB · Views: 175
  • F2106633-02.jpg
    F2106633-02.jpg
    26 KB · Views: 152
Last edited:
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.