The GameEnhancer

An adaptable, fun, and educational micro-controller

kit with a PC interface – available from QuestKit

www.questkit.com

 

 

 

Playing the board version of  TV quiz games can sometimes be pretty dull.  Unless you have a really objective person who is acting as the MC……. or you happen to have a TV studio setup you can miss out on the real fun to be had.  With the GameEnhancer—you can bring some excitement to these games. Adding to the element of realism: a selectable theme song can be played in the background while the contestants hurry to be the first to respond! 

 

Likewise, learning how to use the PIC microcomputer chip can be difficult.  Where do you start?  Sometimes it helps to have a project to build that you can easily adapt.  The GameEnhancer can be easily adapted to accurately measure voltages and collect data, to control other devices, to launch rockets, or to simply serve as an experiment station.   It interfaces to your PC and can supply data to it.  The PC is also used to program the PIC microcomputer – so you don’t need to purchase a programmer.

 

The GameEnhancer kit (available from Questkit, www.questkit.com) is very easy to build—employing standard components, a double-sided solder-resist silkscreened circuit board, and comes with a “Heathkit™ style assembly manual complete with pictures and diagrams.  It is suitable for those who have some experience building kits, or also very suitable for an parent/child learning project.  Check out the website for pictures of the kit and a sample page from the assembly manual.

 

Once the kit is built, you can first use it to assist in making games more exciting to play. Up to 4 contestants can compete to answer a question.  The GameEnhancer detects and displays on a LED the number of the first game control button pressed while playing up to 16 different programmable and selectable songs.  The unit itself is compact and is either battery-powered or runs off of a 9-12V DC wall transformer.  It comes with an on/off switch and volume control.

 

As mentioned,  this design is easy to build and use.  It is based around the 16F873; one of the advanced flash micro-controllers available from Microchip.  Since the PIC programming circuit is included in the design; you don’t have to purchase or find a PIC programmer. Nor are you locked into one configuration of the firmware.  Commented PIC source code is provided that can be easily modified to tailor the GameEnhancer operation. You can even use the main unit to program and debug other PIC16F873 processors when the project isn’t pressed into service making games more exciting.

 

What’s unique about this design is its adaptability. With free assembler and linking software available from the Microchip website, the firmware can be modified to build a number of other projects. The peripheral circuits (audio output, LED display, serial EEPROM memory, A/D converter, buttons, and serial interface to a PC) can be combined in different ways.  As a starter, with simple modifications to the firmware a 5 V reed relay can be triggered to launch a model rocket after a countdown (while a science fiction movie theme is played, of course!).  With the serial PC data interface, A/D converter, and unused pins on the processor it is also capable of being easily transformed into a data logging device for science projects or home control applications.

 

The downloadable software comes with several useful tools and runs under Windows 95/98/NT/2000.  It includes not only the ability to download code for the PIC processor and values for the EEPROM but it also includes diagnostics for board turn-on and debugging capabilities.  These can come in handy when you want to modify and test changes in the firmware.

 

Most of the parts used in this design are standard and available through sources such as DigiKey, JDR, Jameco, RadioShack.Com or local Radio Shack stores.  Various kit options are also available from QuestKit (Contact information listed at the end of the article).  Source code is available for the high level functions of the software enabling those of you who can program to tailor the user interface.

 

So, the GameEnhancer is easy to build, educational, adaptable, and a clever way to make a game more fun to play.  But how does it work?

Basic operation and game playing

 

When you turn on the GameEnhancer, it starts to play a theme song stored digitally in the EEPROM.  It then flashes random displays on the LED while waiting for the first button on a contestant’s game handle to be pressed.  When a button press is detected, the theme music stops and the winning contestant’s number is flashed on the display.  After (hopefully) answering the question correctly, the person who pressed their game button first presses their button again to re-start the theme music and the whole process is repeated.

 

Four AA batteries power the GameEnhancer. Alternatively, a 9-12 VDC unregulated power supply can be used with the on-board regulator circuit. About 8 hours of game playing are possible before a battery change is necessary.  It has a volume control and an on/off switch.  The on-board analog to digital converter is combined with a voltage reference chip to signal when the power from the battery is getting low.

 

Notes for the songs to play are programmed into the serial EEPROM using the downloadable software and a spreadsheet or word processor to input the data.  Up to about 4000 notes can be programmed into the 64K-bit serial EEPROM.  Song selection is accomplished by holding down any of the game buttons while the power is turned on.  This puts the device in a special setup mode, which allows you to repeatedly press any button to cycle through and select one of 16 different songs.  The next time the unit is turned on, it will play the selected melody. 

Construction and checkout features

 

To assist in a successful assembly, the software and PC serial port are used to perform checkout diagnostics.  A series of loop-back tests and jumper changes isolate and test various elements of the circuit to discover any construction or part problems.  In addition, an LED circuit is used as a simple logic probe to verify circuit voltages.  A diagnostic program can be pre-programmed into the PIC processor (if you have access to a programmer) or comes automatically installed if the complete kit is purchased from QuestKit.  This diagnostic program helps isolate issues with the PIC processor and associated oscillator circuitry.

 

Block diagram and architecture

 

Figure 1 depicts the overall block diagram of the system and figure 2 is a detailed circuit schematic.  Please refer to them during the following discussion.

 

 

 

Hardware

 

The GameEnhancer is based around a battery powered PIC 16F873 microcontroller circuit. It includes several peripheral circuits that interface to the microcontroller. These circuits include:

 

         a game handle / button interface using RCA connectors

         an audio amplifier and speaker section to play the notes

         a serial EEPROM used to store the notes to play as well as configuration information

         an LED, resistors, and driver circuit to display which button was pressed first,

         a battery power supply

         an interface for an external unregulated DC power supply transformer

         a battery voltage monitor circuit based on an A/D converter in the PIC processor

         a serial RS232 interface / programming circuit

         a relay driver circuit

 

Each of these sections will be briefly described.

 

Game handles and interface

 

The Game Handles are an important element of the user interface to the GameEnhancer.  They are designed to be easy to hold and press.  The game handles are constructed using 4 short sections of PVC plastic pipe and end caps.  In each of the end caps is mounted a normally open momentary contact push button (SW1-SW4). The end cap is press fit onto the PVC pipe.  The switches are connected to the microprocessor circuit via a 10-foot section of 2-conductor wire and RCA jacks/plugs. Internal 10K ohm pull-up resistors and the PIC PORTB input registers are used to detect when any of the switches are closed. 

 

Audio Circuit

 

The audio circuit is responsible for playing the notes of the theme songs.  Square-wave oscillations of the desired frequency and duration (corresponding to the notes of the song) are generated by the PIC via a firmware algorithm (described later).  These oscillations are available at the PIC output port RA2.  This signal is applied to potentiometer Pot1, which enables the user to adjust the volume.  This signal is then applied to the input of an LM386 (U3).  The LM386 is a popular audio amplifier chip and is used to drive a miniature 0.4-watt speaker.  The components in the audio amplifier circuit are designed to adjust the gain level and to prevent unwanted feedback from the output back to the input. Capacitor C4 is used to AC couple the speaker to the amplifier.

 

