Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Make: Projects

Bump Sensor for the Tiny Wanderer

A small piece of acrylic, a little hardware, a little wire, and a switch create a bump sensor for your Tiny Wanderer.

Bump Sensor for the Tiny Wanderer

The Tiny Wanderer robot is meant to be played with. After you have explored the two IR sensors that come with the kit, it is time to try new robot behaviors and sensors. To let your robot wanderer around your house, it needs to be able to detect and react to obstacles in its path. While this can be done with the IR sensors, that method makes heavy use of the limited input/output pins of the Tiny Wanderer’s ATTiny85 robot controller. We can free up two of the pins by instead adding a bump sensor in place of the two IR sensors.

Here is how you can make a bump sensor for your Tiny Wanderer inexpensively using easily obtained materials.

Related

Steps

Step #1: Build the Chassis.

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Peel the protective plastic off all acrylic parts. Insert the rubber grommets packaged with the servos into the 4 servo mounting holes. Use four #4×3/8" screws to attach each servo to one of the 2 acrylic side pieces, with the shaft aligned with and on the same side as the etched guideline. With the motors installed, align the side pieces next to each other and make sure they match up.
  • See http://makeprojects.com/v/29 for more photos identifying all the acrylic kit pieces.
  • Fit the 2 acrylic axle holders into the bottom of the truck piece. Anchor each one with a nut in its cross-shaped cutout, screwed onto a #4 screw threaded through a washer from the top of the truck.

Step #2:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Fit the O-ring around one of the skateboard bearings. This will be the rear caster’s wheel. Mount it between the axle holders, with a large acrylic washer on either side, on a 5/16"×1" bolt secured with a matching nut.
  • For the caster’s swivel mount, run four #4 screws through 4 small metal washers, then through the 4 mounting holes around the rear caster hole in the large acrylic base piece. Drop the bearing holder (the acrylic square with the larger center hole) over the 4 screws. Drop the bearing into the holder, then drop 4 small acrylic washers onto the screws. Finally, drop the bearing retainer (the square with the smaller hole) onto the screws and over the bearing. Secure with nuts.
  • The metal washers provide clearance; without them, the caster will hit the screws.
  • Attach the side pieces to the top of the base by fitting 4 nut/bolt pairs into its cross-slots, as in Step 1. Use 2 more nuts and bolts to join the tops of the side pieces to the crossbar piece.
  • Tweezers help to hold the nut in place while you start the screw.

Step #3:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Assemble the sensor tray from the sensor shelf, sensor shelf riser, 2 sensor shelf brackets, and 6 nut, screw, and washer sets. As with the other acrylic pieces, fit the tabs into the slots and secure by twisting the nuts down on the bolts in their cross-slots. The sensor shelf will act as a base for attaching the robot’s sensors.
  • Attach the sensor tray to the front of the chassis with 2 screws.

Step #4:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Attach the caster holder to the caster swivel mount with the remaining 5/16" bolt and matching nut. Fit 2 large acrylic washers over the bolt between the underside of the swivel mount and the top of the caster holder, so the caster can turn without mounting hardware getting in the way. The inner race of the horizontal bearing should be clamped between the large bolt head and the 2 acrylic washers.
  • You may have to temporarily loosen the screws to get the bolt to fit through the caster assembly so that the bolt’s head is captured by the wheel supports.

Step #5: Fit the tires and hub.

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • For each of the 2 tires, cut a 12¾" length of window screen spline. Use a seam ripper to puncture each piece about ¼" from one end. Slit the spline along one edge, going almost its entire length, but stopping when the seam ripper point shows at the other end.
  • Drop a dot of super glue onto a piece of thick paper. Run your finger down the slit to make sure it’s not twisted, then align the 2 ends and dip them into the super glue. Hold the ends together for 20 seconds; they should stick together. Put the tire aside for at least 15 minutes.

