One day I was sitting behind my desk at work and I got that weird need to build something, after looking around for a bit I got my eye on an LED matrix and that sparked an idea in my head : “I WANNA MAKE A TAMAGOTCHI”.
So for those of you that don’t know what the heck is a Tamagotchi here is a little snip-it from Wikipedia :
“The Tamagotchi (たまごっち Tamagocchi?) is a handheld digital pet, created in Japan by Akihiro Yokoi of WiZ and Aki Maita of Bandai. It was first sold by Bandai in 1996 in Japan.”
So my take on this classic toy is to make it in to a desktop gadget with an LED matrix for a display, and an Arduino for brains to make it more accessible to people. With that said join me as we design, build and program the World’s first (As far as I know) desktop Tamagotchi.
Step 1: Getting The Right Stuff
So like any other electronics project you will need to get some basic tools:
1) Soldering Iron
2) Some solder wire
3) A pair of cutters
4) A pair of needle nose pliers
Optional : Get some solder braid or a solder pump to fix soldering mistakes
As for the electronics the parts list a bit longer, here is what you will need to get:
1) An ATmega328P with the arduino boot loader + 16Mhz crystal with two 22pF caps
* You will need something to program the chip as well like an arduino platform or an FDTI adapter
2) 4 x 74HC595 shift registers
3) 2 x ULN2803 Darlington transistor array
4) 1 x DS1302 RTC + 32.768kHz Crystal
5) 1 x 3V coin cell battery holder + the battery.
6) 4 x right angled push buttons
7) 1 x Peizzo Buzzer
8) 4 x 8×8 LED matrix modules
9) 16 x 330Ohm resistors (you will need to calculate the value for your matrix)
10) 2 x row of 16 female pin headers
11) 2 x row of 16 male pin headers
12) 1 x row of 4 female headers(For programming)
13) 5 x 100nF cap
14) 1 x 10uF cap
15) 1 x 10K resistor
15) Power jack connector
16) 5V DC wall wart
17) A big piece of proto board
18) Some wires for connections
Step 2: The Hardware Side
Even if this project if mostly software focused we will need to build the hardware first to make life writing code and debugging it easier.
The hardware consists of 2 main parts: The microcontroller part and the LED display.
The microcontroller part is very straight forward, it’s an standalone arduino(ATmega328 with the arduino boot loader) with
some peripherals(4 buttons, a buzzer and an RTC), but the it’s the most critical part as it does all of the thinking.
The LED display part is a bit more complex and takes some time to solder up. This circuit consists of 4 shift registers (74HC595),
2 Darlington transistors arrays (ULN2803) and 4 8×8 LED matrices.
Like most LED displays it comes as no surprise that the display need to be multiplexed(look it up it’s a pretty cool concept) because driving 16×16 LEDs individually will take 256 pins from the microcontroller and that’s just silly.
Even with the multiplexing approach we will still need 32(16 rows + 16 columns) pins from the microcontroller to drive the display which again we don’t have, so the solution is to use shift registers as an I/O expansion , 4 8 bit shift registers give us 32 outputs and it only takes 3 lines to control them all.
But the problems don’t end here because the shift registers can’t handle sinking the current of 16 LEDs (if a full row is lit) on one pin so we need to give it a hand with the help of the Darlington transistor array that will act like a buffer that can handle big currents which can fry the shift registers.
Read More: Make a Desktop Tamagotchi