Memory storage in the EEPROM

 

Serial EEPROM (U2) is a 64Kbyte device used to store the notes of the songs as well as configuration information for the GameEnhancer.  With the note format chosen for this design, this part is capable of storing just over 4000 notes.  To use this part, pull-up resistors R11and R12 and address encoding resistor R7 are necessary to support the I2C “inter-IC” protocol developed by Phillips, Inc.

 

I2C was chosen to enable future expandability of the design.  It is feasible, for example, to add I2C parts such as a temperature sensor, a voice recorder/playback chip, a USB interface circuit, and additional memory by connecting them to pads “DATA” and “CLOCK” on the PC board.  All that is necessary for the hardware interface is that a different address is set with pull-up resistors for each peripheral chip.

 

RS232 serial interface for in-circuit programming and data communications

 

The RS232 interface is used to interface the GameEnhancer with a PC.  This interface was chosen for low-cost, simplicity, and availability.

 

The RS232 interface is used for a number of purposes in this design.  First, it is used to initially program a blank 16F873 microprocessor.  In addition, it is used to send commands and receive data once the processor is programmed.  The interface also is used in the initial checkout diagnostics to verify sub-circuit operation.

 

Since the nominal voltages used as part of the RS232 standard have a much wider range than in most standard TTL/CMOS circuit designs, a level converter chip is necessary.  The MAX232 chip (U4) is used to translate the variety of different voltage ranges provided by most PC RS-232 implementations (typically +-10 volts) to a range between 0 and 5 volts.  One additional input line was needed in this circuit for programming control and a simple diode and resistor circuit (R16, R17, R18 and D4,D5) is used to translate the RS-232 voltages into a range of –0.7 volts to Vcc-0.7 volts. Using discrete components for a single input line was a less expensive alternative than choosing a converter chip with additional input and output lines.  Resistors R16 and R18 are used in case the diodes are accidentally inserted backwards (they prevent a direct short). 

 

One of the key features of this design is that it doesn’t require a pre-programmed PIC processor.  To make this feature possible, a simple control circuit is used to manage both the initial programming of the PIC processor as well as RS-232 serial communications.  Figure 3 shows a schematic view of the serial control circuit..

 

 

In the control circuit, the level-shifted RTS and DTR signals are used under program control to shift data into the serial to parallel shift register U6.  The output state of the serial to parallel register is used to put the hardware into reset, program, or running mode. These modes are set depending upon the states of the PGRM line and the low-enabled nReset line.  

 

The operation modes are selected by sequences of bit streams sent to the shift register using the RTS (clock line) and DTR (data line) signals.  If after the bits are shifted in; the inverted signal on the 74HC164’s pin 3 either puts the PIC into “reset” when low or one of the other two modes when high.  If not reset, then when pin 13 on the shift register is high, then the PIC is put into programming mode and data can be transferred into its memory.  Otherwise when not reset the PIC is in normal running mode when pin 13 on the shift register is low.  Note that the jumper switch SW6 can prevent program mode from occurring unless it is in the “Program” setting.

 

An example demonstrates how the control circuit works.  To put the PIC into program mode, the string of digits 00000001 is cycled into U6 using the RTS and DTR signals under PC software control.  The first shift occurs on the first clock pulse and puts the “1” bit into the first serial register (“A”).  This immediately resets the PIC chip.  On the next clock pulse, a 0 is shifted into the first serial register “A” and the 1 is moved into serial register “B”.  The 0 in register “A” causes the PIC to go into running mode.  The additional bits are likewise shifted into the serial register and when the “1” finally reaches serial register “H”, it causes the PIC to go into the programming mode.

 

