MY ROBOT, MAKEY

By Kris Magri

Image

Photograph by Sam Murphy

ROBOT ON, DUDE

I’ve made some fun robots, but I never liked the way they look, with their parts stacked up, and black tape and visible wires running everywhere. I decided to build a bot that combined tried-and-true workings with some Hollywood bling. I sketched some ideas, and this is the one that spoke to me.

Makey is an autonomous robot that I’ve programmed to follow objects around. It uses tank steering, aka differential drive, where separate DC motors power each of the 2 drive wheels. A servomotor moves its head, which carries a single ultrasonic rangefinder. Control comes from an Arduino microcontroller, which I’ve programmed to do object following and obstacle avoidance. With these behaviors, Makey constantly turns its head right and left to acquire differential ranging data, adding to its personality.

The chassis design is unusual in that there are no exposed components; I vowed to keep everything enclosed, which made the design harder, but it was worth it.

With different Arduino programming, the hardware would support mapping and other activities, and with a few hardware mods, Makey could also compete in Mini-Sumo, one of the most popular events in robotics competitions.

Kris Magri works at Disneyland as a Mechatronic Engineer. She is responsible for both the electrical and the mechanical issues for show effects and animatronics in Disney California’s Adventure.

BRAINS AND BRAWN

Makey’s Arduino microcontroller brain takes readings from the ultrasonic rangefinder on its head to “see” its distance to nearby objects. Using this data, the microcontroller determines where Makey should look and move next, by controlling the “neck” servo and wheel drive motors.

Image

Illustration by Nik Schulz/L-dopa.com

Rangefinder Many bot builders use left and right IR sensors for ranging, but Makey uses a sonar unit that senses longer distances, up to 10 feet.

Servomotor The servo turns Makey’s neck, enabling its rangefinder to point in different directions.

Motor driver The Arduino’s output pins don’t deliver enough current to power the drive motors directly, so the dual motor driver board takes the signal and uses it to route battery power to the motors.

Breadboard Solderless breadboards are great for wiring up electronics without having to solder. Basically your best friend in electronics prototyping.

ProtoShield Mounts on top of the Arduino, to give you a place to solder your circuitry.

Microcontroller The Arduino reads the rangefinder input and controls the motors. Output pins set the drive motor speeds via pulse-width modulation (PWM) and direct the servomotor using pulse-width position servo (PWPS) pulses.

Skidder Forms a stable triangular base with the 2 drive wheels. The ball bearing is smoother than casters.

Drive motors Each wheel is powered by its own DC motor. This “tank drive” gives Makey maximum maneuverability. By running its 2 motors in opposite directions, the robot can turn in place. Capacitors between each motor’s 2 contacts reduce its noise to the rest of the circuit.

Batteries In single-battery robots, the motors can hog too much power and cause the microcontroller to reset. Makey avoids this problem by using one battery for brains, and another one for brawn.

HOW IT WORKS

For object-following behavior, Makey’s code uses a strategy called “proportional control.” Rangefinder readings are compared to an optimal distance. If they are equal, the drive motors stay still. Readings are taken in pairs, facing right and facing left, with each determining the speed on that side. If nothing is within sensor range, the motor runs at maximum speed.

Image

An object at far left makes the left motor run at proportional speed while the right runs at maximum. This turns Makey left.

Image

An object at dead center and closer than the optimal distance makes the motors run backward equally.

Image

An object slightly to the right makes the left motor run slightly faster, turning Makey to the right.

SET UP.

Image

Photography by Ed Troxell

MATERIALS

[A] Aluminum sheet, 0.032" thick, at least 9"×10", 5052 alloy

[B] 9V batteries (2)

[BB] 9V battery snaps (2) Jameco #11280 (jameco.com)

[C] Jumper wires, solid core, 22 gauge Maker Shed #MKEE3 (makershed.com) or Jameco #19290, or cut your own from solid core wire

