Want to make something interesting for Christmas?
How about an electronic quizzical Christmas card? It plays questions from wave files off an SD card, so you can customise it with thoughtful and/or creepy questions.
If quizzes are quizzical, this card is more of a test.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: The Quiz Game
The card plays the santee questions, and they must answer by pushing the A, B or C buttons.
If they get the answer wrong they have to do a penalty (in this case listen to Boney M christmas carols while repeatedly pressing a key to make sure they don't just run away)
Each time you get a question wrong the penalty level increases (ie you have to listen to an even longer Boney M clip)
Step 2: How It Works
A microcontroller plays 16KHz 8bit mono wav files off the SD card. The files are organised into various questions and answers. The most work is putting together all the questions.
The buttons are rigged straight to the micro.
The speaker is driven using a PWM output, which I suppose is novel. It has some simple external filtering.
The SD Card is operated in SPI mode along with the ISP programming header.
Step 3: Scrounging Parts
I used an Atmel ATMEGA32 AVR microprocessor. Pretty much any AVR, or micro for that matter, will work. I run on a 8Mhz external crystal to keep the timing consistent for the serial port.
I got hold of an old 64Mb SD Card- Make sure you get a 64Mb or bigger card so windows will format it to FAT32.
You’ll also need a battery- I used a knock-off cell phone battery.
You need a 3.3V LDO regulator as well to limit the voltage.
I also found a mini-usb socket for charging the battery
Grab a speaker off an old pair of headphones.
And get some microswitches as well
You’ll also need some odd transistors and passives but you should have this stuff lying around!
Step 4: Power Circuit
The power to the card is switched using a simple piece of card which slots between two wire contacts. When the cover of the card is lifted, the card pulls back and the contacts short, powering up the regulator.
The regulator delivers 3.3V to the micro and the SD card.
The battery is charged via the USB port using a horrid trickle charge circuit.
The battery level will be between 3 and 4 volts, creating a drop of between 1.3 and 0.3 volts across the resistor. This gives a charging current of between 43 and 15mA which is pretty slow, but at least it’s less likely to blow up.
Step 5: Audio Circuit
The audio is driven by the PWM channel running off the system clock at 8MHz in “phase correct” mode (up and down) which takes 512 clocks per cycle.
This means the effective sample rate is 15,625Khz which is close enough to the audio file sample rate of 16Khz.
The resistor and capacitor before the transistor are a low-pass filter. The pot adjusts the response. The 100K value is because this is all I could find!
The transistor operates very inefficiently in an emitter follower configuration.
The resistor/capacitor after the transistor are in the vain hopes of suppressing transients. I don’t know if it works as intended. The card works so I’m happy…
Step 6: Construction Inside
I began by printing out a base card with the positions of the components. I copied and pasted the pinouts of the parts from the datasheets so I’d have a reference right there.
Tack the parts down with the glue gun.
Step 7: Papercraft
Print out a box on card, fold it and glue gun it together!
I made special cut-outs for the SD Card, USB charging pluggy, serial port header and programming header.
Step 8: Software
I stole the SD Card reading software from CC Dharmani. Check out www.dharmanitech.com.
I’m not posting my code because its very messy, and it’s really just tweaked off this guy’s code.
The PWM timer overflow interrupt pulls a new sample out a buffer and sets the PWM value.
The main program tries to fill the buffer as fast as possible from the SD card. It seems pretty effective.
Step 9: Sound Clips
The code plays questions and penalties.
Questions consist of an introduction, a question, three “letter” clips (ie “A”, “B”, “C”), three “Options” (eg “is it”, “or is it”, “or is the answer”), the three answer options, a waiting loop, a “correct” clip and an “incorrect” clip.
I found the who wants to be a millionaire clips somewhere and used those as backing.
Step 10: Finished
Mail it off to some unsuspecting friend.
Participated in the
Homemade Holidays Contest