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.

Need a circuit for a game.

Status
Not open for further replies.

blort1961

Member
This is going to be difficult to describe…so Ill do it in point form to hopefully keep it simple:

-I require a circuit that runs on dc (any voltage)

-Its for a game

-I have a series of 5 pegs

-The idea is that 1 peg is randomly selected by the circuit to be “active”.

-when the “active” peg is removed, a relay closes.

-eventually, all pegs are put back in place…the relay opens

-a button is pressed, to once again select a random (and unknown) peg…and so on

I was thinking something along the lines of a 555 driving a 4017, driving a modulated series of infrared leds mounted on the peg sleeve. A infared receiver is mounted opposite the emitter, with the peg body normally blocking the Infared illumination. Once that peg is removed on the “active” emitter/receiver, it activates a relay.

The pegs are all returned into their sleeve, the button is pressed, AND the 4017 stops on another transmitter/receiver pair…and so on.

I was only thinking using infared leds, so they will not be bothered by ambient light.


So whatcha think?. I don’t really want a cuircuit that runs on a Microcontroller, I prefer good, old fashioned Ic’s.

Thanks in advance.
 
You have first to describe your problem as a state machine. Then you have to write the boolean equations for the state machine and minimize, via Karnaugh maps, those equations.
Then implement the minimized equations via gates and flip-flops.

For your requirement to run on any voltage DC, what does this exactly mean? That it should run from 1 to 1000 volts, or something more reasonable, like 5 to 12 volts?
4000-series CMOS logic runs from 3 to 15 volts, but I would still use a low cost 78xx regulator.
 
1. By pressing the button, the circuit randomly selects an active peg with no indication of which one it is.
2. The player starts removing pegs one at a time.
3. There is no indication when an inactive peg is removed.
4. When the active peg is removed, the relay closes to do something.
5. When all pegs are returned, the relay opens.
6. If all pegs are returned AND the button is pressed, the game restarts.

Yes ___

No ___

If yes, you need a 5-input AND or NAND function to detect when all pegs are in, five individual 2-input AND functions followed by a 5-input OR function to detect when the active peg is removed, an oscillator, and the ever-popular 4017. Note that I'm talking about functions, not actual logic gates. Except for the 4017, everything can be done with a small number of discrete transistors. For example, the 5-in NAND can be an 8-input gate in a 14 pin package, or five 1N4148 signal diodes and one 2N4401 transistor, or five sections of a ULN2003. Not automatically the right way to go, but neither is a fist full of CMOS.

All of those Karnaugh-state-boolean thingies notwithstanding, you have only two things to resolve with logic: a) that the active peg has been removed; and b) that all pegs are back.

There are a lot of ways to detect the pegs. With optical you have to make sure the light from adjacent pegs doesn't confuse the sensors. One way to do this is reflective. There are single-piece reflective sensors with an LED and phototransistor that have a very short detection range. Put a little aluminum foil on the bottom of a flat peg and you can sense when it is within 1/2 inch of the sensor. Or have the peg push one springy piece of metal into another as a leaf switch. Or buy a $1 limit switch with a leaf arm, mount it vertically, and have the peg actuate it as it slides by. That's probably the most reliable if you can control the diameters of the peg and its hole so there isn't much axial wiggle. It's like plugging headphones into a jack, but without the high insertion and extraction forces.

ak
 
Sounds good, you will need to shade the leds and photo devices from sunlight as they might get saturated, but that shouldnt be hard to do.
Lever operated microswitches would be even simpler if the pegs are a reasonable tight fit without much slop.

I put something like this together at school for a fete, it was sort of a large piano keyboard with the 'keys' vertically, you threw a bean bag at the 'keys', if you hit the key that was active a car air horn sounded and you won a prize, no 4017's and 555's then though, the control was done through a cam timer, however the technique is very similar to what you describe.
 
What's all this globbity gook about Boolean state machines and Karnaugh maps? Ya trying to send the guy screaming and running into the night? Analog's solution sound about right.
 
For visual effect and playing with optical sensors it's a great idea, but couldn't the pegs and optos simply be replaced by just 5 push-buttons, a random one of which is 'active' at any time?
 
You have first to describe your problem as a state machine. Then you have to write the boolean equations for the state machine and minimize, via Karnaugh maps, those equations.
Then implement the minimized equations via gates and flip-flops.

For your requirement to run on any voltage DC, what does this exactly mean? That it should run from 1 to 1000 volts, or something more reasonable, like 5 to 12 volts?
4000-series CMOS logic runs from 3 to 15 volts, but I would still use a low cost 78xx regulator.
 
Ok to answer some of the questions that have been put out there
-Voltage can be any common dc voltage...I can assume if its using logic it will be 6VDC with a 5 Volt regulator. If it needs to run on 9, or 12 volts, I can accommodate that.
Dont get too hung up on the mechanical peg removal...if I have to use mechanical switching with maybe a microswitch that's fine. I only specified infared because I thought it would be easy, and would have better spurious light rejection. Plus, there are plenty of IR transmitter/receiver units available, cheaply.
As far as Boolean logic and other theories...ya got me stumped there...I was hoping nice and simple good old fashioned 2n222's, 555's,4017's...sort of along those lines.
 
Nothing wrong with 4017's.
There is lots of infra red in sunlight, and some in artificial light, so you need to provide just a little shade to prevent direct light.
 
Is the description of the operational sequence in post #4 correct?

ak
 
If you can define your problem in a state diagram, you've half of your problem resolved.
See the following sample image:
runstatediagram.gif


Since most likely it will be a very simple diagram, you may not require to perform Karnaugh mapping.
 
Yes, the posting #4 seems to have the sequence correct.
Im sorry Shmidt Trigger...I don't have the intelligence to follow your diagram correctly.
And if I do yuse some sort of optical sensor, I will shade ip properly from spurious light.
I have many reflective sensors in ye olde parts, so I could always use them...but if something mechanical, like a microswitch makes the design easier, then I can work with that.
The mechanical aspect has yet to be designed...so I can accommodate pretty much anything.
Thanks for all the replies so far
 
Last edited:
What's all this globbity gook about Boolean state machines and Karnaugh maps? Ya trying to send the guy screaming and running into the night? Analog's solution sound about right.
No, I'm not.
I'm only saying that, if he really wants to really understand digital design, hopefully he must (probably not today, but someday) study the basic design techniques.
 
Here is my first pass. It will run on anything from 5 to 15 V. From deep in my sordid past, I like using resistor networks as combination gates. RP1/Q1 function as a 5-input NOR gate; if any input goes high, the output goes low, and makes up 1/2 of the relay power circuit. RP2/Q2 acts as a 5-input NAND; if any input goes low, the output goes high, and completes the relay power circuit. U2A is the oscillator, running over 100 kHz for as long as the button is pushed; should be random enough.

Note - parts are from my design library to show the concepts, and are not critical. There is no need for 1% tolerance resistors, or that specific relay. I used a DIP-switch package to emulate the five peg switches or sensors. I think microswitches will give you the least grief.

ak

Note: No Karnaugh maps were created or destroyed in the process of this design.

Peg-Game-1-ch.gif
 

Attachments

  • Peg-Game-1-c.pdf
    15.4 KB · Views: 124
Last edited:
Analogue...Holy Bat-S&%$! that's beautiful. A elegant, yet simple design. I may be pushing the freebees, but can you redraw it using opto emitters/detectors instead of the switches.
I thank everyone for there input, and I really thank Analog for taking the time and skill to do this...ABSOLUTELY BRILLIANT!
It may take me a bit to prototype this, as I am a busy guy...but when I do...I will let you know.
Kim
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top