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.

Multiple light sources from one switch

Status
Not open for further replies.

snboarer592

New Member
Hi Guys, my first post here so here it goes.

I'm in a lighting situation where i want to switch between red, white, and blue lights. They are all going to be mounted to the same circuit board, but i need to be able to select one at a time. Is there a way to wire a three button switch that will activate a respective string of lights, AND (this is where i am clueless) cut out the other lights. if my blue lights are on and i want to switch to red lights, how do i make it so that hitting the red switch turns off the blue or if i'm on white, turns off the white?
 

carbonzit

Active Member
Hi Guys, my first post here so here it goes.

I'm in a lighting situation where i want to switch between red, white, and blue lights. They are all going to be mounted to the same circuit board, but i need to be able to select one at a time. Is there a way to wire a three button switch that will activate a respective string of lights, AND (this is where i am clueless) cut out the other lights. if my blue lights are on and i want to switch to red lights, how do i make it so that hitting the red switch turns off the blue or if i'm on white, turns off the white?

1. Easiest way: get a "radio button"-type pushbutton switch with 3 buttons (sorry, don't know what they're really called). You know, the type that pops out any button pushed in when you push another button. I'm sure these are available somewhere (perhaps others here know where?).

2. Otherwise, you need some electronic logic. Shouldn't be too difficult, using a few discrete gates. I think a microprocessor (PIC, etc.) would be overkill for such a simple application. Again, others here can quickly draw something like this up for you.
 

snboarer592

New Member
Thanks, i'd like to see something more logic-intensive. Not only do i like the challenge, but this controller for my lights needs to be constructed within a footswitch box. I'm just wondering what components i can use to acheive this effect. Ultimately, i want to have a footswitch that i can connect to my lights and control them from a distance.
 

snboarer592

New Member
just as a heads up to other posters, i have a basic knowledge of electrical circuits. I'm certainly open to learning about new things, but talk as "dumb" as you can. I looked up information on logic gates and its pressing on my brain a bit since i've never heard of them before
 

carbonzit

Active Member
just as a heads up to other posters, i have a basic knowledge of electrical circuits. I'm certainly open to learning about new things, but talk as "dumb" as you can. I looked up information on logic gates and its pressing on my brain a bit since i've never heard of them before

Hint: Look up AND, OR, flip-flop, latch, one-shot, inverter. Some combination of these should do what you want. Think of them as building blocks that you can connect together in many different ways, sort of like Legos ...
 
Last edited:

geko

Active Member
I have some code for a PIC12F629 that will do just what you describe, three switch inputs, three outputs; when you hit any switch the corresponding output turns on, the other two turn off.
 

MikeMl

Well-Known Member
Most Helpful Member
How do you turn off all the lights? (Separate switch?)
Which light comes on at power up?
How about a single switch, which just steps from red, to white, to blue, to red,... ?
 

carbonzit

Active Member
OK, here goes.

This is just an idea, mind you. You might laugh at me in my ignorance. That's OK; I'm just learning about these here logic gate thingies.

So what if a guy were to build a circuit like this?

**broken link removed**

The switches are momentary-contact pushbuttons (footswitches seem to be what the O.P. wants). Each would (hopefully) operate a single light or string of lights of a certain color. Closing any switch would turn on the corresponding light and turn off all other lights. The power-on circuit would turn all lights off by asserting all the RESETs on all the flip-flops.