This circuit must also work properly when no serial interface to a PC is connected.  In this case, it must be put into normal running mode (reset high (“1”) and PGM low (“0”). To generate this condition automatically, the 74HC164 shift-register is reset to an all zero state on power up using the chip reset function. Resistor R15 and capacitor C16 are used as a simple RC timing circuit to reset U6 to an all zero output state on power-up. This must be accomplished prior to the PIC16F873 completing it’s own startup sequence at power-up.

 

One other feature of the serial control circuit is the data loop-back test capability. This diagnostic checkout procedure is used as the very first step in verifying that the serial connection is working properly.  Data is sent to the unit from a PC and the same data is read back 8 clock cycles later.  Serial register “H” at pin 13 is connected to the CTS line.  This signal goes to the PC and can be read during shifting operations for diagnostic purposes.  When shifting data into the shift register—the first bit shifted in from the PC can be verified 8 clock cycles later by watching the CTS line.  If the RS-232 signals aren’t working properly or there is an assembly or part problem then the expected bit won’t be read on the CTS line by the PC software. By shifting combinations of 1’s and 0’s it can be determined if the entire serial connection “loop” is working properly.. 

 

As mentioned, the control circuit is used to put the hardware into the reset, run, or program modes.  Once in programming mode, the TX and DTR signals are used to send programming data from the PC to the PIC chip. The TX line is used as the clock signal and the DTR line is used as the data signal.  Low level software on the PC side is used to toggle both of these lines according to the PIC programming specification.  Once the data is programmed in, it can be verified using the TX line to clock the data and the CD line to monitor the data.  The DTR line is held high during a verify enabling R5 to act as a data pull-up resistor for signals on the CD line.

 

Programming the PIC using these signals consists of special programming commands that take care of functions such as incrementing the program position counter, resetting program memory, and writing specific byte values.  Details of the programming algorithms are available from the Microchipä WebPages at www.microchip.com.

 

Once the PIC is programmed, the control circuit can put the hardware into running mode.  In this state the serial interface is used to communicate data between the PIC and the PC.  The TX line from the PIC processor drives the Rx and CD lines of the serial interface.  The CD line is ignored in the application software.  The RX line is read via standard Win32ä system calls.  The TX line from the serial interface drives the PIC RX line.  The TX line is similarly controlled via Win32 serial interface system calls.  Note that the connections for these lines are fully compatible with the in-circuit programming circuitry.

 

Two other components are important to understand the serial control circuit.  Resistors R5 and R6 are used as isolation resistors to prevent cases where the PIC pins are set to be output rather than input as well as in cases where data must change directions between programming and verification.

 

The physical aspects of the RS232 standard are also important.  A DB-9 connector positioned inside the box and soldered to the PC board to simplify initial construction and reduce wiring time.  (It is possible, of course, to mount a DB-9 connector to the outside of the box and wire it to the appropriate holes on the PC board.)  To program the PIC part and to make changes in the stored music program, the box must be opened up and an RS-232 cable connected between the DB-9 connector and the serial connector at the back of a standard PC.  Also as described earlier, a jumper is provided that must be moved from the “write protect” position and set in the program position to make changes to the PIC program memory.

 

Power supply circuitry

 

Four AA batteries provide about 8 hours of use under average playing conditions.  In addition, an external DC power jack (J2) and an LM317T voltage regulator (VREG1) are provided for 9-12 volt external unregulated DC power sources.    Protection diodes (D1 and D2) are included to prevent regulated DC from going into the batteries.  (Note that the circuit could be adapted to trickle charge Ni-Cad batteries provided that manufacturer’s charging specifications are carefully followed.)  Bypass capacitors help to eliminate switching noise on the power supply rails.  Capacitor C13 is especially critical to dampen the switching power supply oscillations used within the MAX232 chip (this oscillator is used to generate the +-10 volt signals used for RS232 output).

 

When using batteries it is helpful to give the user a warning when the voltage is getting low. The PIC 16F873 analog/digital converter (A/D) circuit along with a voltage reference chip VREF1 (2.5V +- 3%) performs this function.  Under firmware control a sample of the known voltage reference is taken periodically and measured with respect to the supply voltage. The A/D measures the percentage of power supply voltage read at its input.  This reading is compared to the expected reading of 2.5V to calculate the supply voltage.  If the power supply voltage ever falls below 3.7 volts, the LED will blink “L” followed by “O” during periods that the music is being played and the LED is flashing.

 

LED displays

 

The LED displays both the winning contestant number,  a flashing indication while the background song is playing, and a low power indicator.  The LED circuit consists of a serial to parallel shift register (U5), current limiting resistors (Rpack1), and an extra bright LED (LED1).  U5 is used to reduce the number of PIC processor lines required to drive the LED from eight to two.  A simple firmware algorithm translates a decimal digit between 0 and 15 to the associated hexadecimal output display 0-9, and a-f by lighting the appropriate LED segments.  This algorithm also supplies the clock and data signals to enable the correct values to be shifted into the shift register.

 

A second LED assembly consists of LED2 and R19 connected to +TP.  This circuit is a very simple digital logic probe.  It is used in initial checkout by connecting a wire to +TP and using it as a probe.  LED2 will light up when several volts are detected at the test point.

 

PIC processor and oscillator circuit

 

A PIC 16F873 flash-memory processor is used because of both its rich set of peripheral functions and it’s ability to be programmed while it is in the circuit.  Unlike other flash memory processors in the PIC line, this part can be programmed using standard supply voltages of 5 volts.  Other processors (such as the 16F84) require 13 volts for programming and result in a more complex circuit.   One of the PIC 16F873 I/O pins can be used for I/O or it can be used to signal the PIC to enter into a special in-circuit programming state.  In this project, the in-circuit programming capability eliminates the need to purchase a separate PIC programmer and also makes development and experimentation very easy.  It’s a snap to make a change in the program, download it from the PC to the processor, and then get quick feedback on the result of the program change.   When combined with use of debug statements that are output over the serial i/o interface, this processor enables very quick firmware development.

 

Relay driver circuit

 

Future expandability was an important design objective for this kit.  With the ability to detect button presses, monitor input voltages, and interface to a PC it seemed natural to add the capability to control external devices.  A low-cost transistor-based circuit is included that can be used to drive an external 5V reed relay. This enables the GameEnhancer to be used to drive external devices that have switching requirements greater than those provided by the PIC 16F873.  When the output pin RB5 at pin 26 of the PIC processor is activated, the transistor Q2 is turned on and will activate an external relay (needs to be wired to the relay+ and relay- pads).  Diode D3 is included to prevent arcing when the relay current is turned off. (Note: If connecting a relay to high voltage or currents—please be very careful to follow good safety precautions and design techniques.  Constructing this type of control is beyond the scope of this article but a number of articles have been published that describe more details.)

 

The firmware

 

The firmware in the PIC processor is made up of several major sections (see figure 1 for an overview and figure 4 for a diagram of the various processes running in the firmware). 

 

 

One section of the firmware consists of code that initializes the processor, its associated hardware peripheral functions, and circuits external to the processor.  Initialization of the PIC requires writing the correct values to control registers. Initialization of external circuits requires that correct values be written out through the PIC output registers. Included in this initialization are items such as:

 

-          Turning on internal 10K pull-up resistors on the switch input lines

-          Running the diagnostics loop

-          Setting up the interrupt hardware to handle Timer0 and Timer1 interrupts

-          Initializing the serial i/o channel for 9600 baud standard asynchronous serial operation

-          Initializing the I2C port

-          Setting up each input/output register with the proper direction for each pin

-          Monitoring the battery voltage

-          Initializing all internal variables to the proper values

 

During initialization if the algorithm detects that a button is being held down; a sequence is started that interacts with the user; enabling them to select which song will play during operation.  This sequence first displays the number of the current song that will play.  If the user wants, they can repeatedly press any button and the song number will be cycled through the available choices.  Any new value is saved in the non-volatile serial EEPROM and will be used the next time the unit is powered up.  (Note that to exit this state the power must be turned off and then turned back on again).

 

After initialization, the PIC spends most of its processing time in the main song loop. This loop repeats a cycle continuously until one of three conditions is detected:  a) the power switch is turned off, b) a diagnostic command is detected in the incoming serial byte register or c) a special diagnostic byte value is encountered in the note sequence.  Condition b) or c) sends the unit into a diagnostics command-monitoring loop. 

 

When in the main song the following steps keep getting repeated:

 

1)       Check if any of the button lines are pulled low.  If so, enter a button handling routine.

2)       Check to see if the LED flash countdown timer has reached zero.  (This timer is used to make the LED appear to flash).  If so, update the LED to light up a different segment or display the low power indication if the battery voltage is low.

3)       Check and see if a command has come in on the serial input line.  If so- exit this loop and process the command in the diagnostics loop.

4)       Check and see if the note period countdown timer has reached zero (this is the timer that expires when the note has played for a sufficient length of time).  If so, retrieve the next note from memory and set up the timers accordingly.  A note can also be a rest (value 0) in which case the oscillator is turned off for the next note period.  A special note value causes the algorithm to enter the diagnostics loop.  Another value causes the algorithm to jump to a different note in the sequence rather than the very next note.

5)       Measure the supply voltage using the A/D circuit and voltage reference. Set the low-voltage indicator variable if the voltage is below a fixed threshold.

(Return to step 1 again)

 

Checking the buttons requires seeing if any of the button lines are currently low (indicating that a button is being held down or at least the contacts are bouncing).  If any line is low, then the following process is followed:

 

1)       Store the button # that was pressed in memory.  If more than one button is pressed then a tie breaker algorithm is employed.  A semi-random number is used to choose among the pressed button numbers (note that no special switch de-bouncing algorithms were found to be necessary in actual use; bouncing switch contacts seem to work as an effective random tie-breaker for switches that are pressed within a few milliseconds of each other).

2)       Turn the oscillator off by disabling the timer1 interrupt handler