[D] Du-Bro Mini E/Z Connectors and Micro Aileron System Hobby-Town USA #DUB845 and #DUB850 (hobbytown.com)

[E] Paint I used Rust-Oleum Painter’s Touch Apple Red Gloss #1966.

[F] Arduino Duemilanove microcontroller The Diecimila version will also work.

[G] Dual motor driver board, 1A Dual TB6612FNG SparkFun #ROB-09457 (sparkfun.com)

[H] ProtoShield kit SparkFun #DEV-07914

[I] Rigid plastic, around 3½"×3½"×1/16"

[J] Lego tires, 49.6×28 VR (2)

[K] Heat-shrink tubing

[L] FASTENERS

Machine screws: 1-72×¼" (2), 4-40×2" (2), 4-40×1" (8)

Sheet metal screws, #6×¼" (4)

Nuts: 1-72 (2), 4-40 (6)

#4 lock washers (4)

" pop rivets (2)

[M] On/off switch, SPST rocker Jameco #316022

[N] Servo extension wire, 12" HobbyTown USA #EXRA115, to plug into the rangefinder, not the servo

[O] 3-pin right-angle male headers (2) Break apart a 10-pin header like Jameco #103393.

[P] Servomotor, Hitec HS-55 sub-micro HobbyTown USA #HRC31055S or ServoCity #31055S (servocity.com)

[Q] 0.1μF capacitors (2) Jameco #15229

[R] 10kΩ resistors (2) Jameco #691104

[S] 3/8" metal ball caster SparkFun #ROB-08909

[T] 9V battery holder clips (2) Jameco #105794

[U] Wire, solid core insulated and stranded insulated, 22 gauge, red and black

