he goes through mazes

EDWARD (Electronically Driven Wireless Autonomous Roving Droid) is a robot I began building in 8th grade. He navigates through a maze by mapping out its environment in its mind and using the Pythagorean Theorem to choose the best route. Here are the different components that make up EDWARD:


The Arduino Uno

Arduino Uno

The brain of EDWARD. Contains the main program and controls everything from driving motors to communicating with the computer.

The Ultrasonic Ping))) Sensor

Ultrasonic Ping))) Sensor

EDWARD uses this to map his world and store it in his memory.

Servo Motor

HS55 Servo Motor

Moves the ping sensor left and right so that all sides of every square of the maze can be scanned.

Continous Rotation Servo Motor

Continous Rotation Servo

Drives the wheels to turn EDWARD, who has a ball-bearing as a third point of contact.

XBEE Sensor

XBEE Wireless Module

Provides communication with the computer so it can display what the robot knows for debugging purposes.

Erector Wheel

Erector Wheels

Rubber treads provide ample friction for EDWARD. Difficult to mount, however, due to their three screw holes and the motor horn's four.

Arduino XBEE Shield

Arduino XBEE Shield

An easy way to connect the XBEE to the Arduino. The only issue is that since the XBEE uses the same Serial port as the USB plug does, the radio module must be unplugged to upload code.


In order to sucessfully navigate his world, EDWARD must make a large number of decisions. View this flowchart to see his process.


These are some of the major components that make up the code on the Arduino. View the code on Github

Class Robot

Wrapper class, containing classes that manipulate the physical parts of the robot as well as class Map to remember everything the robot has learned. Also stores states only relevant to the robot such as x/y coordinates and its destinations. Most member classes are private as class Robot contains access methods so the integruity of the internal state variables is maintained.

Class Locomotion

Manages two Servo objects to coordinate the movement of the robot.

Class Map

A glorified array access Stores information about the maze. It consists of a grid of Squares. Provides access regulation and insures state integruity

Class Ping Sensor

Just a wrapper for a function to determine the distance from the sensor to the closest object.

Class Motorized Sensor

Includes a Servo object and a Ping Sensor object, ensuring that the head is only moved in conjunction with taking readings, and vice versa.

Class Square

Keeps track of where walls are; if the sides have been mapped yet; if an opening has been passed through by the robot; if an opening leads to a dead-end; and where the square was first entered.


The program uses two different enumerations. One to represent absolute (compass) directions and the other to represent relative (front, right, back, left) directions. Before I added these their were many issues when I accidentily converted between the two. Instead I now have a suite of functions to do that correctly.

Function WhichWay

This is the most important function in the entire program. It measures the distance to the goal from every adjecent square of the robot using the Pythagorean Theorem. It then compares these distances and returns the direction that will lead to the shortest distance that is also not known to lead to a dead end and is not a wall. If no side is valid, then the robot is trapped. If the only valid way is to go back the way it came, then the loop() function will set the backtracking variable of the Robot object to true.

Computer Display

The computer runs a processing script that picks up information from the serial port. After scanning walls, EDWARD sends information over XBEE to the computer with information on where the robot currently is and what is around it. The processing sketch stores that information and displays in in a color-coded grid, to assist debugging.

comments powered by Disqus