3)       Output to the LED the number of the button that was pressed

4)       Flash this number several times on the LED.

5)       Play a couple of beeps to alert the game players that a press has been detected

6)       Wait for the button that was pressed to be released

7)       Wait for the button that was pressed initially to be pressed again (this is done when the button-presser wants to restart the song and detect a new press).

8)       Return back to the main loop

 

Displaying a flashing symbol or low power indication is accomplished by converting a varying loop counter value into a particular LED segment number to be lit. The loop counter variations make the LED look like it is randomly flashing.  If the A/D circuit has determined that the supply voltage has fallen below the threshold, then the values “L” followed by “0” are displayed instead of flashing a segment.

 

Checking to see if a command is available on the serial line is the next step done in the repeating command loop.  This step is done to assist in any debugging that is desired.  The processor code checks to see if a byte has been received in the serial register and if so, the loop will exit and the diagnostics command processor will start.  Whatever value is in the serial register is treated as a command and is processed accordingly.  The PIC can return serial information over RS232 back to the host PC while in this state.

 

If no command byte is in the serial port, then a check is made to see if the current note has reached the end of its designated playing period. If it has, then the oscillator must be stopped, the next note must be retrieved from serial EEPROM memory and the timers are set up to play the new note’s pitch and duration. The oscillator is restarted with the new note period loaded into the Timer1 counter.

 

As a last step before repeating the commands in the loop, the A/D section of the PIC processor is accessed to monitor the battery voltage.  This is accomplished by reading the A/D conversion value of the voltage present at pin RA3.  The A/D converter provides an output between 0 and 255 based on the voltage at the A/D input.  This number represents the percentage of the PIC supply voltage is present at the input A/D channel.  The number 255 represents that the input is at or exceeds the power supply voltage.  The number 0 represents that the input is at ground potential.  Any number between these is a linear interpolation of the actual value.  Thus if the A/D converter reads 128 then the voltage present is measured to be128/255 of the supply voltage.  In this circuit the voltage being read is known and fixed to be 2.5v +- 3%.  Knowing this, the supply voltage can be determined by applying the linear algorithm in reverse: dividing 255 by the number read and multiplying it be 2.5.   For example, if the A/D readout is 145, then 255/146 x 2 represents a measured supply voltage of 4.4 volts.  In this approach, the number read by the A/D converter will rise as the battery voltage drops.  When the calculated voltage falls below a set threshold then the algorithm will cause the LED to signal the low power condition.

 

Interrupt Service routine processing

 

The interrupt service routine function of the PIC 16F873 is utilized to accurately time each notes and duration. This is a function which helps the processor to precisely and quickly respond when either one of two different internal hardware timers expire. 

 

Interrupt service routines are used in microprocessor design to enable the firmware to respond to events quickly. When an interrupt event (such as a hardware timer expiring) occurs, the processor goes to a designated section in the code to execute the interrupt service routine code.  Upon taking care of the interrupt event condition, the interrupt service exits and the code execution resumes it where it left off prior to the interrupt event.

 

Interrupts in this project consist of two hardware timers internal to the microprocessor. These timers are used to implement the correct pitch and duration for each note as fetched from the serial EEPROM.  One of the timers is also used to signal that a new LED segment needs to be displayed.

 

The duration of the note and the duration of each “flash” of the LED are controlled by timer 0. This hardware timer is set to expire about every 7.8 mS (note that this “odd” number makes music note duration calculations a little bit easier to calculate which is described later).  When Timer0 overflows, the processor is interrupted and the Timer0 interrupt is handled.  The Timer0 interrupt handler decrements a countdown register for the note period and a second countdown register for the flash period.  If either of these counters reaches zero, a variable is set indicating to the main song loop that action is necessary.

 

The interrupt service routine also manages the Timer1 hardware overflow event.  Timer1interupt handling is set up to be as fast and precise as possible since it controls the oscillations and hence audio quality of each note.  If the period of oscillation varies then the tone will make a warbling tone.  If the interrupt is delayed, clicking noises will result. Consequently the interrupt service routine is designed to respond very efficiently to Timer1 overflow interrupts. 

 

To respond quickly, the interrupt service routine directly controls the output to RA2 (pin 4) of the PIC processor.  Each Timer1 interrupt causes pin 4 to be changed from 0 to a 1 or from a 1 to a 0.  This results in a periodic oscillation that is used by the audio amplifier and speaker to produce a tone.  If you are interested in more detail about the interrupt service routine please download the firmware source code as it contains detailed comments and hints for making modifications.

 

 

Fetching the next note and playing it

 

The main loop sets up the appropriate variables and the interrupt service routine is set to respond to interrupts as they occur.  Thus, the interrupt service routine and the main song loop cooperate to enable the GameEnhancer to play a song.  To understand how the notes are made, it is appropriate to look at some of the physics behind musical notes and see how the PIC processor algorithms operate.

 

As most of us learned in school, any musical note can be represented as a tone and duration.  Tones are specified in terms of Hertz (Hz) , or cycles per second.  Oscillations between about 20 Hertz and 20 kilohertz are interpreted by our ears as sound.  For example, when an oscillation is played at 262 Hertz, it is recognized as “middle C”. 

 

A given tone can be played for different lengths of time (duration).  In music notation, duration is frequently expressed in portions of a fixed whole note; including whole notes, half notes, quarter notes, and so on.  Instructions like “Presto” are also included in music notation to imply a certain speed per quarter note.  In terms of time, any given note’s duration can range from 10’s of milliseconds to several seconds. 

 

To get a song to play using digital electronics, both the tone and duration can be represented as binary values.  The tone can be easily generated by outputting a square wave since these are very easy to generate by simply turning an output port on and then off.  Although the square wave output can sound a bit “mechanical” due to all of the odd harmonics (a square wave is made up of the fundamental sine wave plus frequencies at 3x, 5x, etc. of the main fundamental frequency), it is adequate for most applications.

 

 

In this design, to play middle C requires outputting a square wave 262 cycles per second.  This can be achieved by toggling an output port on the PIC processor every 1.91 milliseconds.  Two of these toggles will make up a complete oscillation of 262 Hertz or 3.82 milliseconds.

 

To get a clear note sound, it is very important that when playing a tone that the oscillations happen exactly on time to prevent warbling and clicking.  The Timer1 circuit in the 16F873 can be set to be synchronized and incremented by periodic pulses coming from the external crystal oscillator.  This ensures that the timing of the interrupt generation will be as accurate as the crystal oscillator. When the Timer1 hardware timer overflows (occurs when it tries to increment past the number 65,535) it triggers a call to the interrupt service routine.  The interrupt service routine detects that a Timer 1 interrupt has occurred and toggles the output pin to the audio amplifier.  It then resets the Timer 1 clock to the correct count representing the current oscillation frequency.

 

