Circuit for trivia game

Thread Starter

candro

Joined Aug 2, 2014
15
I have a small system I made for playing Trivia. It consists of 3 momentary contact switches and some relays. Three players play at the same time much like Jeopardy. Each person has a switch. When a player know the answer to the question he/she presses their switch and illuminates a light in front of them. I have the circuit wired so that the other players are "locked out" until the circuit gets reset.

What I would like to do is have a circuit that would allow the "lock out" but remember the sequence in which the switches were pressed.

Example: If player 1 presses their switch first, player 2 presses their switch second, and player 3 presses their switch third I would like to see a light illuminated for player 1. If player 1 gave a wrong answer to the question I would like to press a reset, turn off the light for player 1 and then have the circuit automatically illuminate a light for the next player in the sequence. In this example it would be for player 2. After the completion of a round the circuit would need to be reset for another question.

I hope this makes some sense. Suggestion will be greatly appreciated.
 

Thread Starter

candro

Joined Aug 2, 2014
15
I don't want to spend an arm and a leg for the project. Whatever works for the least cost is okay with me.
 

AlphaDesign888

Joined Jul 27, 2014
193
I don't want to spend an arm and a leg for the project. Whatever works for the least cost is okay with me.
Well, personally I'd use an $1 microntroller. Something like an PIC16F628a
And I'd write firmware for it in C.
Begin by making an requirements list in dot form.
 

Thread Starter

candro

Joined Aug 2, 2014
15
Thanks for the info. I think me trying to program in C is not an option. I can follow a schematic and could wire a circuit board.
 

AlphaDesign888

Joined Jul 27, 2014
193
Thanks for the info. I think me trying to program in C is not an option. I can follow a schematic and could wire a circuit board.
Your project is custom. You won't find anyone on here that will have an schematic to hand you. I mean you might but I wouldn't hold my breath. It is a few hours labor to draw up an schematic for what you require using discrete parts.

It would take me one hour to write C software though. C is the way to go for something like this. Your project is all logic.
 

inwo

Joined Nov 7, 2013
2,419
I have an idea for a relay partial solution.:confused:

Let me draw it up, to see if it expands to impracticable.:D
 
Last edited:

inwo

Joined Nov 7, 2013
2,419
First attempt.

Up to OP if it's too complex to be practical.

There may be timing issues. :confused: Ties? More interlocks?

If someone had a relay sim program it would be helpful. I'm not up for building it.:eek:

Also may give some ideas for a chip solution.

If it falls apart during my explanation, I'll have to start over.:D



First three rungs latch players attempts in any order.

Last three latch users "place". (only player A shown)

1st place latches if "not" B or C.

3rd place latches if A "and" B. (A and B are both pressed first)

2nd place was the tricky one. Relay "exclusive or" is tough.
So 2nd place lights if "not" 1st place and "not" 3rd place.

edit:
Needs a little work. :(
I'll de-bug it in PLC!
 

Attachments

Last edited:

djsfantasi

Joined Apr 11, 2010
9,163
What happens as the first player to ring in is displayed? Won't that be a disincentive to the remaining players?

How do you know its time for the next question? When reset doesn't display another player?

Why is coding in C not an option? Have you never coded before and do not feel like learning? Microprocessors are a powerful tool in your design arsenal. Or is this a one time application, unrelated to electronics?
 

crutschow

Joined Mar 14, 2008
34,428
I personally think the Basic language, whose syntax is closer to pseudo-code, is much easier to learn for a beginner then the cryptic and arcane syntax of C. Unless you are planning on programming large, complex programs I see no particular reason to go with C. Of course, that's just my opinion based upon programming a few small programs, my aversion to learning a complex language, and my preference for doing things the easiest way possible. Besides, C was originally conceived as an April Fool's Joke. ;)
 
Last edited:
I personally think the Basic language, whose syntax is closer to pseudo-code, is much easier to learn for a beginner then the cryptic and arcane syntax of C. Unless you are planning on programming large, complex programs I see no particular reason to go with C. Of course, that's just my opinion based upon programming a few small programs, my aversion to learning a complex language, and my preference for doing things the easiest way possible. ;)
Yes BASIC is tops. More than capable of doing this project.
I started off using BASIC, spent years using it, and did not merge to C until I formally studied Java.

Java is pretty much C.
 

djsfantasi

Joined Apr 11, 2010
9,163
If not for you Candro, perhaps for someone else who is looking for a software solution, I present the following pseudo-code. It is not necessarily any specific language, but presented as a potential solution. I currently have no way to test it, other than by playing computer.

It doesn't address reading the pushbuttons, assuming that there are other functions written that check for any button press, and returns an integer corresponding to each button. Same for displaying the result. It assumes a function for that as well.

The algorithm is based on a small array, sized to the total number of pushbuttons. This array stores the number of each button, in order of its being pressed. Hence the zeroth element of latch is the first button pressed, the 1st element is the second button pressed, etc...
Each time reset is pressed, the elements are rotated, so the zeroth element is always the one to answer the question (hence why we display latch(0)). Previous values in the zeroth position are rotated to the end of the array, but stored as a negative. This allows the code to identify buttons previously pressed and allows the code to prevent them from "ringing in" again.
Once the zeroth position has the value of 0, everyone has had a chance to answer, and the display goes dark, indicating that it is time for the next question. The re-initialization of the latch array will take place unnecessarily, but it is not extremely wasteful. To keep the code simple, I left it this way.

Rich (BB code):
// buttons are identified by 1,2, or 3
// negative values used to indicate a pushbutton 
// that has answered incorrectly.

int latch[3]={0,0,0,0}; // one extra position for testing previous pushed buttons
int position = 0; // variable to hold which position is ringing in
int i = 0; // scratch variable for looping through lists
int hold = 0; // scratch variable to hold reset attempts 

while -1
	{
	if any(pushbutton)
		{
		i=0;
		// look through list of pushed buttons
		while (latch(i) <> abs(pushbutton) AND i<=3) i++; 
		if (i>=3) // button not pressed in this game; save it in order
			{
			latch(position)=pushbutton;
			position++;
			}
		}
	// rotate list
	if reset
		{
		hold=latch(0);
		for {i=1;i<=2;i++} latch(i-1)=latch(i);
		latch(2) = -hold;
		}
	if latch(0)>0
		{
		display latch(0); // show leading button
		}
	if latch(0)<=0
		{
		for {i=0;i<=3;i++} latch(i)=0;
		}
	}
 

djsfantasi

Joined Apr 11, 2010
9,163
@crutschow, I also agree that BASIC is easier to learn. I was specifically curious about the OPs comments regarding C.

Personally, I've written quite complex systems in BASIC. My last project was a programming language, written in FreeBASIC. Of course, that language has many C-like constructs.
 

crutschow

Joined Mar 14, 2008
34,428
If not for you Candro, perhaps for someone else who is looking for a software solution, I present the following pseudo-code. It is not necessarily any specific language, but presented as a potential solution............................
That looks a lot like C to me (that is, I doubt you could understand it without understanding the basics of C syntax). ;)

This is a simple pseudo-code example closer to Basic and which can be generally understood by anyone who knows the English language:

Rich (BB code):
//For i := 1 to 100 do
    set print_number to true;
    If i is divisible by 3 then
        print "Fizz";
        set print_number to false;
    If i is divisible by 5 then
        print "Buzz";
        set print_number to false;
    If print_number, print i;
    print a newline;
end
 
Top