# Need help designing a circuit...



## mick4state (Jun 4, 2007)

The circuit needs to have 5 switches, each connected to a light, presumably LED. It can have any number of batteries or gates or anything, as long at it does the following. When the first 4 switches are thrown, their respective lights turn on. But the 5th switch (whichever of the 5 it happens to be) is thrown, that light does not turn on. More or less, it's a way to determine which operator had the slowest reaction time... kind of. I've played with gates and circuit boards and I just can't figure it out. Ideas?

Thanks.

-mick


----------



## cwwozniak (Nov 29, 2005)

Without going into a whole lot of details, here is one possible way ...

- Have one side of all five switches (momentary is good) tied to a logic line that can be enabled or disabled via a separate control line.

- The other side of each switch goes to an S-R latch such that the latch gets set if the input line to the switch is enabled and the button is pressed.

- The output of each latch lights the matching LED for the switch using a buffer if needed to get enough current

- The output of each latch goes to a set of full adder gate combinations that counts the total number of switches that were closed.

- When the count reaches 4, the decoded adder output disables the common line going to all five switches. This prevents the fifth switch from activating its S-R latch

- Add another switch to reset all the S-R latches in preparation for the next round.


----------



## mick4state (Jun 4, 2007)

Wow. It seems simpler than I thought it would be, but I'm having a terrible time drawing it up for some reason. With the switches in OFF by standard, then by turning on they send the 1 signal to the SR latch input, but what goes to the other input? And which output goes where? Do the other lights stay on after the 5th button is pressed? Sorry to be so confused... this is really not my strong area here. Thank you immensely though.

-mick


----------



## bdimag (Apr 8, 2001)

I was thinking in my head - theres gotta be some way to count stuff in circuitry...

I don't know a thinh about the subject really.. but i tried to google a little.. atleast somebody knows what up.

cause my next guess would be 3 not gates for each switch - pair up the other 4 switches into not gates (NAND) and the outputs of the 2 gates to other gate, then to the LED..

which is like 15 gates.. *shrug*

and yes im making this up as I go..


----------



## cwwozniak (Nov 29, 2005)

mick4state said:


> With the switches in OFF by standard, then by turning on they send the 1 signal to the SR latch input, but what goes to the other input?


The Reset inputs for all 5 S-R latches get tied to a sixth "reset" switch that will apply a logic "1" and turns off all the lights. This gets the system ready for the next reaction time test



mick4state said:


> And which output goes where?


The Q output would go to the adder circuit that counts the number of Q outputs that are high. Since the Q and /Q outputs are complimentary, which one you use to light the LED would depend on how the LED is wired and if any inverting buffers are used to drive the LED. The end result is you need the LED to be lit when the Q output is high or the /Q output is low



mick4state said:


> Do the other lights stay on after the 5th button is pressed?
> 
> Thank you immensely though.


The lights for the first four buttons will remain lit both before and after the fifth button is pressed. The first four players to press their buttons do not have to keep holding their buttons down to be counted. The only way to turn off the LEDs would be to press the separate reset button.

If you do not want to use a separate reset switch and people will be holding their buttons down the whole time, you could detect when all buttons are released and trigger a one-shot to reset all of the S-R latches.

And you are very welcome. :up:

By any chance, is this for a school project or test? I have seen a couple of posts on newsgroups for other types of simple "game" logic circuits where people seemed to have posted the test instructions verbatim. It's one thing to ask for suggestions, but these people were expecting others to supply fully documented schematics for them.


----------



## bdimag (Apr 8, 2001)

how was mine though? would I pass the test if I ever had to take one?


----------



## cwwozniak (Nov 29, 2005)

theoneandonlybd said:


> how was mine though? would I pass the test if I ever had to take one?


Just using gates without any type of latching could work as well (and might actually be a bit simpler from a hardware standpoint). I believe you would only need Five 4-Input NAND gates to detect every possible combination of 4 buttons being pressed (or switch being flipped on) The gate that gets activated would then turn off the feed to the fifth switch (that is not connected to the gate). This would prevent that switch from activating any additional gates. and lighting their own LED.


----------



## bdimag (Apr 8, 2001)

ya know, wiki said 1 or more inputs, but then their tables only showed 2 inputs - so I wasnt sure if there were 4-inputters.. although i am making this all up as i go, I didnt want to sound like a fool


----------



## bdimag (Apr 8, 2001)

so what, B-? sweet


----------



## cwwozniak (Nov 29, 2005)

theoneandonlybd said:


> so what, B-? sweet


Yes, It could be done with simple gates as you suggested. I did some sketching of possible circuits.

Just using five 4-Input NAND gates without any type of latching would would provide the needed detection of the first four people to close their switch. You would need some type of buffer/driver with enough current output to drive the LEDs.

The only down side of using gates would be if one of the first four people released their switch after the fifth person pressed theirs, they would end up being the one without the lit LED.

EDIT: Just noticed that some type of pull down resistors would also be needed for the gate input lines


----------



## bdimag (Apr 8, 2001)

cwwozniak said:


> The only down side of using gates would be if one of the first four people released their switch after the fifth person pressed theirs, they would end up being the one without the lit LED.


good point. I'm going home


----------



## JohnWill (Oct 19, 2002)

Time for a $1 uP, something like a PIC processor.


----------



## mick4state (Jun 4, 2007)

In all honesty, my friends and I were playing a game where the slowest reaction time gets shocked, and we were wondering what circuitry would be involved in this game. We also wanted the last person to not get shocked, but rather simply be determined. 

-mick


----------



## mick4state (Jun 4, 2007)

I'll draw up a schematic and post, because I'm not 100% sure I'll get it right.

-mick


