Please how can I control 4 relays to work one at a time with a push button

Thread Starter

Marceesty

Joined Jul 27, 2019
4
Good day people, please am building a charger with 12v, 24v 36v and 48v tappings. I have a problem of how to make a tapping work at a time with a switch without using Arduino or any other programming tool.
 

dl324

Joined Mar 30, 2015
16,839
You could use CD4017 with a debounced switch for the clock and transistors on the outputs to drive the relay coils.
 

danadak

Joined Mar 10, 2018
4,057
For future reference this is a lot easier to do these days with block programming
languages, like Ardublock, mBlock, Scratch4Arduino, Snap4Arduino....

Basically you get yourself an Arduino board, Nano or Uno, a USB cable, and
download / install one of these languages. Boards are $ 2 - $ 5.

Using the blocks you construct the program, lots of videos on Youtube doing this.
Then you hit upload and tool generates Arduino like C code and programs board.
You can even look at C code generated to start getting a feel for what that looks
like.

Kids 6'th grade and up now using these languages to program robots in schools.

Lots of fun.

The middle window is the library of blocks to select from, right window where you
drag the blocks to and config them.

upload_2019-8-8_8-48-0.png


The above example I think should work for your design. The top portion main
design, part with Arduino block at top, the bottom is a subroutine to turn off all
relays, clrRelays block.

Note the Arduino GPIO pins cannot turn on relays by itself, they cannot supply
enough current, you need to add a simple external circuit to handle this -



Or use one of these low cost boards -

https://www.banggood.com/5V-8-Chann...RM-p-74110.html?rmmds=search&cur_warehouse=CN

There are 4 relay board versions of this as well.

https://www.ebay.com/itm/4-Channel-...jYAAOSwsTxXj8MZ:sc:USPSFirstClass!03054!US!-1

Make sure the board you buy has the resistor pull down on input to board and
diode transient suppression across the relay coil as pictured in above schematic.


Regards, Dana.
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
Changed the program to be a little more efficient using a subroutine to
do the relay turn on rather than a bunch of if-then statements.

upload_2019-8-8_20-24-38.png

By the way, I think it will fit into this to do job.




Regards, Dana.
 
Last edited:

BobTPH

Joined Jun 5, 2013
8,804
You need to describe better what you are trying to do.

It sounds to me like you want to select one of several voltages. A rotary switch would be the usual way to do this.

Bob
 

danadak

Joined Mar 10, 2018
4,057
There's a communications problem here.
Emphasis on the word "future"in my post, no disconnect there.

Just showing ease. flexibility, this can be accomplished with non traditional programming,
for "Future" designs.

Regards, Dana.
 

dl324

Joined Mar 30, 2015
16,839
Emphasis on the word "future"in my post, no disconnect there.

Just showing ease. flexibility, this can be accomplished with non traditional programming,
for "Future" designs.
The OP was pretty specific in excluding Arduino and programming.

A microcontroller based solution still requires 4 transistors to drive the relay coils and a switch. If the OP comes back again and wants a microcontroller/programming solution your response would be relevant, but not before then. That's a communications problem in my opinion.
 

crutschow

Joined Mar 14, 2008
34,280
Below is the LTspice simulation of a CD4017 circuit as dl324 suggested.
I sequences through four outputs for each push of the SW push-button.
The transistor driver must be repeated three more times for four relays total.

The circuit will operate for up to a 15V supply.

upload_2019-8-8_10-4-20.png
 

djsfantasi

Joined Apr 11, 2010
9,156
The OP was pretty specific in excluding Arduino and programming.

A microcontroller based solution still requires 4 transistors to drive the relay coils and a switch. If the OP comes back again and wants a microcontroller/programming solution your response would be relevant, but not before then. That's a communications problem in my opinion.
And nowhere do I see mention of switch debouncing. It’s a significant requirement.

And if that block programming tool includes switch debouncing, it’s not obvious. Hence, a necessary skill is going to be ignored.

