Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

one switch three relays....help ??

Status
Not open for further replies.

G-wiz

New Member
Hi all

What i'm looking for is a circuit using a single push-to-make switch. Three outputs will be connected to three relays. When the circuit first powers up none of the relays will be energized. (This circuit will get powered on/off alot) one press the first relay is on, a second press the first turns off the second turns on, and a third press the second off and the third on. with a forth press the third off and the first back on as it starts over again !!!

This circuit will be in a car 12v supply !

Cheers
 
G-wiz said:
. Three outputs will be connected to three relays. When the circuit first powers up none of the relays will be energized. (This circuit will get powered on/off alot) one press the first relay is on, a second press the first turns off the second turns on, and a third press the second off and the third on. with a forth press the third off and the first back on as it starts over again !!!
since ur using switch , u'll need a key debouncer ,may be built around a 555 as monostable , the rest can be done using 4017 ring counter.
 
So the sequence you want is:- power on, all relays released.

Press once, R1 operates.

Second press, R1 releases, R2 operates.

Third press, R2 releases, R3 operates.

Fourth press, R3 releases, R1 operates, etc.

Or do you want them all released at the fourth press?

It will cause some complications if you want R1 to operate at the fourth press. It is easier if the fourth press brings it back to the initial state, ie. all released.

Incidentally, for 4 states, you really only need 2 relays.
 
One 8 pin PIC, three relay driver transistors, one PB switch, a few resistors - job done, with a little programming. No problems whatever sequence you want to add - and much smaller than a hardware solution!.
 
ljcox said:
So the sequence you want is:- power on, all relays released.

Press once, R1 operates.

Second press, R1 releases, R2 operates.

Third press, R2 releases, R3 operates.

Fourth press, R3 releases, R1 operates, etc.

Or do you want them all released at the fourth press?

It will cause some complications if you want R1 to operate at the fourth press. It is easier if the fourth press brings it back to the initial state, ie. all released.

Incidentally, for 4 states, you really only need 2 relays.

It would be fine if all relays realeased on the forth press, in fact it would probably be better. Any idea's ? Need a diagram, and component part numbers, as i'm ok building the circuit, but not as clued up as most of you lot !!!! Thanks

Nigel, the PIC idea sounds like the best soloution but you have passed my scope of understanding !
 
Sometimes it is fun to see how much functionality you can get out of a small microcontroller. Nigel's solution will fit perfectly into a PIC10F in a 6-pin SOT-23 package.

GP3 is input only so it can be used with the push button. It even even has a software selectable pull-up resistor which further reduces your external part count. All debouncing can be done in software. You can also program any activation sequence you want and in any order that you want.

GP0, GP1, and GP2 can directly drive logic level MOSFETS which will control the relays.

Throw in a cheapo 5V regulator and a decoupling capacitor and you will be good to go!
 
phalanx said:
Sometimes it is fun to see how much functionality you can get out of a small microcontroller. Nigel's solution will fit perfectly into a PIC10F in a 6-pin SOT-23 package.

GP3 is input only so it can be used with the push button. It even even has a software selectable pull-up resistor which further reduces your external part count. All debouncing can be done in software. You can also program any activation sequence you want and in any order that you want.

GP0, GP1, and GP2 can directly drive logic level MOSFETS which will control the relays.

Throw in a cheapo 5V regulator and a decoupling capacitor and you will be good to go!

You make this sound so easy, but I wouldn't know where to start. Any pointers would be greatly appreciated.

I really need to learn this stuff, sounds like every thing i want to do, is easily done with a PIC. ??
 
G-wiz said:
You make this sound so easy, but I wouldn't know where to start. Any pointers would be greatly appreciated.

I really need to learn this stuff, sounds like every thing i want to do, is easily done with a PIC. ??

Once you understand the underlying concepts of microcontrollers it really is that easy. Nigel has excellent tutorials on his website which will help you get started with PIC microcontrollers:

If you can understand the combinational logic necessary to get your relay system working using discrete parts, learning MCUs should be a piece of cake!
 
G-wiz said:
You make this sound so easy, but I wouldn't know where to start. Any pointers would be greatly appreciated.

I really need to learn this stuff, sounds like every thing i want to do, is easily done with a PIC. ??

It is easy, at the expense of a little programming (which doesn't take long to learn) you can greatly simplify the hardware, yet add extra functionality.
 
G-wiz

Think of the microcontroller as a custom chip and you design the inside of it (what it does) with software. There are small inexpensive ones (50 cents) and as you have bigger projects you move to the larger ones. And you will use the same language in most cases. Pick a programmer that supports as many chip as you can in that line (like the PIC line) and get a language you like and invest in a compiler (look on google for pic assembler, pic basic and pic C source code samples). Then you are on your way.

Also, there are a number of basic compilers out there that might be a good start for you, as that language is an easy start... Easy to read and less typing in most cases.
 
It is easy, at the expense of a little programming (which doesn't take long to learn)


Well, THAT gives me confidence. I've decided to go the PIC way, bought the programmer (Velleman K8048 - because I didn't have the time to build one), and then realised that I know n-o-t-h-i-n-g on how to ermmm...program them! Oops! But now I feel confident....ish. :confused:

Slightly off topic, sorry.
 
OK, I know this late but it could be done with a cd4017 and some switch debouncing. The 4017 is a decimal counter with individual outputs. The switch, with debounce would be the clock input and the "4" output resets the 4017. You'd need driver tansistors for the relay coils. There are lots of switch debounce circuits out there. let me know if you want to persue this approach.

I'd do it this way if the pic approach is too daunting. (programmer, circuits, programming, assembly language)

Of course, the PIC approach is how I would do it since it is very flexible. But then I have everything to do it and the experience needed. Steep learning curve but it is pretty worth while if you have other similar projects you want to do.
 
I'm still just looking at my programmer at the moment, lying acrylicly caged on my desk. It stares back at me, pining to be built and powered up. Problem is though is not the building, but the food I need to feed it with, known as 'code'.

Hmmm? 'Me ponders a bit more, me does'.

I wonder if anybody has built a human brain download interface yet and put it on this site? :) Learn whilst I sleep.
 