To enable most common notes to be played, Timer 1 is initialized to increment every 400 (every 4th cycle of the external oscillator).  This is the minimum possible increment value and provides the greatest flexibility.  Very low frequency notes with long periods will require long Timer 1 counting periods prior to overflow.  For example,  C two octaves below middle C is 65.3 hertz and requires 38,241 counts of 400 nS for each square wave transition.  Hence the number 27,294 is loaded into Timer 1 so that after 38,241 counts it will try and count past 65535 and generate an interrupt.  Timer 1 is a two-byte counter and store numbers between 0 and 65535.  Very high frequency notes with short periods require short Timer 1 counting periods prior to an overflow.  For example, a C four octaves above middle C is 4434 hertz and requires 564 counts.  Timer 1 is set up with a count of 65535-564 or 64971.

 

Since western musical notes only use a subset of all possible frequencies between 20 Hz and 20 kHz, it is possible to reduce the storage space used for each note.  A number in memory can represent the notes and then this number can be converted to the frequency for the note.  Thus, to increase the note playing capacity of the GameEnhancer, a lookup table is employed in the firmware.  This table reduces the number of bytes required to store the tone of a note from two to one. Representing the notes in the scale from 1 through 73 does this.  At locations 1 through 73 in a memory block are stored the oscillator frequencies for that particular note.  For example, C two octaves below middle C is represented as a 1.  C four octaves above middle C is represented as a 73, since it is 72 notes higher in the standard musical scale from the first note.  This requires only a single byte to store since a single byte can represent up to 255 different values.  Each note is read from memory and the value (for example 1 for the low C note) is then converted to the two byte tone value that represents the right number of increment values to cause the Timer 1 to overflow.

 

Playing the note at the right pitch is only half of the story.  The other important item is to play the note for the right length of time. Hardware Timer 0 and a firmware variable are used to generate the duration of each note.  Timer0 is set up to overflow every 7.81 mS and periodically generates an interrupt.  On each interrupt a memory value is decremented.  To play a note of duration 250 milliseconds  (four notes per second, typically 16th notes) a memory value be initially set to 32.  Every 7.81 mS it will be decremented by 1.  When it reaches zero, the main program loop will detect this event and stop the oscillator and prepare for the next note to be played as part of the main song loop.  (The number 7.81 mS is chosen to make note lengths easy to calculate at 60 beats per second.  At this tempo, ¼ notes occur every 250 mS.  It turns out to be easier to do the binary math if 250 mS is represented as 32 counts with each count being 7.8125 mS. That way 1/8 notes can be represented as an even number of 16 counts, 1/16 notes can be 8 counts, etc). 

 

To represent a longer note duration, a modification is made to the duration scheme.  Longer duration notes don’t need as much resolution in the duration.  Counts from 128 through 255 cause the Timer0 period to be set to 100 mS.   The number 128 is subtracted from the count number and the result becomes the number of 100 mS counts in the duration.  For example, a count number of 129 results (129-128) * 100mS as a duration. A count number of 145 results in a duration of (145-128) * 100 mS or 1.7 seconds.  With this scheme, a note duration can range from 100 mS to 12.7 seconds.

 

Using the notation scheme for notes just described enables slightly over to be stored in the 65K bit (8192 byte) serial EEPROM.  A simple quiz game song such as the theme from “Jeopardyä” with 32 measures uses about 260 notes including rests and the repeat at the end. Thus, about 520 bytes out of the 8K bytes are required.

 

Rest notes, repeats, and diagnostic note values

 

Three additional note pitch values are used as special “signals” to the firmware algorithm.  When any of these are encountered, instead of looking up the note period in the table, a different action is taken.  The value 0 represents a rest note and the oscillator is turned off for the duration of the note period. The entry value 120 followed by a 0 or a 1 indicates that the song should be repeated.  The next note that is then retrieved is the first note of the song.  The note value 127 indicates that the song should stop.  Consequently the oscillator is turned off and the diagnostics loop is entered.

 

The last “signal” is useful when debugging songs. It is used to jump to a desired note and is a more general case of the repeat signal just discussed.  It is the number 120 followed by a number between 0 and 4096.  This line when encountered acts like a “go to” statement and specifies the note to jump to next in the song relative to the beginning of the song.  The entry 120 0 or 120 1 would jump to the first note of the song when encountered (the repeat case indicated earlier) the entry 120 200 would go to the 200th note of the song.  (Note if the number is greater than the number of notes in any song it will jump to the last note of the song and play it next).

 

 

Other miscellaneous firmware functions

 

There are several other tasks performed in firmware that are necessary for this project.  The PIC 16F873 makes these functions easy to implement because it has smart peripheral chips inside the processor.  For example, the 16F873 has a circuit that manages all of the serial RS-232. It also has a peripheral chip that manages the I2C protocol for communicating with the Serial EEPROM.  Both of these peripheral chips save several 100 lines of assembly code that are necessary in simpler processors such as the 16F84.

 

As discussed earlier, a lookup table helps to boost the note storage capacity of the EEPROM.  The song, the note duration lookup table, and some constant values are stored in the serial EEPROM.   Two routines in the firmware are used to read the next song note (note number 1-73 and duration in number of 7.81 mS increments) as well as a routine to convert the note number to a timer 1 counter value.  Two additional routes are used to output a byte value over the serial lines to a PC (helps in doing debugging) or to read command and data values received from the PC.  For more information, refer to the comments included with the source code version of the firmware.

 

In addition to the serial port read and write functions, there are also diagnostic functions in the firmware. The diagnostic functions are designed so that with a standard voltmeter or by using the on-board LED probe circuit you can confirm whether or not various portions of the circuit board are constructed properly.   Slow speed toggling of output pins can be monitored with the on-board LED or voltmeter to verify functionality.

 

Once construction has been verified the diagnostics software is turned off (an EEPROM bit in the processor itself is cleared) and further diagnostic operation is only available from a diagnostics serial command.

 

Serial commands and in-circuit programming

 

The PC is an invaluable tool when interfacing to, programming, and debugging a microprocessor-based project. As mentioned earlier, the serial interface was chosen for this project.   Many texts talk about using a low-level interface run from DOS.  In these interfaces you can toggle individual bits in the hardware with I/O commands. When using WIN NT/2000ä or Win95/98ä it is better to use the application programming interfaces supplied by Microsoft.  These system calls allow you to send and receive serial data as blocks of bytes or to individually toggle some of the serial lines and read the status of other serial lines.  Both of these formats are used in the software used with this project.  As discussed earlier, the low level toggling is used when downloading the firmware to the PIC chip and when running diagnostic checkout programs.  Serial blocks of data are sent and received when performing normal processor operations.

 

Application software

 

To initially program and initialize the PIC processor and EEPROM, it is necessary to download software from the web site.  This software enables both a diagnostic checkout of the GameEnhancerä as well as managing the PIC16F873 firmware download, EEPROM memory download, and song entry routine.  The application software consists of user interface code as well as several library object modules that implement the programming and serial interface.  It requires Microsoft Windowsä version 95/98 or Windows NT/2000ä to operate.

 

