Little game assistant
Using an (old) PC or laptop for display and power supply this little gadget helps monitoring time
One remark in advance: this device relies on the internal RC oscillator of the microcontroller. Allthough quite accurate it is not usable in situations where exact time has to be measured.
Operation
The device has 2 buttons, their function depending on the option chosen.
The result is sent to the PC by USB and is presented on the PC-screen (putty o.i.d.)
Maximum time which can be monitored is 1.75 hours.
All functions have some parameters, which can be changed witch PC keys and are stored in the EEPROM.
Any function can be stopped by pressing the ESC-key on the PC keyboard or by reset.
Following PC keys are used:
space - show next menu itemĀ (or press SW1)
enter - select function (or press SW2)
Following options are available:
1 - reaction speed timer
After the start a random waiting time of 1-6 sec begins. Then a signal is generated and SW2 must be pressed as quick as possible. The reaction time is presented on the PC screen with a resolution of 0.01 sec. Pushing the button too soon will result in an error message.
Following PC keys are used:
ESC - back to main menu (or press reset)
space - start game (or press SW1 to start)
a - set mode a: at the end of the waiting time the LED or buzzer is activated.
b - set mode b: the LED or buzzer is activated at start and de-activated at the end of the waiting time.
t - set the maximum time between 5 and 90 sec.
2 - chess-clock (two players, two separate timers)
press space-bar to start, SW1 will switch from timer 1 to timer 2, SW2 switches in the opposite direction.
Following PC keys are used:
ESC - back to main menu (or press reset)
space - start or continue game
r - restart timers at zero
s - stop or hold game
a - set mode a: there is no time limitation, but the clock stops at 1:45:00 because of maximum time limit for 16 bits
b - set mode b: The cumulative maximum time for aech player is limited
c - set mode c: as b and also the maximum time for each move/turn is limited
t - set the maximum time for the game between 5 and 90 min.
p - set the maximum time for each move/turn between 5 and 90 sec.
3 - start-stop timer (stopwatch)
Timer can be started, stopped and reset. Resolution is 0.1 second
Following PC keys are used:
ESC - back to main menu (or press reset)
space - start timer (or press SW1 to start)
r - restart timer at zero (or press SW2 to hold)
s - stop or hold timer
4 - quizmaster (who pressed his/her button first)
Eventually a timeout can be set. If no one has pressed before timeout a sound signalizes the end.
Following PC keys are used:
ESC - back to main menu (or press reset)
space - start game
a - set mode a: no time-out
b - set mode b: with time-out
t - set the maximum time between 5 and 90 sec.
s - manual time-out by quizmaster
5 - remote control
For futere developments.
Send the status of the buttons to the PC and control the output from the PC.
The keystatus is sent every second or if changed. Possible characters are: '0'=no key, '1'=SW1, '2'=SW2, '3'=SW1 and SW2.
Following PC keys are used:
ESC - back to main menu (or press reset)
0 - switch off output
1 - switch on output
Hardware
This project can be build on the PCB described here as the new project photo shows. I added a partslist to summarize which parts have to be used.
Connections to the board: X1-X2=key SW2 (X1=gnd), X3-X4=key SW1 (X3=gnd), JP2=reset key. Ry1 was replaced by an active beeper for sound generation. This beeper eventually can be switched off by removing the jumper that replaces IC2.
If you use your own PCB or veroboard R1 and R2 are not needed and RN1 can be replaced by 3 separate resistors of 10k.
The device is meant to be compact; don't connect long wires to SW1 and SW2 as there is no adequate nois suppression.
Software
The program is written for the B. Knudsen CC5X compiler. An 8 pin PIC12F1840 forms the heart of the circuit. For more information see the comments in the program source.
The free version of the compiler can generate max. 2K code (microcontroller has 4K flash), which is used for 99%. The full version would be needed for a better user interface and for longer max. times. The microcontroller has 4K program space available.
In my version the max. time is 1.75 hours. For longer times 24 bit variables must be used or the counters must count at 1 Hz.
PC software
For the presentation any terminal program can be used. I use putty, which is setup for a single line of 20 characters using a big font (Courier New, 72 point). The FTD232 generates a serial port, which must be used in the terminal program. Baudrate is 9600, no parity.
Operation
The device has 2 buttons, their function depending on the option chosen.
The result is sent to the PC by USB and is presented on the PC-screen (putty o.i.d.)
Maximum time which can be monitored is 1.75 hours.
All functions have some parameters, which can be changed witch PC keys and are stored in the EEPROM.
Any function can be stopped by pressing the ESC-key on the PC keyboard or by reset.
Following PC keys are used:
space - show next menu itemĀ (or press SW1)
enter - select function (or press SW2)
Following options are available:
1 - reaction speed timer
After the start a random waiting time of 1-6 sec begins. Then a signal is generated and SW2 must be pressed as quick as possible. The reaction time is presented on the PC screen with a resolution of 0.01 sec. Pushing the button too soon will result in an error message.
Following PC keys are used:
ESC - back to main menu (or press reset)
space - start game (or press SW1 to start)
a - set mode a: at the end of the waiting time the LED or buzzer is activated.
b - set mode b: the LED or buzzer is activated at start and de-activated at the end of the waiting time.
t - set the maximum time between 5 and 90 sec.
2 - chess-clock (two players, two separate timers)
press space-bar to start, SW1 will switch from timer 1 to timer 2, SW2 switches in the opposite direction.
Following PC keys are used:
ESC - back to main menu (or press reset)
space - start or continue game
r - restart timers at zero
s - stop or hold game
a - set mode a: there is no time limitation, but the clock stops at 1:45:00 because of maximum time limit for 16 bits
b - set mode b: The cumulative maximum time for aech player is limited
c - set mode c: as b and also the maximum time for each move/turn is limited
t - set the maximum time for the game between 5 and 90 min.
p - set the maximum time for each move/turn between 5 and 90 sec.
3 - start-stop timer (stopwatch)
Timer can be started, stopped and reset. Resolution is 0.1 second
Following PC keys are used:
ESC - back to main menu (or press reset)
space - start timer (or press SW1 to start)
r - restart timer at zero (or press SW2 to hold)
s - stop or hold timer
4 - quizmaster (who pressed his/her button first)
Eventually a timeout can be set. If no one has pressed before timeout a sound signalizes the end.
Following PC keys are used:
ESC - back to main menu (or press reset)
space - start game
a - set mode a: no time-out
b - set mode b: with time-out
t - set the maximum time between 5 and 90 sec.
s - manual time-out by quizmaster
5 - remote control
For futere developments.
Send the status of the buttons to the PC and control the output from the PC.
The keystatus is sent every second or if changed. Possible characters are: '0'=no key, '1'=SW1, '2'=SW2, '3'=SW1 and SW2.
Following PC keys are used:
ESC - back to main menu (or press reset)
0 - switch off output
1 - switch on output
Hardware
This project can be build on the PCB described here as the new project photo shows. I added a partslist to summarize which parts have to be used.
Connections to the board: X1-X2=key SW2 (X1=gnd), X3-X4=key SW1 (X3=gnd), JP2=reset key. Ry1 was replaced by an active beeper for sound generation. This beeper eventually can be switched off by removing the jumper that replaces IC2.
If you use your own PCB or veroboard R1 and R2 are not needed and RN1 can be replaced by 3 separate resistors of 10k.
The device is meant to be compact; don't connect long wires to SW1 and SW2 as there is no adequate nois suppression.
Software
The program is written for the B. Knudsen CC5X compiler. An 8 pin PIC12F1840 forms the heart of the circuit. For more information see the comments in the program source.
The free version of the compiler can generate max. 2K code (microcontroller has 4K flash), which is used for 99%. The full version would be needed for a better user interface and for longer max. times. The microcontroller has 4K program space available.
In my version the max. time is 1.75 hours. For longer times 24 bit variables must be used or the counters must count at 1 Hz.
PC software
For the presentation any terminal program can be used. I use putty, which is setup for a single line of 20 characters using a big font (Courier New, 72 point). The FTD232 generates a serial port, which must be used in the terminal program. Baudrate is 9600, no parity.
Updates from the author