In this video we are going to build our own digital pet using Arduino, a Tamagotchi clone.
With over 76million units sold worldwide Tamagotchi was one of the most popular toys of the 90s.
As you can see on the small OLED display we take care of a small dinosaur. Using the meters, like the hunger meter, the happy or the discipline meter we can determine how healthy and well behaved the dinosaur is. We can feed the dinosaur, play with it, visit the doctor when it gets sick and many more things. As you can see, the game offers great features and animations. It is a very addictive toy, I remember playing with a Tamagotchi for months when I was a kid. I still remember the day that my first Tamagotchi died. This project brings back so many memories from my childhood and that’s why I decided to build one.
This project is developed by Alojz, a friend from Serbia. He has done an amazing job. I discovered his work a few months ago. He has built a website where he shares everything about this project. The code, the schematic diagram, even a 3D printed enclosure for it. He has done a fantastic job in this project. Even if you are not interested in building the project, study the code. Alojz is a very skilled developer so you are going to learn a lot from his code.
Project Page: https://alojzjakob.github.io/Tamaguino/
In order to built this project we need the following parts:
- An Arduino Pro Mini ▶ http://bit.ly/ArduinoProMini
- An I2C OLED display ▶ http://bit.ly/OLED_DISPLAY
- 3 Push buttons ▶ http://bit.ly/100Buttons
- A small speaker or a buzzer ▶ http://bit.ly/SmallSpeaker
- A switch ▶ http://bit.ly/Switch10PCS
- A LiPo Battery charging board ▶ http://bit.ly/LiPoCharging
- A 150mAh Lipo Battery ▶ http://bit.ly/LiPo150
- A 10K resistor ▶ http://bit.ly/ResistorsB
- A 7x5 cm prototyping board ▶ http://bit.ly/PrototypingBoard5x7
- An FTDI programmer ▶ http://bit.ly/FTDIB
- Some wires ▶ http://bit.ly/Wires3InOne
The cost of the electronics is less than 15$!
If you are going to 3D print the enclosure you are also going to need two rolls of wood filament. I used FormFutura’s Easy Wood Birch and Coconut filaments.
Coconut filament ▶ http://bit.ly/WoodFilamentCoconut
Birch filament ▶ http://bit.ly/WoodFilamentBirch
For the enclosure we need about 70gr of material, so it will cost us around 5$.So the total cost of the project is around 20$.
The 0.96" OLED display is a very nice display to use with Arduino. It is an OLED display and that means that it has a low power consumption. The power consumption of this display is around 10-20 mA and it depends on how many pixels are lit.
The display has a resolution of 128×64 pixels and it is very small in size. Furturmore, it is very bright and it has a great library support. Adafruit has developed a very nice library about this display, you can find this library here. In addition to that, the display uses the I2C interface so the connection with Arduino is extremely easy. You only need to connect two wires except from Vcc and GND.
If you are new to Arduino and you want an inexpensive and easy to use display to use with your project, start with display. It is the easiest way to add a display to your Arduino project.
Get it here ▶ http://bit.ly/OLED_DISPLAY
First of all let’s build the electronics. I used this small 7x5cm prototyping board to solder all the electronics together. It was the first time I was using a prototyping board in a project so I didn’t know how it was going to turn out. I first arranged all the parts on the prototyping board and then I started to solder the parts one after another according to the schematic diagram.
One hour later everything was soldered. It turnout out to be easier than I thought. It was then time to load the code to the Arduino Pro Mini. I used an FTDI programmer to load the code and everything was working fine!
Then it was time to build the battery circuit. I used this small LiPo charging board that is capable of charging and protecting LiPo batteries. The default charging current that the board provides to the battery is 1000mA. This is too big for our small battery. We are using a 150mAh battery so the charging current can’t be more than 150mA. So we have to remove this resistor here and replace it with a 10K one. This way we reduce the charging current to around 130mA which is ideal for the 150mAh battery. Now it was time to move on to the enclosure.
The next step is to 3D print the enclosure. I designed this enclosure using Fusion 360 free software.I tried a lot of different 3d design software but Fusion 360 became my favorite for the following reasons.
- It is very powerful
- It is free
- It is relatively easy to use
- There are a lot of tutorials online on how to use this software
That’s the design I came up with. It consists of 5 parts, the base, the top cover and 3 buttons.
Download the enclosure file from Thingiverse ▶ https://www.thingiverse.com/thing:2374552
Then it was time to 3D print the enclosure. I used two Wood filaments in order to print the enclosure. I used FormFutura’s EasyWood Coconut and Birch filaments. The enclosure uses around 70gr of filament, so it will cost you around 5$ if you print at home. As you may have noticed I use wood filaments in every project! I really love the texture and the color of wood filaments. So, after about 3 hours all the parts were printed.
So, after about 3 hours all the parts were printed. Then it was time to sand them using fine sand paper, a tedious and time consuming process. After the sanding process was over I applied wood varnish to all the parts and let them dry for 24 hours. The result was great! The parts look so cool with the varnish applied.
Please don’t skip the sanding and varnishing process, it will make your projects look impressive.
Then it was time to put everything inside the enclosure.
I first glued the prototyping board in place and then I glued the battery charging board and the switch. I attached the battery to the board using some standard glue. Don’t use hot glue on a LiPo battery, you are going to destroy it.
The next step was to solder the output pins from the battery shield to the Arduino Pro Mini power pins. Then I glued the buttons, and lastly it was time to glue the top part of the enclosure!
The Tamaguino Project was ready! With the 150mAh battery inside the project can run on batteries for over 7h! Of course we can easily recharge it in about 1h using a cell phone charger.
Let’s now take a quick look at the code. You can download the code from the project website.
I used the code which uses the Internal Pull Up resistors of the Arduino board so we don’t need to use any external resistor to make the project work. In order to project to compile we need two familiar libraries, the Adafruit GFX library and Adafruit library for the OLED display. You can find links for the libraries in the description below.
The code is about 1.300 lines long, and it uses 95% of the available program memory! If we need to expand the code of the project we are going to need to use another microcontroller with more memory available. I think it is impressive what a simple low cost Arduino board can achieve!
As I final thought I think that this is a great project. A project that demonstrates that makers can now build almost anything! It took Alojz, the developer of the code about one week to write the code in his free time. Open software and hardware enable us to do things, that few years ago were impossible even to professionals!
Building this project was a great learning experience for me. It was the first time I was using a prototyping board and the first time I was using a LiPo battery in a project. Also, I designed this enclosure from scratch which was more difficult than I expected. To be honest I am not satisfied with enclosure, it is way too big for such a small display. That’s why I am thinking to replace this small 1” OLED with a bigger 2.4” display I have discovered. I think it will make the project much better. I would like this project to evolve into an Arduino game console. This project is good start. I would love to hear your opinion about this project. Do you have any improvement suggestions? Please post your comments in the comments section below! Thanks!