There are three modules in the software used in conjunction with the GameEnhancer. (See figure 1 for an overview). If you are interested in learning more about this area of the design than described below please download the commented source code for the user interface and high level function from the WebPages.  (In addition, commented source code and a license agreement for the library object modules called by the user interface program are available from QuestKit).

 

The user interface application software consists of the functions necessary for communicating the controls of the PIC programmer, the diagnostics checkout software, and the EEPROM download program to the user.  This software is constructed using Microsoft’s MFC  (Microsoft Foundations Classesä) product and Visual C++ 6.0.  Calls are made into the EEPROM and PIC programming algorithms as well as the diagnostics based on the clicks and typing done by the user.

 

The PIC and EEPROM programming algorithms follow the recommendations provided by MicroChipä for programming the PIC16F873 and the 23C65 serial EEPROM.  A simple improvement of the PIC programming algorithms speeds up firmware development.  Each location in microprocessor flash memory is read prior to writing a value.  If the value read is already correct,  the programming write operation for that location is skipped.  When doing many firmware changes during development, this speedup is very handy, reducing downloading times from around 30-40 seconds for a mid-size program down to several seconds for simple changes that only affect a few bytes.

 

The diagnostic sequences send checkout commands to various subcircuits of the GameEnhancer.  These sections receive commands directly from the diagnostics software during initial checkout because the PIC processor is removed from the socket and wire jumpers are installed between the serial lines and these circuits.  This helps verify that all soldering and connections are made correctly.  Later the diagnostics sequences make use of the PIC16F873 directly to perform circuit checkout.

 

The serial I/O routines perform the routine bit-toggling necessary to implement the interactions with the RS232 controller and in-circuit programming circuits.  They also consist of a separate software read “thread” for higher level serial RS-232 communications. This structure enables faster communications of data sent from the PIC processor to the application program.

 

When the application software is started, the diagnostics checkout functions are run first.  By clicking on the diagnostics button, a dialog box comes up and enables a series of diagnostics tests to be run over the serial interface.  The first few diagnostics tests are done without a PIC processor inserted in the socket.  Connections are made between the two serial lines and the various hardware peripherals by inserting two wires into the PIC socket at the appropriate positions (see the construction section).  The remaining tests include either a blank PIC or a PIC that is preprogrammed inserted into the socket.   Step-by-step instructions are coded into the high level software to guide you through the following tasks:

 

-          Making a connection to the serial port on the PC

-          Ensuring that the connection between the PC serial port and the serial control register U6 is working properly

-          Turning on and off LED segments

-          Checking out the operation of the buttons

-          Sending an audio frequency square wave to the audio amplifier

-          Reading and writing data to the serial EEPROM and verifying that all memory locations are working.

-          Ensuring that serial connections are made properly to the PIC chip

 

The following diagnostics are run after inserting either a blank PIC chip or a pre-programmed PIC chip into the socket:

 

-          Checking out diagnostics signals coming from a pre-programmed PIC chip (optional)

-          Checking out the download of a diagnostics program

 

Once the diagnostics checkout is completed, then the second step is executed.  This step will automatically download a selectable firmware file to the microprocessor.  You can create your own assembly language file using free software available from MicroChipä assuming that you know something about designing or modifying PIC firmware. (There have been several excellent tutorial articles in prior versions of PopTronicsä to assist learning how to program PIC processors).

 

After downloading the firmware assembly file, step 3 downloads from a selectable ASCII song text file and places this information into the EEPROM. (See song format and encoding section below).

 

Finally, step 4 sends individual commands and receives debugging information back from the 16F873.  This step is available for those who are interested in doing development work based on this platform.

 

Song format and encoding in a text file

 

To get a song into the GameEnhancer, written music must first be converted into a sequence of ASCII characters.  These are typed into a text file.  This file is processed by the software and then downloaded into the serial EEPROM via the PIC processor. Either a spreadsheet program or word processor can be used to generate the text file.   One file is used to encode up to 16 different songs.  Each song consists of a tempo, the notes of the song, and a repeat to start the song over. 

 

There are two possible file formats used for encoding the songs.  The first is simpler and is closely related to music notation.  The second matches the internal representation used in the EEPROM and gives much more flexibility but is more tedious to convert from the sheet music.  The first format is translated into the second format when a song download is performed.  Error feedback is given to the user prior to downloading.

 

The simpler format starts with a single number on the first line.  It represents the number of quarter notes played per minute and ranges from 40 to 210.  Then each subsequent line for a song represents one note value and duration.  The note values are represented as capital letters.  These consist of the letters C, D, E, F, G, A, B, and R. These correspond to music note names with R representing a rest note.  Sharps and flats are added after the note value as a # sign or as a lower case b.  Putting one, two, or three minus signs in front of the note lowers the octave by one, two, or three octaves below middle C.  Putting one, two, or three or four plus signs in front of the note raises the octave by one, two, or three octaves above middle C. For example, to indicate C# two octaves below middle C; the notation would be - - C#.  Spaces or tabs are permitted between any of the characters.

 

The duration is placed on the same line after the note value and modifiers. There are a number of different note lengths encountered in written music.  These include whole notes up to 128th notes, dotted notes, and tie notes.  In this program, the number 1 represents whole notes, half notes by the number 2, quarter notes by 4 and so on up to 128th notes represented by the number 128.  (Incidentally 128th notes go very quickly with only a 4000 note capacity but fortunately these aren’t used very often!).  Up to 3 periods can be added after each note to represent the dotted notation used in written musical notation.  Each period will lengthen the note by ½ of its value.  For example, the representation of C 4.. (C followed by a 4 and then two periods) will play middle C for a duration of ¼ + 1/8 + 1/8 or ½ note.  Adding additional length numbers on the same line makes tie notes.  For example, two tied middle C ¼ notes would be represented as C 44.  Lastly,  triplet eighth notes are indicated by the number 3.

 

To make a song sound more realistic and musical, it is necessary that you add very short rests between phrases and after tie notes. In addition the duration of notes at the end of phrases and tie notes needs to be shortened just slightly.  Musicians naturally do this as part of phrasing.  To make this easy to encode; after any note that needs this adjustment the letter “p” is added.  This stands for “phrasing” and causes the note on that line to be played with a shorter duration followed by a very brief pause.  Another timing mark is the staccato notation (dot under the note).  Add the letter s after the timing value to indicate adjustment for staccato.

 

There are two notations used to direct which note is played next.  No special notation means play the next note in the sequence.  At the end of each song, the letter R is placed to indicate that the song should repeat.  On any line the letter “S” followed by the note number causes a skip to that note number in the song.  This is very helpful when first debugging the song. When debugging a song, placing the repeat mark at various places can help focus the debugging efforts.

 

As an example, here is the first bar of “Pop Goes the Weasel”  (from an unknown composer from 18th century England). The complete song in both formats can be downloaded from the website. The first entry is the tempo followed by the first bar.  There is an automatic repeat at the end of the song.

 