That’s a problem, especially for a noobie programmer. If such a basic concept is hidden, the first time the noobie needs to program something on his own, he’s in for (what is called) a rude surprise. I wouldn’t be as critical if in the building blocks were included a construct named “debounce”.

You guys are great! Many good alternatives.
 

danadak

Joined Mar 10, 2018
4,057
The OP was pretty specific in excluding Arduino and programming.

A microcontroller based solution still requires 4 transistors to drive the relay coils and a switch. If the OP comes back again and wants a microcontroller/programming solution your response would be relevant, but not before then. That's a communications problem in my opinion.
Maybe what we really disagree here is about showing people other possibilities, I am certain thats not a desired
outcome here onsite. If a person says to us I want to build a 200A arc welder but use no power, we need to show
that individual other possibilities. Otherwise we are not performing our duty to the community. The good news is
that I regularly see most participants here doing exactly just that, even when TS is asking for an inferior set of
limitations on design. I see parallels now here at AAC when the transition from tubes to transistors occurred years
ago. History does repeat itself, unfortunately. But the good news is that a whole new generation is coming and
micros will be bread and butter for them based on today's, and already many years prior, classroom work. And the
word spreading that anyone who uses a 4 function calculator is already programming.....but I diverge.

A microcontroller based solution still requires 4 transistors to drive the relay coils and a switch.
I concur + 4 diodes + 4 R's Or a one chip quad relay driver with all that inside. The switch of course can be a capsense
solution on UP pin or typical electromechanical as you state.
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
And nowhere do I see mention of switch debouncing. It’s a significant requirement.

And if that block programming tool includes switch debouncing, it’s not obvious. Hence, a necessary skill is going to be ignored.

That’s a problem, especially for a noobie programmer. If such a basic concept is hidden, the first time the noobie needs to program something on his own, he’s in for (what is called) a rude surprise. I wouldn’t be as critical if in the building blocks were included a construct named “debounce”.

You guys are great! Many good alternatives.
The block language solution debounced the switch with the two lines of wait code and pin test
inherent in the two lines of code used. I forgot to add a comment with the word "debounce"
shown. My fault.

There are some block languages that specifically call out a debounce block. And
most videos starting folks discuss the general problem and show solutions for the
issue.

Regards, Dana.
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
Below is the LTspice simulation of a CD4017 circuit as dl324 suggested.
I sequences through four outputs for each push of the SW push-button.
The transistor driver must be repeated three more times for four relays total.

The circuit will operate for up to a 15V supply.

View attachment 183485
I think the slow rise time signal present at the pin with the 1 uF hung off it an issue. Unless
that input is Schmidt conditioned. http://www.ti.com/lit/an/scba004d/scba004d.pdf

I have posted elsewhere on AAC some sims showing the problem.

Lastly does the 4017 power up in a known state ? Glitch free outputs ? Like most UPs do now ?


Regards, Dana.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,156
The block language solution debounced the switch with the two lines of wait code and pin test
inherent in the two lines of code used. I forgot to add a comment with the word "debounce"
shown. My fault.

Regards, Dana.
Thanks for your reply. We’ve had this conversation before. YOU knew that the debounce was included. But, no one else (ok, maybe me) had a clue!

Your post reminds me a a quote Robert Heinlein had Lazarus Long say in his novel, “Time Enough for Love”...

“Never try to teach a pig to sing. It wastes your time and annoys the pig.”​

You are trying to teach pigs to sing and as well as join together in a chorus. Good luck with that!
 

eetech00

Joined Jun 8, 2013
3,856
Good day people, please am building a charger with 12v, 24v 36v and 48v tappings. I have a problem of how to make a tapping work at a time with a switch without using Arduino or any other programming tool.
Hi

So....are you really asking?:

"How can I make a selector circuit, using a single pushbutton, that will allow me to select one of four charger voltages. The four voltages are 12v, 24v, 26v an 48v."

Show a schematic of the existing circuit you've designed, then we can help.

eT
 
Top