Electronic Quiz Christmas Card




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.


Teacher Notes

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.

Solder away!

More gluegun!

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.

Homemade Holidays Contest

Participated in the
Homemade Holidays Contest

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    13 Discussions


    9 years ago on Step 10

    Did you write the PWM software from scratch, or did you base it on some other publicly availabe code?  I want to do something very similar, and and there's no point in re-inventing the wheel.

    2 replies

    Reply 9 years ago on Step 10

    Yes, I wrote it from scratch, but I dont have the code handy sorry. It was really horribly hacked together and I didnt think it was worth keeping.

    It's pretty simple, just make a global array of 1024 bytes if you can, a length variable and a pointer to the oldest byte. then use a timer interrupt to load the oldest byte into the PWM register, (TCCR0 or whatever), increment the pointer and decrement the length.

    In your main loop just keep trying to fill the buffer with as much data as you can.

    If you run the timer in phase correct PWM mode it will cycle every 512 clocks. You want to use the overflow interrupt so the next sample gets loaded every 512 clocks. If you want to sample at 16Khz your timer clock must run at (16*512)=8Mhz, so if you use an 8Mhz crystal you set the divider to 1.

    Remember to keep your interrupt very short!


    9 years ago on Introduction

    since I can't make it myself... where can I buy this kind of card (specially cards for birthday occasions) in Jakarta (Indonesia)?

    Yes, I guess you could but you'd have to find some SD card reading code if you don't want to write it yourself.

    Also check if it runs at 3.3V


    9 years ago on Introduction

    That's the most professional card I've ever seen before. It's just a daydream for me to do that kind of stuff, so I only make ecard with Powerpoint and PPT2ecard.

    The problem is that the Arduino board runs at 5V and the SD card needs power and data at 3.3V. So you'll need a 5V and 3.3V regulator and a level shifter (diodes?). You'd also need >5.5V of power (a cellphone battery is about 3.7V). You could use two cellphone batteries but then charging becomes tricky. I guess you could just use 2 3V coin cells.