----------



## mick4state (Jun 4, 2007)

I think this is how to post a picture...

This is all I was able to figure out. Help from here?










If that doesn't work... try here

http://i2.photobucket.com/albums/y33/standingonatoilet/circuit.jpg

Thanks

-mick


----------



## mick4state (Jun 4, 2007)

cwwozniak said:


> The only down side of using gates would be if one of the first four people released their switch after the fifth person pressed theirs, they would end up being the one without the lit LED.
> 
> EDIT: Just noticed that some type of pull down resistors would also be needed for the gate input lines


You could do this one with the type of switch that clicks on, then off... like interior car lights. The push turns it on, and leaves it on. It would work. I like it, but still like the original idea too. I'd like to see a schematic for the new one because it's confusing me a bit. I just wanted o point out that you wouldn't have to hold down your switch to keep it on.

-mick


----------



## bdimag (Apr 8, 2001)

this whole time i was thinking about that shocker game.. You act like its a strong shock lol..


----------



## cwwozniak (Nov 29, 2005)

mick4state said:


> This is all I was able to figure out. Help from here?


- Having one side of the player switches all tied to ground (negative of battery) is a good idea.

- Did not see anything in the schematic that would keep the last person from activating their latch and light.

- With the grounded switch configuration, you would need to use a suitable S-R latch that triggers on a logic low. An S-R latch with some type of control line input could be used with additional circuitry to inhibit the last player for activating their latch.

- As far as I know, the unused /Q outputs of the S-R latches should not be connected to ground.

- Not sure about your reset switch/circuit. It looks like a direct short between the left and right sides.

- Not sure about your adder circuit. I have never seen any kind that goes is series with the power source. With the correct gating, no adder of any type would be needed.

EDIT:
- If you are using latches, then you probably do not want a push-on / push-off switch. A simple momentary contact type would do and the latches would remember that the switch was pressed.

Sounds like you may need to find someone that can design the whole thing for you by selecting the correct components and drawing a complete schematic. That person could take it as far as *JohnWill* suggested and design the whole thing witn a single chip micro-controller.


----------



## JohnWill (Oct 19, 2002)

I'm lazy, and one chip solves the whole issue. There are many single-chip uP models that drive LED's directly, as well as have switch inputs, even debounce logic built-in. It's then a trivial exercise to code up the application.


----------



## mick4state (Jun 4, 2007)

Cwwozniak, If I called you my hero would you draw one up with corrections?

-mick


----------



## cwwozniak (Nov 29, 2005)

mick4state said:


> Cwwozniak, If I called you my hero would you draw one up with corrections?


Mick,

Sorry to say I don't have enough free time to take on such a project.


----------



## mick4state (Jun 4, 2007)

JohnWill said:


> I'm lazy, and one chip solves the whole issue. There are many single-chip uP models that drive LED's directly, as well as have switch inputs, even debounce logic built-in. It's then a trivial exercise to code up the application.


Sounds easier, but I like at least a small challenge, and I actually think this way will be easier for someone not so electrically-savvy like me. I'm going with the 5 4-input NAND gates design, using pushon-pushoff switches to solve the problem of having to hold down your button the whole time. I like this one because it's only 10 parts other than LEDs and a battery, and I can intuit it the easiest. I had trouble finding SR latches and 4 adders (not to mention figuring out how to make the adder work) within a reasonable shipping distance. I did like the reset switch one though, and still do.

My only question... Does a logic 1 equal current? ie - If there is current, will it interpret this as a 1? ...OR... Will a logic 1 light up a light bulb? I will have a battery, but I don't know if logic lines and electricity lines are different here...

-mick


----------



## JohnWill (Oct 19, 2002)

You could add F/F's at the output of the NAND gates to latch the button, so that you don't have to keep it held down. 

Logic "1" can be high or low, depending on where you are in the circuit.

This is not difficult to design, but it does take time to actually draw it out, and most folks here are not willing to spend that much time on a single request. Sad to say, I'm one of those folks, there's no way to spend upwards to an hour on each request that comes in, I'd have time for very few posts in that case. If I were you, I'd tinker around with a couple of buttons and gates and figure out the logic, then you can build the full circuit.


----------



## mick4state (Jun 4, 2007)

Where's the best place to buy gates? Having a terrible time with that.

-mick


----------



## cwwozniak (Nov 29, 2005)

If you are in the USA, on-line companies like Mouser or Digi-Key may be possible sources. Their minimum order $ amounts may be a problem though.

Our high speed Comcast Internet connection is having major reliability problems today. Something to do nationwide with static IP routing issues. I may not be doing to much posting here today.


----------



## JohnWill (Oct 19, 2002)

cwwozniak said:


> Our high speed Comcast Internet connection is having major reliability problems today. Something to do nationwide with static IP routing issues. I may not be doing to much posting here today.


Two words: Verizon FiOS.


----------



## JohnWill (Oct 19, 2002)

mick4state said:


> Where's the best place to buy gates? Having a terrible time with that.
> 
> -mick


You probably want to find someplace that still has DIP logic, since they're be a lot easier to construct your project with. They're pretty obsolete nowadays, but I still have drawers full of them.  I did a lot of wire wrapping in my day, still have a couple of pieces of test equipment I built when I needed them. Amazingly, after more than 20 years, they still work too!


----------



## cwwozniak (Nov 29, 2005)

JohnWill said:


> I did a lot of wire wrapping in my day


Me too. I did cheat a bit and used "Slit-n-wrap" that saved time by not having to cut and strip each piece of wire.


----------



## JohnWill (Oct 19, 2002)

I use the standard method, though I have a couple of the Gardner-Denver wirewrap tools.


----------