60

C 4

F 4p

F 4

G 4p

G 4

A 4

C 4

A 4p

F 4p

C 4

F 4p

F 4

G 4p

Bb 4

G 4.

F 4.p

R

 

This same phrase can be encoded in the other format, which gives more control but takes additional conversion work. This is represented in a text file with decimal numbers that are directly input into the serial EEPROM. This same sequence is represented in the text file as:

 

25 32

30 32

00 32

30 32

32 32

00 32

32 32

34 32

37 32

34 32

30 32

00 32

25 32

30 32

00 32

30 32

32 32

00 32

32 32

34 96

30 64

00 32

112 16

 

To assist in using this second format, it is to make a note template chart for easy reference. The C note three octaves below middle C can be labeled as 1 and then each subsequent note on the chromatic scale up to C 4 octaves above middle C gets a consecutive number ending with 73.  Then, a timing chart with different note lengths and their associated values can be made for a given tempo.  For 60 beats per minute,   a full notes is a  138  (138-128 * 10  mS or 1 second using the modified duration scheme described earlier) ,  a 1/2 note is a 64 (64 * 7.81 mS or 500 mS using the standard duration scheme),   ¼ notes is 32, and so on up to a 1/128  note is a 1. 

 

Using a word processor or spreadsheet program, the notes and durations are entered such that a note is on each line.  It is important to save the file in a known location in ASCII format with line feeds. Using WordPad or NotePad; choose the text documents format which appends a .txt extension.

 

Construction

 

Once you have purchased the kit from QuestKit (see www.questkit.com), you can carefully unpack the contents and inventory the parts.  Refer to the detailed assembly instructions for how to put the kit together

 

In the event you want to save a bit of money and have some experience doing your own case design, you can purchase the partial kit.  In this case you receive all of the parts necessary to put the circuit board together.  You will need to purchase your own mounting case and material for the game handles.  This will require using an electric drill and file or a rotary tool if available. .  Please follow all safety procedures when machining the box recommended by your drill or rotary tool supplier!  Here are some instructions to help you make your own case and game handles:

 

Plastic Case

 

The plastic case must be drilled and cut to make holes for the potentiometer, LED, RCA jacks, power connector, and speaker sound holes.  Refer to figure 5 for drilling locations. When drilling or using the rotary tool, you can make full-size patterns of figure 5, cut out the patterns, and fasten them to the plastic box with double-sticky clear tape.  Before drilling it is very helpful to use a sharp center punch to start the holes.  You can get spring-loaded center punches at most hardware stores.  Carefully punch a starting hole at the center of each hole on the pattern. 

 

 

For the square cutouts you can make several drill holes and either file between the holes or use the rotary tool to remove the plastic.  First, carefully punch holes in the corners of the square cutouts.  Then, remove the pattern and carefully use a sharp scriber and a straightedge (also available from most hardware stores) to draw out the boundaries of the square cutouts based on the center punch marks.  Then drill out plastic and use a nibbler and file to complete the cutout.  If you use a rotary tool for making the square holes, make sure to slow down the rotary tool speed if the plastic starts to melt excessively otherwise you won’t get a smooth cut.  Usually it is a good idea to make the cutout a bit small and slowly remove additional plastic while testing the fit with the circuit board part periodically.

 

Mount the potentiometer and power connector.  Solder the correct wires to these components. You may need to file or route some of the plastic rib material in order to get the potentiometer and power connector to sit flat.  You can also use edge cutters to remove the ribs.

 

Next, the 4-position RCA connector will be installed.  First, before mounting this part, solder each of the ground terminals of the 4 position RCA connector together and solder a 5” wire to one of the ground connections. Then mount the RCA connector from the outside of the case and attach it with 2 4-40 x 3/8 inch screws and bolts (with the wires positioned on the inside).  Solder the wires from the PC board to the appropriate RCA connectors.  Then wire the two battery holders together (+ to -) and then solder the wires to the battery holder coming from the circuit board.  Install the PC board (with the LED and speaker facing down) in the base of the case part.  The LED will be sitting flush with the bottom of the case and the speaker should be held in place over the speaker holes.  Then place the battery pack on top.

 

Before installing the batteries and putting the bottom cover in place, you should make sure that the RCA jacks are properly connected to the PC board.  Turn on the GameEnhancer and selectively short each RCA jack.  The correct number should be displayed on the LED.  Remember that to start the song playing again after each connection, you will need to disconnect and then reconnect briefly the RCA connection.  Finally, you can screw the base cover in place.  Note that if you have a large case you may need to put in some non-conductive foam material on top of the battery holders to keep everything in place

 

Game handles

 

The four game handles are constructed using six inch sections of 1/2 inch PVC pipe, end caps, lamp wire, RCA plugs, and normally-open push button switches (see figure 6). 

 

 

These come with the GameEnhancer full kit.  If you choose to make your own, you will need to purchase the PVC pipe and other components.  The push button switch is mounted into the end cap and the wire is threaded through the short section of PVC pipe.  This is used as a contestant’s handle. To construct a game handle, carefully drill a 5/16” hole in the end cap. You may want to use a vice and a towel to hold each end cap in place for drilling. (Note: you may need to remove some plastic from within the end-cap to get the switch to tighten properly. This can be done carefully with a knife or a rotary tool).  Then, hook up a 10- foot section of lamp or speaker cord (black matches most plastic enclosure covers) to a momentary contact normally open switch and mount the switch in the end cap.  Next, you can thread the wire through the six-inch section of PVC pipe and push the end cap with the mounted switch onto the pipe.  At the other end of the lamp cord—solder it to an RCA connector.   It is a good idea to use shrink-wrap tubing at both ends if you have access to the tubing and a heat gun. 

 

You may want to paint the game handles.  To do so, remove the switches and then spray paint the six inch pipe section using semi-gloss spray paint (black or blue paint matches most available plastic enclosures). You can either leave the end caps white or also spray paint them.  

 

Also it is a helpful to label the RCA connector end and the handle end with an identical number (1, 2, 3, and 4 respectively for each handle) and also label the RCA jack end with the same numbers that match the LED display.  You can use rub-on transfer numbers, plastic model decals, clear envelope labels printed using a color printer or a marker pen to make these labels.

 

Using the GameEnhancer

 

Any games that require taking turns to respond are candidates to liven up with the GameEnhancer.  The “Jeapordy” ™ game is a natural fit—and is made more exciting by following the rules used in the TV quiz form of the game.  Trivial Pursuitä can be enhanced through a simple modification.  You can have the first person to answer the question be the one able to move their piece and select the category for the next question.  You will probably want to augment the public domain song list provided on the QuestKit webpage with standard theme songs appropriate to the game you are playing.  You can obtain music for many TV quiz games at a local sheet music store.  Use either a spreadsheet program or a word processor program to fill in a table of note values that you can download to the unit following the format described earlier. 

 

