Tamagotchi Project – Amaze, an autonomous turtle robot


Video to be uploaded…


Amaze is an autonomous robot with four robotic legs, mimicking the movement of a turtle. When it detects an obstacle, it gets scared and moves away from it. But there is a chance it becomes bold and dashes into the obstacle. An open-ended maze sits at the center of the top of its body. With its shaky movement, a ball moves around within the maze.

Emotion and Movement Patterns

  • Calm, moves forward/left/right randomly
  • Cautious, looks around to the left and to the right after each movement
  • Panic, simultaneous movement of fore limbs and rear limbs at a high speed
  • Scared, slowly makes a left or right U turn and moves away at a high speed
  • Bold, slowly makes a left or right U turn but turns around half way and dashes into obstacle

(Refer to Implementation -> Algorithm for more information)


Behavior / Emotion

The turtle robot reacts to obstacles and shows fear, cautiousness, or calmness through a sequence of movements with variable directions and speed.
My original idea was to trigger some behaviors (of the turtle robot) if the maze is being solved. If the “egg” of the turtle gets lost in the maze, the turtle moves furiously. But when the “egg” is returned to the “ending point” of the maze, the turtle calms down and moves slowly again. Then the emotional feedback is based on the maze instead of external environment or humans. So I decided to use distant sensors as input from the surroundings to allow more interactivity.

Kinematic / Kinetic Mechanism

To mimic four-legged locomotion, I initially experimented with four micro servo motors with extension. It didn’t move effectively because the forward sweep of servo arms counter the backward sweep to some extent. I decided to create four limbs with two parts and one joint on each, where each lower limb is limited to swing within approximately 90 degree, like human limbs. I also researched about turtle locomotion pattern and decided to go with what is called Hatchling Terrestrial Locomotion (diagonally opposite limbs moved together) among most sea turtles (Lutz and Musick). This pattern works well with the limb design. There are alternative gaits such as crawling type or eight-legged locomotions like spider. One possibility is to extend the servo arms with turtle flippers to enable swimming.

(Lutz, P. L., Musick, J. A., & Wyneken, J. (Eds.). (2002). The biology of sea turtles (Vol. 2). CRC press. Retrieved from http://www.science.fau.edu/biology/faculty/Wyneken/DOC050817-012.pdf)

Apperance / Material

In order to mimic the appearance of a turtle, I focus on mimicking animal limbs and the shell of turtle. I intended to build everything out of bamboo, which may imply natural life forms. But since bamboo is hard to cut and sand, I went with wooden material for limbs and base.

Interestingly, I found a plastic food platter that has the perfect shape and size for the base for making a turtle robot. Without that, I might have made the base out of wood or bamboo by handcrafting.

For the maze, I tried heating bamboo strips in order to create curvy maze walls. Then I found it is more effective to heat acrylic and bend them manually.

For the shell, I initially wanted to make a dome with turtle shell texture. Since the texture may block the sight of the maze inside, I decided to go with a clear plastic dome.


Arduino Mega 2560
Mini Breadboard x 2
Toggle Switch x 1
9g Micro Servo x 4
Ultrasonic Sensor
5V extended battery for smartphone



The following types of emotions/movement patterns are implemented,

  • Calm, default pattern in each cycle
  • Cautious, triggered after fear level reaches a threshold (currently 3)
  • Panic, triggered if distance from obstacle < 10cm
  • Scared, distance from obstacle < 40cm, probability of event set to 70% chance
  • Bold, distance from obstacle < 40cm, probability of event set to 30% chance

fearLevel, a variable that keep tracks of the number of times Panic or Scared mode is triggered. If it reaches a threshold, Cautious mode is activated and this variable gets reset.

becomeCautious, if set to true, the turtle robot moves to the left and to the right sequentially after a random move. It gets reset after being cautious for certain amount of cycles in the main loop.

To make the turtle react slower, previous and current distance sensor values are checked whenever an obstacle is detected. Only when both of the values break certain thresholds, the emotion pattern changes.

Library used:
NewPing (http://playground.arduino.cc/Code/NewPing)
VarSpeedServo (https://github.com/netlabtoolkit/VarSpeedServo)

Challenges / Resolution

  • achieving smooth movement/added two wheels at the bottom of the base and adjusted limbs’ length
  • synchronizing multiple servo motors with variable speed/used VarSpeedServo library functions; always wait until the slowest servo to complete before set the next positions for the other ones
  • failed to implement backward movement/let robot make U turn instead
  • unable to upload programs to Arduino Nano at some point even after reburnt bootloader/replaced with Arduino Mega 2560
  • working with two or more ultrasonic sensors/used one to detect front
  • determining where to showcase the robot/let it go and pray no one steps on it