Step #6:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Use the seam ripper to slit the joint area, making the slit continuous. Starting with the joint, place the tire onto the wheel, working it around the rim a little bit at a time.
  • Place a pencil through the center of the wheel and roll it on a table to seat the tire. Use fine sandpaper to lightly sand the glue joint. Be careful — you only want to remove excess glue.

Step #7:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • With each circular servo horn, center it under a wheel with the horn hub protruding through. Rotate the horn until you see 2 of its 4 injection-mold marks through each of the wheel’s slots. Mark the horn through the 2 slots with a sharp pencil. Drill two 7/64" holes into the horn where the mold marks intercept your lines.
  • Use two #4 screws and nuts to attach a horn to each wheel, and mount the wheels on the servo axles using the small screw that comes with the servos.

Step #8:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Separate the PCB into 3 boards — the controller board and 2 sensor boards — by splitting it along its 2 scribe lines. You may need to deepen the scribe line between boards with a utility knife before separating them.
  • Cut the 8-pin female header into two 3-pin headers by cutting through the fourth and fifth pins. Sand the cut edges smooth.
  • Populate the board with the components as marked, starting with the shortest ones (resistors and diode) and working up to the tallest. Route the battery holder’s leads through the strain relief holes before attaching. Make sure the large capacitor’s polarity is correct, with the lead near the band marked with negative signs (–) opposite the hole marked (+). The female headers go into the locations marked “Sensor R” and “Sensor L.” Do not place the chip into the socket yet.
  • Use a multimeter to check all connections, following the wiring-check tables at http://makeprojects.com/v/29. If everything checks out, plug in the chip with its pin 1 near the switch, and its notch next to capacitor C1.
  • The wiring tables list all the pairs of points on the board that should have continuity or a specified resistance.
  • After any work on the circuit board, perform the checks again before you plug in the chip. Before checking, disconnect the servos and sensors from the controller board and turn the power switch off.

Step #9: Assemble the sensor boards.

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Plug a phototransistor and an LED into each sensor board, orienting the small flat on the side of the plastic lens (the LED’s cathode or transistor’s collector) as indicated on the board. “D” marks the LED’s position and “Q” marks the phototransistor.
  • Fit the 1" length of heat-shrink tubing over a phototransistor so that its edge touches the board, then cut it off just above the plastic lens. Similarly fit and trim a piece over the other phototransistor. Do not heat the tubing.

Step #10:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Cut the 3-wire ribbon cable in half. Strip and tin all ends of both pieces. For each, solder one end to a 3-pin male header and the other to a sensor board, with the red wire in the location marked “1.”
  • Plug the cables into the female sockets on the controller board, connecting the red wire to the sides marked “1.”

Step #11: Make the sensor arms.

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • The 2 sets of Tiny Wanderer sensor arms work with 2 different behavior programs: cliff-sensing (for wandering an empty tabletop) and object avoidance. See http://makeprojects.com/v/29 for a third sensor arm design, for line-following behavior.
  • For the cliff-sensing configuration, use zip ties to attach the sensor boards to the shorter of the 2 pairs of acrylic sensor supports, and bolt the arms to the sensor tray with the phototransistors and LEDs pointing downward.
  • For the object-avoidance arms, first make a bending guide by cutting a 100° corner on a scrap of wood. Mark each of the longer acrylic sensor supports 1¾" from its long end, warm it with a heat gun or by holding the heating element of a soldering iron near (but not touching), and then bend it over the guide.
  • Zip-tie the sensor boards to the object avoidance arms, then bolt the arms to the tray, angled slightly inward to avoid a blind spot in the center.

Step #12: Program the ATtiny85.

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Disconnect the servos from the PCB; you can leave the sensors connected. Plug your AVR ISP programmer between your computer and the onboard 2 x 3 header, with the pin marked “1” connected to pin 1 of the cable (marked with a triangle on the plug and a red wire).
  • When the two LEDs on the AVRISP mkII programmer turn green, the programmer is ready for use.

