Skip to the content.
Lab 1

Lab 1 Page

Construction

Using the parts provided, the robot was assembled from scratch. It has two wheels controlled by servos and a caster wheel at the curved part of the frame. The curved part where the caster wheel is serves as the back of the robot. A 9v battery and 6v battery supply are both attached to the frame. One near the front, the other near the back. Velcro is used to attach them to the frame. A breadboard is then mounted on top of the power supplies, also using velcro.

Servo testing and Programming

The servos attached to the wheels operate in a forward or backward motion. The library used to aid in controlling these servos is the Servo library, that can be downloaded with the Arduino library manager if not already present. With this library two servo objects are created and then the attach function is used to specify the pins to which the Arduino must output to in order to control the servos. The write function is used to control the direction and speed of the servo. For one servo, entering an input of 0 to the write function causes forward motion at full speed and 180 causes reverse motion at full speed. A value of 90 causes both to stop and for the other servo, to move forward or backward is the opposite of the first servo. Any other value in between till 90 basically decreases the speed. Left and right turns are implemented by stopping one wheel and keeping the other moving in the forward direction. As to the accuracy of these turns, the feedback input from the servos were not used and hence we relied on timing for the turns.

Ultrasonic Sensor Testing

Next, 3 ultrasonic sensors were mounted on the robot, the left and right ones were attached directly to the breadboard and the one in front, was attached using velcro and the pins were connected using jumper wires. Pins with Pulse Width Modulation Capabilities were used to attach these sensors to the arduinos. There was one pin to serve as the output trigger and the others as echo pins. Using pre-written code and placing objects in front of all three ultrasonic sensors at different distances, we determined that they did work

Ultrasonic Sensor plus Servos in action

For the last part of the lab,servo and ultrasonic sensor functionality was put together in code so the robot could navigate a simple maze

A screenshot of the serial monitor as the robot moves through the maze