do you know C or any other high level programming language? If so, I'd recommend you get the mikroC system. It's not a very good compiler but the environment and library is pretty good. It's quite easy to use. Oh, yeah, its free for up to 2K of program code. You will barely need 1/10th of that.

They also have a pic Pascal but I've no idea about the quality. I think it is free for up to 2K also.

I don't know of any free Basics for the PIC but there may well be one.
 
mikrobasic is a PIC Basic...

I often wonder if it is cost effective to use microcontrollers for ayery thing... People who are good at at advice newbies to use them... The newbie might be comfortable with descrete ICs and I agree that the initial learning cure is steep... I am experiencing it...

Forget the cost... What about the efficiency? I think peopel do not care if they use only 10% of the controler's computing power for a simple task as long as it is simple to design and uses less components....

One analogy that comes to my mind is that of a paper weight.... We could use a nice rock as a paper weight... Or we could place the bulky washing machine to prevent the paper from flying away.... Both served the same purpose... Which do you prefer?

I am more compelled to equate the microController with the washing machine... May be once I am good at it, I might think like others who advice in favour of PICs.... :?:
 
While I suggested a non-uC approach, in general, I believe that uCs will more often than not be the better solution. A PIC12F509 costs around $.90 and gives you 6 I/O pins. while a single 555 costs around $.30 (plus Cs and Rs), when you get to a couple of ICs, you've exceeded the cost of the uC.

But the real benefit is the flexibility. You can, essentially, produce any output based on any input. and change it when ever you want. ICs, you are pretty much stuck with changing components.

I see the uC as a tool for the modern engineer and hobbiest. I would not recommend a uC solution to some one who will only build one project. The entry cost (not large but still many times the cost of the uC) is one factor, learning curve is another. But once you have the tools and have gained competence, the projects become amazingly easy to build.
 
G-wiz said:
You make this sound so easy, but I wouldn't know where to start. Any pointers would be greatly appreciated.

Your objective is to learn PIC programming and build the device to control the relays. Don't expect this to happen within short period of time as there will be a steep learning curve, weeks perhaps. There are more informations in the sticky of this forum and please go and have a look.

Have you bought some PICs chips yet? If so, what are they? You will also need a voltage regulator(78L05) to power the PIC(it needs +5V).

If you have not ordered any PICs, then get two each of 16F628a and 12F675. But hold your order until we know more information.

There are very simple hardware programmer that enable you to program a PIC, or you can buy one cheap from EBay.

The relay control program is easy and many here can provide you with a working "code" to let you build the relay project first. PIC self learning then follows, if you are still interested.

Edited by eblc1388: Posting corrected to address to G-wiz.
 
Last edited:
Hey, I agree. I'm used to building some pretty complex circuits (mainly for broadcast camera's), but since I've looked at the PIC method, I've wondered if using a PIC has an advantage. After all, using a 555 timer method is cheap. However, using a PIC to do the same job seems to cost a lot more (maybe I'm wrong?).

As you say Lord Loh, once it has been mastered, then my views will no doubt change. My only big hang-up at the moment (apart from programming them) is WHAT chip to use for what purpose. Hmmmm? It's a bit like learning electronics all over again (I started at 10 years old in 1974).
 
And one of the biggest block that a new learner finds is how to programme it... Serial Programmers are easy to build and softwares are free... I had the same notion until I saw an AVR pod burner that used 2 resistors a few diodes a capacitor and a ZIF socket to burn a whole family of AVRs... I made one(pod burner) though I do not know it's assembly language yet...

But now that I have a berner, I am not afraid to think of writing a programme for microcontrollers.
 
eblc1388 said:
Your objective is to learn PIC programming and build the device to control the relays. Don't expect this to happen within short period of time as there will be a steep learning curve, weeks perhaps.

Did you also bought some other PICs chips along with the programmer order? If so, what are they? Also tell us more what relay coil voltage/current you are going to use and how would you provide power to the PIC(it needs +5V).

If you have not ordered any PICs, then get two each of 16F628a and 12F675. But hold your order until we know more information.

The relay control program is easy and many here can provide you with a working "code" to let you build the relay project first. PIC self learning then follows, if you are still interested.

I would skip the 8-pin 12F675 and recommend an 18-pin 16F628A and the 8-pin 12F683, the latter with 2-kwords program memory, an 8-MHz INTOSC, and a Timer2 peripheral...

Kind regards, Mike
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top