Tamagochi-Halloween Dog Ghost

My Tamagochi project is literally a mechanical animal toy: a dog ghost who response to people around him and  reacts when people try to pat him.


It may seems to be strange, but the source of my inspire is exactly Tamagochi itself. I owned a toy like this when I was a little kid, and I enjoyed the little digital pet since I couldn’t own a real pet. That’s why I wanted to created some thing similar to a toy animal, but with some funny twist in it.


The major design of my Tamagochi includes two parts: the sonar sensor and light sensor which detects motions around the toy; the other part is the servo on the top of the doll, which makes the doll vibrate and turns around as programmed.

Design In Process

My original design was quite different from the final one. The original design includes:

-a sonar sensor array which can detect people’s approaching from three directions

-a mp3 shield which plays sound effect when needed

-a color sensor which can mimic the color of people’s clothes with an RGB led.

-a piezo element which detect tapping


Unfortunately, most of them were discarded due to following reasons:

-the mp3 shield somehow slows down the whole program, which resulting the sonar senor not being able to detect approaching fast enough.

-the color sensor can only read color very close to it, which makes it impossible to function as an “eye”, observing color from a relatively far distance

-piezo element detects a large range of tapping rather than within a specific area, which makes the idea of “tapping the right spot” insignificant.

-sonar array actually works fine as expected, however the idea of the doll “seeing” peoples’ approaching and turn away from them always seemed to be missing some piece.


Eventually it occurs to me that rather than waiting the doll to turn back and face the audiences again, it would be a lot more interesting and funny if the doll actually invites people to tap it, and it make it ever better if the audience have to chase the patting spot since the doll will keep turning away and try to evasive their hands. The invitation of interaction was the key to turn the doll into a robot.



The code itself is fairly long so it might be better if I just explain the logic behind the code here:

1)the sonar sensor keeps checking if there is anything approaching, while the servo constantly vibrates as if the ghost dog is slightly shaking

2)if anything get into the sonar detecting range, servo turns to a random direction

3)if the object (audiences’ hands, in this case) follows the sensor, the servo turns into another direction

4)if the light sensor is tapped and cannot detect light anymore, the green LED lights up, servo turns back to its original position. Sonar sensor is turned off.

5)wait for 3 seconds, then the servo and sonar senor back online.


Although the design of this project has been altered a few times in process, the final result functions quite close to what I original wanted to create: a machine pet which react to people’s behavior, just as what a traditional tamagochi does. And from the feedback I received during the exhibition, I believe the audience did enjoy playing with it. I had a lot of fun while trying to figure out the best way achieve the result I want, and the final result is satisfying. There are two things I would like to change though:

1) I hope I could find a way to make the mp3 shield to work. It would be even funnier if the ghost dog can actually talk when moving

2) the fish line only merged as a problem after the testing has been almost done. The robot, however, was designed to be hanged on the ceiling by a fish line. The sonar sensor was placed in a position where the audiences’ hands would be detected if they want to touch the “pat spot” from the same level. However, after the fish line accident (which ruined my first prototype), I switched to a clamp and mounted the doll between two chair. Naturally, it’s not positioned on a level which is a lot lower than I expected. People have to crouch to be detected by the sonar sensor. If they try to tap the doll from above, the servo would not turn at all.

In my future projects, I will make sure more test would be done before the final deadline to avoid these kinds of problems. Overall, the project was enjoyable and educational. Thank you!