So would this work? Seems fairly simple, not too many parts. Better way to do this? (Please, please don't say "use a PIC".)

OK, now you can start laughing ...
 
Last edited:

Brevor

Member
The basic idea would work, You left out some parts like base resistors for the transistors and pulldown resistors on all the S and R inputs.
Better way to do it ? Use a "Peripheral Interface Controller"
 
Last edited:

carbonzit

Active Member
The basic idea would work, You left out some parts like base resistors for the transistors and pulldown resistors on all the S and R inputs.
Better way to do it ? Use a "Peripheral Interface Controller"

It would work? Really? I'm gratified; it was pretty much a shot in the dark for me, as I've never used flip-flops before. (Well, on my feet, but ...)

So you're still suggesting a PIC? I disagree; I think that's waaaaay overkill for such a simple project. The parts count would end up being nearly the same (not as many diodes, perhaps), and then there's the complexity of coding the thing, loading the code, debugging, where here, you wire the thing up and turn it on.

Question: why do I need pulldown resistors on the flip-flop inputs? Don't they just take a logic high or low input? Again, pardon my lack of experience with these devices. And similarly, why base resistors? I've seen xistors connected directly to PIC ports; isn't that the same thing as here (TTL-level outputs directly into the base)?
 

cobra1

New Member
what about 1 button that is pressed to toggle through the colours?, i.e each press gives RED, BLUE, GREEN, OFF. Any mixture of colours can be added this way with only one Button.
 

carbonzit

Active Member
Well, since you asked, how about this:

**broken link removed**

Using synchronous shift registers; basically, a "1" ripples through them at each press of the switch. Could be expanded to any number of colors.

One problem I haven't solved: at power-on, you need to "seed" the first flip-flop with a "1". That's the box with the question mark in it. As I see it, this mystery item would present a high on its output at power-on, to set the first flip-flop's output high. (It would also have to generate a clock pulse, not shown in the schematic.) It would then go to a high-Z state (tri-state) and stay there, for both data and clock lines, so it would have no further effect on the flip-flops. So what kind of device would do this?

You also might need a one-shot after the switch to limit the length of the switch pulse when someone mashes down on the pushbutton with their foot.

So again, would this work?
 
Last edited:

Brevor

Member
So you're still suggesting a PIC? I disagree; I think that's waaaaay overkill for such a simple project. The parts count would end up being nearly the same (not as many diodes, perhaps), and then there's the complexity of coding the thing, loading the code, debugging, where here, you wire the thing up and turn it on.
Im not sure if your really interested in discussing it but in case you are here's my take on it.
I think everyone should build their circuits the way they feel comfortable with. I would not fault you for building the circuit your way. Here's the way I see it.
Your circuit, 2 4013 flip-flop IC's, 3 transistors, 12 resistors, 9 diodes, a cap for the POR and maybe a bypass cap for the IC's.
Using a PIC, 1 12F629 PIC, 3 current limiting resistors for the leds, 1 pullup resistor and a bypass cap for the PIC. No power on reset circuit needed. I bet I could have it coded and programmed faster than someone could build the other circuit.
But like I said "to each his own"
 
Last edited:

Brevor

Member
Well, I guess you would have me beat on the parts count
Yeah, But parts cost would be about the same.
Im somewhat up to date on this because I actually did a PIC just like this for a guy a few years ago. He was using it in a tester he was building for his job. It had 6 pushbutton inputs and 6 outputs. Each button would turn on it's output and when another button was pressed it would turn on it's output and cancel any other output that was on. As an extra feature you could push the button that was currently on and it would also turn off.
 
Last edited:

carbonzit

Active Member
So nobody answered my question about the circuit I posted above (# 12): what do I put in the box labeled "?" to make it work? I need something that initially outputs a logic high and generates a clock pulse, then reverts to high Z (tri-state). There must be something simple to do this, but I just don't know what it is. Help!
 

mbarazeen

Member
you wanted to operate it form remote...the lights would be far? with some logic or just direct wires? can you show a sketch the location, wire requirement, how many switches etc?
 

snboarer592

New Member
Ok so i've tried to wire up this switch on a breadboard close to a dozen times now, and no matter what i do, all three lights come on and stay lit. So i have a few questions for carbonzit.

What is the rating on the capacitor in the POR?
Should my power source supply both the POR and the switches?
Where does the power supplied to the IC's factor in to all of this?

and to Brevor

Why do i need a bypass capacitor for the IC, resistors before the transistors, and reistors on the S and R pins?
 

carbonzit

Active Member
Here's the circuit I ended up with that works perfectly:

**broken link removed**

Everything above the flip-flops (driving transistors & resistors) is up to you. The flip-flops are dual D FFs. The triangle thingy is a Schmitt trigger inverter (6 on a chip, you only need to use one). Works fine. Switch is any type of normally-open pushbutton.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Top