Step #13:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • There are several tool chain options for programming AVR chips, but a good choice for beginners is to combine Atmel’s AVR Studio 4 with the open-source WinAVR.
  • Download and install WinAVR and AVR Studio 4 (search “AVR Studio 4” at http://www2.atmel.com/) and install with all defaults. You will need to register on the Atmel website before downloading the AVR Studio 4 installer.
  • Some have reported an issue of AVR Studio 4 installer freezing after selecting “Install”. A proposed work-around is to open Task Manager and end the task “Rundll32.exe.” The author has not experienced this issue.
  • Atmel now recommends their newer AVR Studio 5, which has some nice features, but is larger and more complex than version 4.

Step #14:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Launch AVR Studio 4. Click the “New Project” button at the top of the Welcome screen, then select “AVR GCC” for the Project Type, to specify the gcc compiler, for project code written in C. Give the project a name (“TW_tabletop” here), then uncheck “Create initial file” and check “Create folder.”
  • Create a new folder named “AVR” in My Documents, select that location, and click “Next.” In the next popup, select “AVR Simulator 2” as the Debug platform and ATtiny85 as the Device. Click Finish.
  • Download the Tiny Wanderer code examples from http://makeprojects.com/v/29, or else use your own code. Each program will consist of a .c and .h file, for the C source and headers. Copy or move these files to the project directory created in step 7c. For example use tinywanderer_edgeDetect_version2b.c and tinywanderer_edgeDetect_version2b.h, for the tabletop edge detection program.
  • Each project that you program into the Tiny Wanderer will have different .c and .h files. Be sure to use the appropriate .c and .h files for your project.

Step #15:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Open the project AVR GCC pane, right-click the “Source Files” folder, select “Add Existing Source File(s)” and specify the project’s .c file. Do the same for the project’s .h file after right-clicking on the “Header Files” folder.
  • Double-click both project files in the AVR GCC pane to open them up in the editor. Right-click Project → Configuration options menu item, select “Custom Options” at the left of the popup, In the Custom Options pane, uncheck “Use AVR Toolchain” box and add the locations for avr-gcc.exe and make.exe. The default locations for these will be C:WinAVR-20101001bin and C:WinAVR-20101001utilsbin, respectively. Click “OK”.
  • This is where you connect AVR Studio 4 to WinAVR, installed earlier. These instructions apply to AVR Studio 4.19 (build 760). This final version differs from previous versions of AVR Studio 4.

Step #16:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Now you can edit your program. To build the project for uploading to the ATTiny85 chip, select the “Build Active Configuration” icon on the tool bar or push F7. You will either see a successful build message or a list of errors for debugging.
  • After a successful build, connect your programmer to the Tiny Wanderer PCB board and click the “Display the Connect Dialog” icon on the toolbar. Turn the power switch on and make sure the robot has batteries. Select your programmer and click “Connect…”
  • Click the small “Connect to the Selected AVR Programmer” icon in AVR Studio’s toolbar. Click “Read Signature” in the resulting popup and wait for the “Leaving Programming Mode” message at the bottom.
  • Click the Program tab at the top, and wait for the path of the compiled HEX file to appear under the “Flash” subheading. Once it appears, click “Program” to upload it to the ATTiny.
  • If you change projects, the HEX file path will not change. You must change this path to the new project’s file.
  • Turn off the power to the board, unplug the programmer, and re-plug the servos.
  • Congratulations! You have reprogrammed your AVR microprocessor.

Step #17: Make the finishing touches.

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Bolt the controller to the chassis with the battery wires pointing rearward. Use small acrylic washers as standoffs under the board. Add velcro for holding the battery case onto the rear of the base.
  • Plug the servos into the board. If you sourced your own servos, you may need to adjust the speed settings in the .h file, due to differences in servos.
  • Left and Right as marked on the board are defined with respect to looking at the robot from the front, not as the robot’s own left and right.
  • To test, hold both sensors over a table and alternately move each off the edge. With both sensors over the table, the wheels should run forward, and with one off the edge, they should run backward at different speeds.
  • To calibrate the servos, hold the robot in midair and adjust the potentiometers until both wheels sit still. Then turn the power off for a few minutes to let the large capacitor discharge. Your Tiny Wanderer is ready to roll!

Step #18:

PrevNext
Bump Sensor for the Tiny Wanderer

Print out and glue pattern to piece of acrylic.

Step #19:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer

Cut out the pattern using a saw. If you do not have access to an electric scroll saw, you can cut the pattern out using a hand scroll saw with the acylic clamped to your work desk.

Step #20:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer
  • Drill out holes in pattern using a 9/64” drill bit for the small holes, and a 5/16” drill bit for the larger hole. To form the two slots, drill two 9/64" holes next to each other and use the small file to join the two adjacent holes.
  • Acrylic can be drilled with less chance of cracking by using a drill bit with a more acute angle at the tip. One way to make this type of drill bit is to chuck a normal drill bit into a drill, and run it backwards against a grinding wheel.

Step #21:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer

Align the acrylic as shown in the image to the left between two blocks of wood and clamp. The edge of the holes should lineup with the edge of the wood. Heat the exposed acrylic with a hot air gun set to the lowest possible temperature. Use another piece of wood as a break to bend the hot acrylic into a 90 degree bend.

Step #22:

PrevNext
Bump Sensor for the Tiny Wanderer

After the bend the bumper support should look like the image to the right.

Step #23:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer

Using a small round file relieve the inner edge of the back of the bumper support screw holes. This allows the support screws to angle inward when the edge of the bumper is depressed.

Step #24:

PrevNext
Bump Sensor for the Tiny Wanderer

Install the 1” #6 screws into the bumper and lock them into place using a nut on each screw. Unscrew the nut and washer that comes with the switch and insert the switch into the 5/16” hole. If the fit is too tight use the round file to enlarge the hole. Re-install the washer and nut on the switch.

Step #25:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer

Place either a small dot of hot glue or a small piece of double sided tape onto the switch button. While the glue is still hot align the bumper support screws into the bumper support and press until the switch is depressed. Let the glue harden.

Step #26:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer

Add one nut onto the bumper support screws and hand tighten just to the edge of the back side of the bumper support. Check the smoothness of the switch action when the bumper is pressed on separately at each end and in the middle. If there is any roughness, remove the bumper (just snap off the switch cap from the switch) and enlarge the holes slightly with the round file and re-assemble.

Step #27:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer

After the mechanical action of the bumper appears smooth, use an ohmmeter to check that the switch is closing when the bumper is depressed. Check depressing each edge and also the middle of the bumper. If the switch works properly the ohmmeter should show about 0 ohms when the bumper is depressed.

Step #28:

PrevNext
Bump Sensor for the Tiny Wanderer

Adjust the nuts on the bumper support screws so that the switch plunger is about to engage. Add a second nut to each bumper support screw to lock the adjustment. Re-check the smoothness of the bumper action, and the switch’s operation.

Step #29:

PrevNext
Bump Sensor for the Tiny Wanderer

Cut two pieces of small multi-strand wire. Strip the insulation from all four ends and tin the ends of the wire. Connect one end of each wire to a different terminal on the switch.

Step #30:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer

Insert a 3/8” piece of shrink wrap onto each wire. Solder the other ends of the wires to two adjacent pins on the 3 pin male header. After the wires are soldered cover the exposed terminations with the shrink wrap and heat gently to shrink the tubing.

Step #31:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer

Connect the bumper support to the front of Tiny Wanderer’s sensor tray. Insert the 3 pin male header into the “Sensor R” female header in the robot controller board. The male pin without a wire attached to it should be inserted into female socket’s pin position 1.

Step #32:

PrevNext
Bump Sensor for the Tiny Wanderer

Disconnect the servos and program the robot with the example program.

Step #33:

PrevNext
Bump Sensor for the Tiny WandererBump Sensor for the Tiny WandererBump Sensor for the Tiny Wanderer

Reconnect the servos and test the robot.


blog comments powered by Disqus

Related Supplies at Maker Shed

Follow

Get every new post delivered to your Inbox.

Join 26,570 other followers