[V] Scrap wood, 1×3 or wider (¾" thick), 6" long

[W] GM2/3/8/9/17 gearmotor mounts (2) aka hubs, Solarbotics #GMW (solarbotics.com)

[X] Mini breadboard for ProtoShield, SparkFun #PRT-12045 or Maker Shed #MKKN1-B

[Y] Drive motors, Gearmotor 9 (2) Solarbotics #GM9

[Z] Ping rangefinder Maker Shed #MKPX5

TOOLS

9" bandsaw with " metal cutting blade

18" bending brake Harbor Freight (harborfreight.com) #39103-8VGA, $40

Drill press with vise clamp and scrap wood block

Fractional drill bit set

#43 drill bit

Step drill, aka unibit, Harbor Freight #91616-0VGA

2" hole saw

4-40 tap and tap handle

Pop rivet tool

Small metal file

Drafting square

Center punch and small hammer

Nibbler tool Jameco #18810, $8

Handheld deburring tool

Soldering iron and solder

Screwdrivers for screws and servo parts

Needlenose pliers

Double-sided and regular cellophane tape

Double-sided foam tape

Black electrical tape

Small nail

Protective eyewear

Computer with internet connection and printer

MAKE IT.

Image

BUILD YOUR MAKEY ROBOT

Time: 2–3 Weekends Complexity: Difficult

START

1. MAKE THE BODY

The body consists of 2 pieces of sheet aluminum. You can cut, drill, and bend one piece at a time, or do both at once to minimize switching tool stations; see Step 1h.

1a. Download the 5 Makey templates from makezine.com/projects/my-robot-makey and print them out full-size. Cut out the base cutting template, and cut holes in the blank area of each panel. Securely tape the template to the aluminum sheet with double-stick tape on the back and regular tape over the holes.

1b. With a band saw, cut the aluminum roughly to size around the template, then cut the perimeter just outside the lines.

TIP: For inside corners, first cut a gradual curve close to the corner, then back up and cut into the corner’s point from each direction.

Image

1c. Use a center punch and small hammer to punch through the template at the 17 crosshairs (for drilling in the next step) and at the corners of the rectangles around the large holes.

Image

1d. Drill the holes at the crosshairs following the sizes marked on the template. Remove (but keep) the paper first, to line up on the punch marks more accurately. Clamp the metal tightly onto scrap wood, and wherever possible use the unibit, which makes cleaner holes in thin metal than a twist drill. For the starter holes inside the rectangles, you may need to adjust the diameter smaller or larger to reach the rectangle edges.

Image

1e. Finish the rectangular holes with the nibbler tool, cutting away until a rectangle appears. If you want, you can retape the template to see the rectangles more clearly. Then file the edges smooth.

Image

1f. Use a handheld deburring tool to remove burrs from the metal’s edges. To deburr the small holes, push the point of a larger drill bit over the holes and twist it by hand.

Image

1g. Cut out the base bending template and attach it to the other side of the aluminum with double-stick tape, aligning the holes and rectangles. Insert the metal in the brake with the new template facing up, and make all indicated bends at 90°. For each bend, go up gradually, using a drafting square between small bends to check the angle. First bend the tabs on each long side of the metal, then bend up the sides of the body.

Image

1h. For the body’s top cover, repeat Steps 1a–1g using the top cutting and bending templates. Now you’ve got one sweet chassis any robot would be proud to wear!

Image

2. ADD THE DRIVETRAIN

2a. Mount the drive motors in the base using 4-40×1" screws through the small holes. The motor shafts should poke out of the larger holes. Secure the screws with lock washers and nuts on the motor side. The base is small, so you may need needlenose pliers for tightening.

Image

2b. Use a 2" hole saw in a drill press to cut wheels out of some scrap wood. I used 1×8 shelving and my finished wheels were ¾" thick by about 1.8" in diameter. Clamp the wood, and go slowly to avoid stalling the drill press.

2c. Center a wheel hub on each wooden wheel and use a small nail to mark 2 of the hole locations. Drill through the locations with a " drill.

Image

2d. Paint the wheels. I love the Rust-Oleum red gloss; it is super thick, brightly colored, covers great, and cleans up easily. Try not to get too much paint in the mounting holes.

2e. Drill through 2 opposing holes in the hub with a #43 drill, then use a 4-40 tap to create threads in each hole.

Image

2f. Use two 4-40×1" screws to attach the wheels to the hubs from the outside. Don’t overtighten.

Image

2g. Install tires on the wheels, orienting them with the larger diameter facing out. Then snap each wheel assembly into its motor shaft.

Image

2h. Attach the skidder to the bottom of the base using the screws, nuts, and the thinner of the 2 spacers it comes with.

Image

3. ADD THE POWER AND CONTROL

3a. Cut a plate out of hard plastic following the mounting plate template printed in Step 1a. Punch and drill it as indicated, then test-fit the plate into the robot body, resting on the motors, and file as needed for a snug fit. Use two 4-40×" screws to fasten the Arduino board to the plate from the underside, securing it with nuts on top. The USB connector should line up with the notch in the tab.

Image

3b. Pop-rivet the battery holders into the body through the holes in the left side tabs. Rivet from the outside so the ugly side of the rivet faces the battery.

Image

3c. Solder together the ProtoShield following the manufacturer’s instructions, linked at makezine.com/projects/my-robot-makey. Use the band saw to slice off the board’s BlueSMiRF header, which connects to Bluetooth wireless modules. Wasn’t that fun? The header won’t fit in the robot and we don’t use it. Stick the mini breadboard onto the ProtoShield and plug the ProtoShield onto the Arduino. If you are using a Diecimila, set its power jumper to EXT.

4. ADD THE SENSOR AND SERVO

4a. This project uses the shorter of the 2-arm horns that come with the HS-55 servo. Use a 1/16" bit to drill out the outermost holes in this horn.

4b. Press-fit the metal pieces of the 2 Du-Bro Mini E/Z Connectors into the servo horn holes from the front, and secure them in back with the black rubber pieces. Thread the control rods from the Du-Bro Aileron System through the connectors and screw them down using the included screws.

Image

4c. Here’s a tricky part. Plug the servo extension wire into the Ping sensor board. Bend the control rods from the horn in opposite directions 90°, to reach mounting holes at opposite corners of the board. The rods will point up from the servo, allowing room for the extension plug, and the sensor should face out. Slip the pushrod housing that came in the Du-Bro package over the rods to avoid short-circuiting the sensor, then secure the rods to the board using the connectors from the aileron control kit.

Image

4d. Thread the wires from the servo and sensor down through the rectangular cutout in the body’s top piece. Fit the servo in the cutout, and fasten using two 1-72×¼" screws and nuts through the holes on either side. Clip the excess control rod length. Screw the horn onto the servo and use a small screwdriver to adjust it so that Makey’s eyes face forward.

Image

5. CONNECT AND TEST THE DRIVE MOTORS

The contact tabs on our inexpensive motors are fragile, so their connections must be strong and vibration-proof.

5a. Remove the motors and Arduino board from the robot body.

5b. Cut 2 red and 2 black 12" leads out of the stranded wire and strip 1" off an end of each. Without soldering, wrap each red/black pair around the round back end of the motor (for strain relief), then run the wires along the top and stick them on with a sandwich of double-stick foam tape. Don’t cover any of the holes in the motor body, and leave room for the mounting nuts.

5c. Thread and solder the capacitor leads through the holes in each motor’s connector tabs. This requires innovative bending with needlenose pliers. Then solder the motor wires to the capacitor leads, not the motor connectors, making a strong joint. Clip the extra lead length. Then cover the capacitor and the wrapped-around wires with black tape, and use more foam tape to cover the pointy bits.

Image

5d. Twist the free ends of the motor wire pairs together; this also reduces noise on the circuit. Mark the motors as Left and Right.

5e. Solder and heat-shrink short solid-core jumper wires to the drive motor and battery snap leads (this lets you plug them into the breadboard). Route the motor wires through the big holes in the plastic mounting plate.

5f. Plug the motor driver over the central trench of the breadboard and wire it to the drive motors and one battery, following the schematic. (Recall that on each side of the trench, holes in the same row are connected.) Use short jumpers to keep the wires close to the breadboard, as big loopy wires won’t fit inside the robot.

5g. Download and install the Arduino software from arduino.cc and download the 5 project test programs from makezine.com/projects/my-robot-makey Hook the Arduino to your computer via USB, and if it’s a Diecimila, move its power jumper to USB.

Image

5h. To test the motors, run the program 01_Test_Motor_Rotation. The left motor should run forward and back, followed by the right motor. If not, check your wiring. Next, run 02_Test_Motor_Speed. The motors should start slow, speed up, and then reverse direction. Otherwise check wiring to pins D11 and D3.

6. CONNECT AND TEST THE SERVO AND SENSOR

6a. Replace the motors and Arduino assembly in the robot body. Plug a 3-pin right-angle header into the breadboard, plug the servomotor cable into it, and wire the servo: black to GND, red to +5V, and yellow to Arduino pin D10.

6b. Plug the other 3-pin header into the breadboard, then plug in and wire the rangefinder: black to GND, red to +5V, and white to Arduino pin D9.

Image

6c. Run the program 03_Test_Servo_Center, which centers the servo, then unscrew and realign the servo horn as close to center as possible. You can’t get it exactly in the middle, because the teeth on the shaft won’t allow it, but we can nudge it later in software.

6d. Run 04_Test_Servo_Sweep, which should make the servo slowly rotate from one side to another.

6e. To test the sonar rangefinder, run 05_Test_Sensor_Distance and then click on the serial monitor icon in the Arduino software. You should see distance readings spitting out, and if you move your hand in front of the sensor, the readings should change. If your readings are stuck at 0cm or 255cm or otherwise incorrect, check your wiring, and make sure the sensor isn’t plugged in backward.

7. CONNECT THE ARDUINO POWER

7a. Unpack the Arduino one last time. To add the on/off switch, solder the unused battery snap’s red wire to one side of the switch and a solid red wire to the other. Also solder a solid black wire to the battery’s black wire. Thread the wires out through the rectangular hole in the side of the robot body, and then press in the switch. Orient the switch with the “1” label at the top and fit it through the hole. It’s a tight fit and you may need pliers.

7b. Wire the red lead from the switch to the RAW pin on the ProtoShield (which connects to Vin on the Arduino) and the black lead from the battery snap to the ProtoShield’s GND pin. If you’re using the Diecimila, move its Power jumper back to EXT.

Image

8. BUTTON IT UP

8a. Now that all your electronics are working, carefully put everything back into the body without knocking loose any wires. Install the batteries and prop the robot up on something so it doesn’t run off the table. The USB programming jack should line up with the cutout in the body.

Image

8b. Reload and run the test program 01_Test_Motor_Rotation, noting that the front of the robot is where the USB jack and skidder are. If the motors rotate the wrong way, check your wiring to pins AOut1, AOut2, BOut1, BOut2, AIn1, AIn2, BIn1, and BIn2. You may also need to reverse the motor connections.

8c. Rerun the other test programs to make sure all the wiring is still OK. When satisfied, fold up the servo and sensor wires and tuck them into the base. Slide the top cover on, and install 4 sheet metal screws to hold it on. You’re done!

Image

NOW GO USE IT »

FINISH X

SCHEMATIC DIAGRAM

Image

USE IT.

Image

ROLL YOUR OWN ROBOT

ROBOT PROGRAMMING

Sometimes when you’re done building, you’re done building — but you’re never done programming. This is where you get to be creative, think of new things you want the robot to do, then write or modify programs to implement the behavior.

In the code, you control the motors by using the digitalWrite and analogWrite functions to pass values to pins on the motor driver, 3 for each motor. One pin takes a number 0–255 and sets the current sent to the motor, which determines its speed. The other 2 pins take binary values that set each motor contact to either high or low voltage. This sets the motor’s direction (when only one contact is high) or turns it off (when both are low). For example, here’s a subroutine for moving the robot forward:

void Forward()
{
 digitalWrite(leftDir1, LOW);
 digitalWrite(leftDir2, HIGH);
 digitalWrite(rightDir1, LOW);
 digitalWrite(rightDir2, HIGH);
}

You can write similar routines for the more basic motions, such as Backward (both motors backward), Spin_Left (right wheel forward, left wheel back), Arc_Left (right wheel forward, left wheel stopped), and so on. The Arduino programming environment makes it easy to experiment with code and load new programs to your robot.

Makey’s object-following behavior based on proportional control is described on page 142.

Another fun behavior is object avoidance, which runs the loop: Move forward a bit, then take a distance reading. If the object is too close, take evasive action, such as back up and turn. Repeat.

Image

Photograph by Ed Troxell

ROBOT MINI-SUMO

In a Mini-Sumo match, 2 autonomous robots are placed in a ring painted black with a white border. A robot wins when it pushes the other robot out of the ring (which means it has to find the other robot in the first place).

With narrower wheels, like the GM Series plastic wheels from Solarbotics (solarbotics.com/products/gmpw), Makey would fit within the maximum size and weight allowable for Mini-Sumo: a 10cm-square footprint and 500 grams. You would probably need another sensor pointed down to see the ring, but the Arduino has room for several more inputs.

RESOURCES

For more information about robot programming and behavior, I recommend Robotics with the Boe-Bot from Parallax, Inc. (parallax.com).

Image For the Makey project schematic, templates, and code see makezine.com/projects/my-robot-makey.

Image To see videos of Makey in action, visit makezine.com/projects/my-robot-makey.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.200.226