loading
The Lazy American

The Lazy American Robot started out as a joke and actually turned into something useful. Utilizing two ultrasonic sensors, the robot senses the direction that a human is walking and tries to center the human with the two sensors. Depending on which pulse reaches the sensors first, it can determine what direction relative to the front of the robot the human is walking. After reading the data from the pulses, the power to each of the motors is changed to correct its path. This robot is able to carry somewhat heavy loads, but with different materials and better parts (especially motors), the robot can carry heavier and bulkier objects.

This instructable will cover all of our design process, but its main focus will be the ultrasonic tracking system.

Step 1: Parts

Parts:

1x - Arduino Uno
2x - Breadboards
1x - PCD
2x - VEX 3-Wire Servo Motors
2x - VEX 4" Wheels
2x - VEX 2 3/4" Omni-Wheels
6x - Lock Plates
1x - Rechargeable 9v (more recommended if using for extended period of time)
2x - 9.6v VEX batteries (more recommended if using for extended period of time)
1x - VEX battery charge station
2x - VEX Ultrasonic Sensors
2x - VEX 36-tooth Gear
2x - VEX 84-tooth Gear
17x - 15" Slotted Angles
6x - 8" Bars
2x - 12 1/2" C-Channel
1x - 10" C-Channel (sawed off)
1x - 3" C-Channel (sawed off)
4x - 7 1/2" x 2 1/2" Metal Plates
4x - Metal Gussets for holding Ultrasonic Sensors (2 per sensor)
2x - 5" angle pieces
2x - 7 1/2" angle pieces
4x - Supporting pieces ~ 4" (sawed off from 8" bars)
4x - 4" axles
2x - 3" axles
14x - Shaft Collars
2x - 7 1/2"  other angle pieces
4x - 2" standoffs

A strip of Gorilla Tape/Duct Tape

Assorted bolts, Keps nuts, and rivets

Many breadboard wires

Step 2: Assembling the Frame

Construction:

Note - This robot can be assembled any way or configuration you so please. The following step will describe how WE built it. Feel free to mimic our design, but also remember that this robot can be built any way you want; it's the ultrasonic tracking system that counts.

1. To begin, start by using four 15" slotted angle pieces and forming a square, where the sides face in and up. Keep the long slots perpendicular to the ground and the short slots parallel to the ground. Do this three times.

2. Add the 8" bars to the outside corners of the first frame. Then add the second frame on the eighth hole (double) of the bar. Attach the third bar to the last hole (single) on the 8" bar and make sure the top is flat.

3. Attach two 15" slotted angles to the 13th hole in from each side on the bottom of the first frame square. Long slots should be parallel to the ground and the short slots should be perpendicular.

4. Attach two 15" slotted angles to the 12th hole in from each side on the top of the second frame square. Long slots should be parallel to the ground and short slots should be perpendicular.

5. Attach one 15" slotted angle so it intersects the previous two pieces (15th/16th slot in) for support. It should be attached onto the bottom of the second frame and the two slotted angles.

6. Attach two angles to the inside of the two slotted angles that are in the middle of the second frame. They should be placed towards the front, from about the first slot to the 15th slot.

7. Attach a metal plate to the previous two angles as well as the two slotted angles on the first frame towards the center. These plates will carry the Arduino and breadboads. Be sure to place a strip of Duct or Gorilla tape on the plate that will carry the Arduino.

8. Attach two rails on the first frame leading to the two slotted angles (they should form a cradle for the 9v battery). Attach the one closest to the plate on the 12th/13th hole and the one farthest from the plate on the 9th/10th hole.

9. Feed an axle through the slot on the slotted angle on the first frame in the sequence: shaft collar on the outside, then slotted angle, then another shaft collar, omni-wheel, shaft collar, slotted angle, then final shaft collar. Do this twice on the front and back of the robot. Make sure to space them so that they don't touch the frame.

10. Attach a VEX motor so that the axle will be towards the back of the robot. The axle should line up with the 9th slot of the slotted angle from the back. In this sequence on the axle: motor, shaft collar, slotted angle, shaft collar, 36-tooth gear, shaft collar, shaft collar.

11. Attach an axle for the wheel so that it lines up with the 14th slot, but makes sure the gear that is about to be attached connects to the other gear. In this order on the axle: shaft collar, pillow block bearing, slotted angle, shaft collar, 84-tooth gear (long part facing towards wheel), wheel, then shaft collar. Do the same for the other side.

12. Attach a C-channel to the frame on the left and right side via 2" standoffs. On the holes for the axles, place the plastic pillow block bearing and feed the axle through the corresponding holes. The block bearings should be on holes 7-9 with the axle for the small gear should be going through hole 7 and rivets should attach the block bearing on holes 8 and 9 (center holes). Holes 12-14 for the wheel should have the same layout, hole 12 for the wheel and 13 and 14 for the rivets.

