Cute Tamagotchi Cow

by Markus Opitz in Circuits > Microcontrollers

267 Views, 6 Favorites, 0 Comments

Cute Tamagotchi Cow

TamagotchiCow-Title.jpg
cow-1.gif

I never had a Tamagotchi, a little electronic pet, when they came out in the late 80s. The graphics were pretty crude to be honest and the button cells were and still are an environmental issue.

But today you can do better. Not for your pocket, but for your desktop. And there's nothing wrong with a cute cow.

So let's build a cow in a barn that you can feed and stroke (we'll skip the cleaning out of the barn).

Supplies

cyd-1.jpg


  1. ESP32 CYD (cheap yellow display) (2432S028R)
  2. suitable power source / power bank
  3. 3D printed parts. or some wood for the barn

or

  1. wood / plywood and color


  1. Arduino IDE software


(Basic experience with Arduino is required)

The Cow Graphics

all_cows.jpg

For our cow, we need a stage/barn with a feeding station and water trough, each of which displays different levels.

The cow should

  1. stand, smile, chew, look sad
  2. eat, drink
  3. lying down ruminating , smile, sleep

These images are stored as code on an extra file named "cow-all.h" and loaded when needed.

The images are self made, you are free to use them.

The Cow Software

The CYD is a fantastic combination of ESP32 and Touchschreeen. It saves you the annoying soldering and cables.

My programming is admittedly a bit amateurish. You can certainly get more out of the CYD in terms of design or give the cow more functions. But at least the program steps are easy to follow.

The library can be used to simulate a wide variety of working surfaces. We don't show a background, but concentrate on the cow, watering place and feeding place. Three click areas are integrated in a hidden manner, i.e. they are not visible but can be clicked in three places: Water and feed place for refilling and the cow itself for stroking.

The cow's status is (soon) saved on the ESP32 so that the device can be switched off at any time and you keep the food/mood status.

The values of hunger and thirst change randomly. The ESP32 counts the milliseconds. These values can be set according to your personal preferences.

The file "cow-all.h" contains all the different cow images in code and must be stored in the same folder as "demo.ino" or "tamagotchi_cow.ino"!

Speaker and LDR Sensor

The speaker for ‘Mooh’ is optional. Unfortunately, I have not yet been able to get the sound function to work without complications with the screen. Every time the SD card is online the touchscreen is not working properly. Any idea?

The mp3 file(s) could be saved on the SD card. The connection pins are on the back of the CYD. I got the speaker from an old fixed line telephone.


The built-in LDR sensor (GPIO 34) tells the cow when to sleep. When it is dark, she lies down. During this time, water and food are not consumed.

Downloads

The Barn

For the ambience, I quickly designed a stable with tinkercad.com and turned it into reality with the 3D printer. Of course, you can also build a wonderful miniature stable out of wood here. Don't forget good ventilation at the back side.

Moooh

Function:

The cow eats and drinks when its internal water and feed levels drop (= hunger, thirst). If the water or feed container is empty, the cow is hungry, unhappy and mooing.

If you tap on water or feed, the supplies are replenished and the cow can eat. If you tap on the cow (= stroking), it is also happy and moos comfortably.

When the LDR notices darkness the cow is going to sleep. She does not eat and does not develop much hunger or thirst.

Have fun with your new pet!