To initially set up the unit, you can hold down any of the buttons while powering the unit up.  This will put you in a special mode to pick the number of the song that you want to have play. You can continue pressing the switch until the number of the desired song appears.  You then turn the unit off and back on again and you are ready for a round of play!

 

Remember: the player whose button was detected is the one who must clear out the press once the LED stops blinking their number.  This is accomplished by pressing the button once.

 

Other available resources

 

Software that programs the PIC, performs diagnostics, and downloads songs is included on the QuestKit website.  Commented PIC firmware, detailed assembly instructions, and suggestions for use can also be downloaded from this location.

 

For further reading and information, please consult:

 

Design with PIC Microcontrollers by John Peatman.  C. 1997 Prentice-Hall

www.microchip.com for free assembler and linking software

The I2C bus and how to use it – Phillips/Signetics data sheet

 

Parts List

 

(Resistors and capacitors are all standard and carried by most sources)

 

Critical single source parts are the PIC processor and the Serial EEPROM.  Both of these

are usually available from local electronics distributors in larger cities or from DigiKey.

 

 

Reference

Description

C1,C2

22 pF ceramic-disc 25 V minimum

C7,C8,C14,C15

.01 uF ceramic-disc 25 V minimum

C4

47 uF 16 V electrolytic

C6,C13,C16

10 uF 16 V tantalum

C3,C5,C9,C10,C11,C12

1 uF 25 V tantalum

X1

20 MHz parallel cut crystal DigiKey X036-ND, RSCOM 90-5126

RPACK1

8 x 1K DIP resistor pack JDR RPD8-1.0K, Jameco 108599, DigiKey 4116R-1-102-ND

R1,R2,R3,R7,R10, R13,R14,R15,R16,R18

1K 5% 1/4 watt resistor

R4

470 ohm 5% ¼ watt resistor

R5,R6, R11,R12,R19,

R20,R21,R22

2.2K 5% 1/4 watt resistor

R8

100K 5% 1/4 watt resistor

R9

270 ohm 5% 1/4 watt resistor

R17

10K 5% 1/4 watt resistor

D1,D2

1N4001 diode 100 PIV RS276-1101, JDR 1N4001, Jameco 35975,

D3

1N4004 diode 400 PIV RS 276-1103, JDR 1N4004, Jameco 35991

D4,D5

1N914 switching diode or equivalent RS 276-1122, Jameco 36311

U1

PIC 16F873 micro processor 20 MHz DIP DigiKey PIC16F873-20/SP-ND

U2

24C65 serial EEPROM DigiKey 24C65/P-ND

U3

LM386-N1 audio amplifier RS 276-1731, JDR LM386N1, Jameco 24125

U4

MAX232-CPE RS232 chip JDR MAX232CPE, Jameco 24811, DigiKey MAX32CPE-ND

U5,U6

74HC164 serial/parallel shift register (74HCT164 or 74LS164 can be substituted).  RS 276-2841, JDR 74HC164, Jameco 45487

J1

DB-9 RS232 female PC mount connector, JDR DB09SC, Jameco 15780

J2

 2.1 mm male power jack panel mount RS 274-1582, Jameco 151554

SW6

.100 3-pin header and shorting block, JDR JDR-40 JDR JUMPER-KT-10; Jameco 109575, Jameco 22023

Q1,Q2

2N3904 NPN transistor TO-92 RSU 11328564, JDR 2N3904, Jameco 38359

VREF1

LM385Z 2.5v 3% voltage reference TO-92 or LM 336

JDR LM385Z-2.5, Jameco 24109

VREG1

LM317T voltage regulator TO-220 RS 276-1778, Jameco 23579

LED1

DUR13C common cathode 7-seg LED 10 leads or equivalent Jameco 17187

LED2

5V miniature LED 2.0 mA or greater (or change value of R19 to limit current) RS 276-310, JDR LED-101, Jameco 114673

POT1

10K audio (linear ok) taper pot w/ on-off switch. RS 271-215, RS.COM 90-7889

KNOB

¼ “ diameter knob for potentiometer RS274-403, Jameco 104176

RCA1, RCA2, RCA3, RCA4

4 RCA jack assembly. – Radio Shack 274-322

RCA plugs

4 RCA plugs mounted as part of the handle assembly.RS274-384 JDR RCA-RP, RS.COM 91-4088

SPKR

0.4 W 8 ohm miniature flat speaker, 1.25” x 1.25” x .25” Jameco 34024 or JDR TP30S or Radio Shack 273-091

Case

4.7” x 1.4” x 2.6” plastic instrument case.  Hammond 1591CSBK or equivalent. DigiKey # HM104-ND RSU 11907706. Next size up for more room is Radio Shack 270-1803

B1,B2

Double AA plastic battery holder- end to end. DigiKey BC12AAL-ND Side-by-side mounting (RS 270-408) requires larger case

Handle 1-4

1/2" pvc pipe and flat caps – available from local lumber materials company.

ICSocket2

8 pin .300 center IC socket RS276-1995, JDR 8 PIN ST Jameco 51570

ICSocket1

28 pin .300 center IC socket RSU 11354321, JDR 28STSK, Jameco 112299

Wire1,Wire2, Wire3, Wire4

10’ section black lamp power cord, telephone cable or speaker hookup wire, 20-22 gauge

SW1,SW2,SW3,SW4

Momentary contact Norm open push-button miniature switches RS275-1547, JDR SP/ST-P Jameco 164654

Hardware

3 4-40 x 1/2” screws, lock-washers, and nuts to mount the 4 position RCA plate and TO-220 voltage regulator.

CD1

Programming software and manual, diagnostics- downloadable from www.questkit.com .

 

 

 

Miscellaneous:

 

Electrical tape, semi-gloss paint

9V-12V unregulated DC wall supply w/ 2.1 mm center positive female plug 200 mA or greater

Hookup wire

 

The following are available from QuestKit:

 

A complete kit consisting of electronic parts, switches, potentiometer, sockets,  circuit board,  case with precut holes,  handle assemblies with precut holes, hookup wire for handles,  CD with software, and detailed assembly instructions is available for $74.95 plus $7.50 standard ground shipping/handling (the optional unregulated DC power supply, batteries, and serial cable are not included – these are available at many local outlets)

 

A kit consisting of all of the above without the case, handle assemblies, and hookup wire is available for $59.95 plus $5 standard ground shipping/handling.

 

Printed circuit board, PIC 16F873 diagnostics-programmed processor and serial EEPROM available for $24.95 + $4 standard ground shipping/handling.

 

Commented source code and software license for the PC user interface and high-level algorithms is available for $19.95  plus $3 standard ground shipping/handling.

 

Colorado residents please add 3% sales tax

 

QuestKit

3124 Appaloosa Ct.

Ft. Collins, CO 80526

970-206-1292

 

Order at www.questkit.com

MasterCard, Visa, personal checks or MO accepted