13. Attach the 7 1/2" slotted angle to 3rd set of double holes on the rail on the back right of the robot. The slotted angle should be parallel to the right side of the robot. Attach a 3" c-channel piece so that it lines up with the 12th slot on the back slotted angle piece on the first frame. It should be attached vertically and to the long slots. Attach another 7 1/2" slotted angle to the c-channel on the 3rd set of double holes. Only one screw can be used on this. After this, attach two metal plates to both of the slotted angles, and then attach a 5" slotted angle on top of the metal plates, one towards the front and one towards the back. This will house the 9.6v batteries.

14. Attach a 10" c-channel to the front of the second frame, coming from the inside of the long slots and coming out towards the front. Center it as much as possible. Afterwards, attach the four metal gussets to the ultrasonic sensors and then attach them to the far left and far right sides of the c-channel.

15. Finally, attach the remaining metals parts on the sides (angled from the c-channel next to the wheels to the sides of the second frame) for support.

Step 3: Wiring

Wiring diagram made in Fritzing.

Step 4: Coding

Finally, here is the code we used:

#include "Servo.h"
#include <SoftwareSerial.h>

const int Trig_pinRight =  7;   // Triggers Pulse for RIGHT Ultrasonic Sensor
const int Echo_pinRight = 13;     // Recevies Echo for RIGHT Ultrasonic Sensor
const int Trig_pinLeft = 12;   // Triggers Pulse for LEFT Ultrasonic Sensor
const int Echo_pinLeft = 8;     // Receives Echo for LEFT Ultrasonic Sensor
long durationRight;            // Time it takes for pulse to bounce back to RIGHT Ultrasonic Sensor
long durationLeft;             // Time it takes for pulse to bounce back to LEFT Ultrasonic Sensor

Servo motorLeft;               // LEFT VEX Motor
Servo motorRight;              // RIGHT VEX Motor

void setup() {

  Serial.begin(9600);           // Set up Serial library at 9600 bps

  Serial.println("Initializing...");  // Print Initializing... to confirm code is working with Serial Library
 
  motorLeft.attach(11);         // LEFT Motor is in pin 11
  motorRight.attach(10);        // RIGHT Motor is in pin 10
 
 
  Serial.println ("Starting");
  // initialize the pulse pin as output:
  pinMode(Trig_pinRight, OUTPUT);     
  // initialize the pulse pin as output:
  pinMode(Trig_pinLeft, OUTPUT);     
  // initialize the echo_pin pin as an input:
  pinMode(Echo_pinRight, INPUT);
  // initialize the echo_pin pin as an input:
  pinMode(Echo_pinLeft, INPUT);      
 
}


void loop()
  {                                                          
    
    // Pulse and Echo for RIGHT Ultrasonic Sensor ; Process for determining and printing the durations for RIGHT Ultrasonic Sensor
   
    digitalWrite(Trig_pinRight, LOW);    
    delayMicroseconds(2);
    digitalWrite(Trig_pinRight, HIGH);
    delayMicroseconds(5);
    digitalWrite(Trig_pinRight, LOW);
    durationRight = pulseIn(Echo_pinRight,HIGH);
    Serial.println("durationRight: ");
    Serial.println(durationRight, DEC);
   
    // Pulse and Echo for LEFT Ultrasonic Sensor ; Process for determining and printing the durations for LEFT Ultrasonic Sensor
   
    digitalWrite(Trig_pinLeft, LOW);
    delayMicroseconds(2);
    digitalWrite(Trig_pinLeft, HIGH);
    delayMicroseconds(5);
    digitalWrite(Trig_pinLeft, LOW);
    durationLeft = pulseIn(Echo_pinLeft,HIGH);
    Serial.println("durationLeft: ");
    Serial.println(durationLeft, DEC);
   
    if(durationRight > 0 && durationRight < 4000 && durationRight > 0 && durationLeft < 4000) // STOP when HUMAN is too close to both sensors
        {
            motorLeft.write(90);
            motorRight.write(90);
        }
    if(durationRight > 4000 && durationRight < 10000 && durationLeft > 4000 && durationLeft < 10000) // MOVE FORWARD when HUMAN is equadistant to both sensors
        {
            motorLeft.write(113);
            motorRight.write(68);
        }
    if(durationLeft - 1000 > durationRight && durationRight > 4000) // TURN RIGHT when HUMAN is close to RIGHT sensor
        {
            motorLeft.write(120);
            motorRight.write(100);
            delay(500);
           
            motorLeft.write(120);
            motorRight.write(75);
            delay(2000);
        }
    if(durationRight - 1000 > durationLeft && durationLeft > 4000) // TURN LEFT when HUMAN is closer to LEFT sensor
        {
            motorLeft.write(100);
            motorRight.write(75);
            delay(500);
           
            motorLeft.write(120);
            motorRight.write(75);
            delay(5000);
        }
    if(durationRight > 10000 && durationLeft > 10000) // MOVE FORWARD FAST when HUMAN is too far away but still equadistant
        {
            motorLeft.write(135);
            motorRight.write(45);
        }
  }
Hi! i like ur project~~i m just a beginner in robotics. Can i ask u how can the ultrasonic sensors differenciate the detection of human or object? is that through the codes?.thanks ( waiting for ur response ) :)

About This Instructable

4,494views

4favorites

License:

More by GHPTechObesityEnt:The Lazy American Robot 
Add instructable to: