Introduction: Bumbley - the Little Servo Robot

Meet Bumbley, a little lost bot from the planet Teekmar'd - a small world that orbits Wolf 359. Bumbley likes to find good hiding places and avoid human contact at all cost! He can only see in infrared, so needs your help. So please help him find a good hiding place!!! :-)

Bumbley is a servo driven bot, made of 2 Actobotics channels and 1 mounting hub. It has two continuous 360deg servos, two 4 inch wheels (@100mm), one rear uni-direction rear ball caster, an Arduino Uno clone with a V5 sensor shield and 2 infrared (IR) sensors for object detection. It's powered by two battery packs - one to power the Uno and the other to run the servos and sensors.

Little Bumbley is a very basic object avoidance rover that uses IR to find anything in it's path. The chassis itself, is made to be maneuverable, expandable and easy to assemble with a minimum amount of parts, but a good solid platform to build upon.

Step 1: Parts Needed

Bumbley is made from these parts:

    • Arduino Uno or clone with sensor shield x1 each
    • 3.75" or 4.50" Actobotics channel (for the rear of the chassis) x1
    • 6" Actobotics channel (for the front of the chassis) x1
    • 90deg hub mount x1
    • Standard Servo Plate B x2
    • Lightweight servo hub horn x2
    • Continuous rotation servos x2
    • IR sensor x2
    • 4" (100mm) wheels x2 (one pair)
    • Arduino Channel Snap Mount
    • 5/8” Roller Ball from ServoCity, Harbor Freight or other supplier of your choice
    • 2” 6/32 pan-head screws with 3 washers and 3 nuts per screw. From a local hardware store - x2 sets
    • 6/32 3/16" or 1/4" pan or socket head screws x25
    • 4 rechargeable 'AA' batteries (to power the servos and sensors)
    • 1 9v alkaline or rechargeable battery (to power the Uno ONLY!)
    • Battery holder with wire or wire clip holder 4 'AA' batteries
    • 1x wire clip for 9v and 1x for 'AA' if you get the wire clip holder
    • Female to Female Dupont jumper wires
    • Voltage meter (optional, but good to monitor the bots motor voltage)
    • Small zip-ties and double sided tape
    • Googly eyes (optional :)
    • Tools: 7/64 Hex key, small Phillips and flat-head screw drivers

    You can source many of the parts from eBay or other suppliers directly. Structural parts can be gotten from Sparkfun, RobotShop and ServoCity. Continuous rotation servos can be found at various sellers on eBay, ServoCity, Parallax etc.. Or you can modify them yourself for 360deg rotation, but I will not cover that in this Instructable.

    Step 2: The Software Needed

    Things you will need to download:

    • The Arduino IDE
    • The Robot code below or the attached .zip

    Step 3: Assembly - the Chassis - 1

    1. Mount the 90° Quad Hub Mount to one end of the 3.75" or 4.5" channel as pictured.
    2. Using the 90° Quad Hub Mount, connect the 3.75" or 4.5" channel together with the 6" channel as shown in Figure 1 (See pics) Use the 7/64 hex key to lightly tighten down all the screws.
    3. Next, mount the servos in the servo brackets (see picture)
    4. Now place the mounted servos in the ends of the 6" channel as pictured

    Step 4: Assembly - the Chassis - 2

    Once the Chassis is all made-up, you can attach the rear ball caster to the end of the 3.75" or 4.50".

    Take the 5/8" ball caster the two (2) 6/32 2" bolts, six (6) washers and six (6) nuts. Place a washer on the first screw then slide it in the caster with the ball facing down and the bolt pointing up. Now place another washer on the screw then a nut and thread it all the way to the bottom of the screw. Then take the second (2nd) nut and thread it down around 1/4" then add a washer, place the screw in the underside of the top beam on the chassis and add the last washer and nut. Hand tighten only. Do the same for the second screw on the caster and then adjust the nuts at the top and underside to level the chassis out. Tighten all the nuts on the caster assembly now.

    See pictures for more details.

    Step 5: Assembly - the Chassis - 2

    Next attach the lightweight servo hub to the wheels as pictured. Now remove the paper (optional) and place the rubber tire on the wheel. Afterwards, place the completed wheels on the servos already on the chassis.

    Step 6: Adding the Arduino and Shield to the Chassis

    Now connect the Arduino holder onto the 3.75" or 4.5" channel. Then place the Uno and sensor shield into it as pictured.

    Step 7: The IR Sensors

    Place the IR sensors on both ends of the 6" channel as pictured. You may need to use double sided tape to keep any connections from shorting on the chassis. Tie them down with zip ties or if you have standoffs, you can use those as well.

    Step 8: Connecting the Components Up!

    1. Connect the left servo motor to the pin 6 connector on the sensor shield. The Left servo motor is the to the left side with the bot facing AWAY from you. The signal wire of the servo is usually a white or orange wire.
    2. Connect the right servo motor to the pin 7 connector on the sensor shield. The Right servo motor is the to the right side with the bot facing AWAY from you. The signal wire of the servo is usually a white or orange wire.

    3. Connect the left IR sensor signal to the pin 5 connector on the sensor shield and the GND and vcc to the same Pin set. The Left sensor is the to the left side with the bot facing AWAY from you.

    4. Connect the right IR sensor signal to the pin 4 connector on the sensor shield and the GND and vcc to the same Pin set. The Right sensor is the to the right side with the bot facing AWAY from you.

    5. If you choose to use a Volt meter for the bot, place the GND wire of the meter to the GND wire of the sensor shield. Place the POS (vcc) wire of the meter to VCC of the shield.

    Step 9: It's Time to Load the Code!

    With the wiring checked and rechecked, It's time to load the code. Follow the instructions on the Arduino site on how to install the Arduino IDE. After the IDE is installed, copy the below program and past it into the Arduino IDE. Connect your PC and Arduino up with the USB cable. Now choose the board from the Tools->Board menu in the IDE, Uno for this project (choose the board you have if different from Uno) Now from Tools->Port menu, pick your com port. After this is done, click the upload button. If all went well, the code was loaded, if not see here for help on the IDE and related issues.

    /*
    Bumbley the Arduino obstacle avoider.

    Goal in life... Bumblels around trying to stay out of your way :-)

    Written by Scott Beasley - 2015 Free to use or modify. Enjoy. */

    */ Uses the Arduino Servo library. */

    #include <Servo.h>

    // Turn based on clear direction or left if both are blocked #define turn(dir) (dir >= 2) ? go_left () : go_right ()

    // Change these defines if you use differnt pins #define LEFT_IR 5 // Digital pin 2. #define RIGHT_IR 4 // Digital pin 5 #define LEFT_SERVO 6 // Pin used for the left servo #define RIGHT_SERVO 7 // Pin used for the right servo

    // Speed defines #define MAXFORWARDSPEED 120 // Max speed we want moving forward #define MAXBACKWARDSPEED 60 // Max reverse speed #define STOP 90

    // Various time delays used for driving and servo #define TURNDELAY 450 #define BACKUPDELAY 300

    /* Globals area. Try to keep them to a minimum :-) */

    // Create the servo objects with use to interface with Servo motor_left; // Create Left servo motor object Servo motor_right; // Create Right servo motor object

    void setup ( ) { // Un-comment if you want or need to debug //Serial.begin (9600); // Set Serial monitor at 9600 baud //Serial.println ("My Servo SHR bot is starting up!");

    motor_left.attach (LEFT_SERVO); // Attach the servo to the digital pin motor_left.write (STOP); // Set the servo to the middle (neutral) pos motor_right.attach (RIGHT_SERVO); // Attach the servo to the digital pin motor_right.write (STOP); // Set the servo to the middle (neutral) pos

    // Set modes for proximity sensor pins pinMode (LEFT_IR, INPUT); pinMode (RIGHT_IR, INPUT);

    // Delay to give user time to make adjustments. Remove after done. //delay (30000); }

    void loop ( ) { byte direction;

    // Get a reading from the current sensor direction direction = read_ir_sensors ( ); //Serial.print ("IR sensors reading: "); //Serial.println (direction);

    // Go forward while nothing is in the sensors read area if (direction == 3) // Forward, march! { go_forward ( ); } else // There is something in the sensors read area { halt ( ); // Stop! go_backward ( ); // Back up a bit delay (BACKUPDELAY); halt ( ); // Stop!

    turn (direction); // Turn toward the clearest path delay (TURNDELAY); halt ( ); } }

    // Read the sensor after we find something in the way. This helps find a new // path byte read_ir_sensors ( ) { byte lt_sens = -1, rt_sens = -1, direction;

    lt_sens = digitalRead (LEFT_IR); rt_sens = digitalRead (RIGHT_IR);

    if (lt_sens && rt_sens) // Left and right are both blocked, turn left direction = 0; else if (lt_sens) // Left is blocked, turn right direction = 1; else if (rt_sens) // Right is blocked, turn left direction = 2; else if (!lt_sens && !rt_sens) // All clear on both direction = 3;

    return (direction); }

    void go_forward ( ) { //Serial.println ("Going forward..."); motor_left.write (MAXFORWARDSPEED); motor_right.write (MAXBACKWARDSPEED); }

    void go_backward ( ) { //Serial.println ("Going backward..."); motor_left.write (MAXBACKWARDSPEED); motor_right.write (MAXFORWARDSPEED); }

    void go_left ( ) { //Serial.println ("Going left..."); motor_left.write (MAXFORWARDSPEED); motor_right.write (MAXFORWARDSPEED); }

    void go_right ( ) { //Serial.println ("Going right..."); motor_left.write (MAXBACKWARDSPEED); motor_right.write (MAXBACKWARDSPEED); }

    void halt ( ) { //Serial.println ("Halt!"); motor_left.write (STOP); motor_right.write (STOP); }

    Step 10: Adding Power!

    Find a convenient place to put the 4x AA pack, the place in the picture works nicely. You can secure it with velcro, a strap, a zip-tie (a reusable one works best) or mount like this.

    For the 9v battery, you can slide it under the Arduino in the channel easily.

    Once done, you can connect the 4 AA packs GND to the GND terminal of the sensor shield and the POS (vcc) of the same pack to the vcc terminal. Then connect the 9v power to the Uno.

    Step 11: Bumbley in Action!

    Step 12: Servo Setup

    If you notice your servos drifting a bit one way or another, you can use a small screw driver to set the neutral position of the motor. Use the code below to help with that by loading it into your bots controller. After loading this code, power the bot and turn the POT on the servos until they stop moving. If the servo you have does not have an adjustment pot, you will have to find the proper value to get the halt function working by adjusting the constant define STOP value the code uses. By default it's set to 90.

    #include <Servo.h>
    Servo lf_servo, rt_servo; 
    
    void setup ( ) 
    { 
       lf_servo.attach (6); 
       rt_servo.attach (7);
    } 
     
    void loop ( ) 
    { 
       lf_servo.write(90); // sets the servo position to neutral
       rt_servo.write(90);
       delay(15);                          
    }

    Comments

    About This Instructable

    1,993views

    38favorites

    More by jscottb:ESP8266 HTTP IO ServerBoom and Gripper botWeb controlled rover
    Add instructable to: