3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Make a wall avoiding Robot!

Step 6Adding Infrared Sensors

Adding Infrared Sensors
«
  • Walbot with Sonar.JPG
  • Walbot with Sonar and Infrared.JPG
  • Sharp Sensors.JPG
  • front Infrared mounting bracket.JPG
  • back Infrared mounting bracket.JPG
  • bracket shape.JPG
  • Sharp on Walbot.JPG
  • Sharps on Walbot.JPG
  • last photo ←
»
So now you have a working robot...but it can only turn right, and it still has a good chance of running into things. How do we fix this? By using two side sensors. Since getting two more ultrasonic sensors would be very expensive, and not to mention overkill, we will use two Sharp GP2Y0A21YK Distance Measuring Sensors. These are wide angle so it will give us a larger field of view. When we were using just the Ultrasonic sensor, the threshold was 16 inches, this is a lot of room, but it was necessary. As you can see in the picture below, the sonar will detect an area the width of Walbot when it is about 16 inches away. But if Walbot was in a corner (with the wall being on the right) it would detect the wall ahead but then turn into the wall on its right, and get stuck. However, if we have two infrared distance sensors on either sides of the sonar, we can virtually eliminate the sonars blind spots. So now when Walbot goes into a corner it can decide: 1. if there is an obstacle ahead and on the right, turn left. 2. if there is an obstacle ahead and on the left, turn right 3. if there is an obstacle ahead, on the right and on left turn around. There is also something we haven't mentioned yet, and that is each sensors weaknesses. Sonar uses sound to calculate whats ahead of it, but what if its pointed at something that does not reflect sound well, such as a pillow? Infrared uses light (we can't see it) to see if anything is in front of it, but what if its pointed at something painted flat black? (The shade black is the absence of light, it theoretically does not reflect light.) Together these two sensors can address each others weaknesses, so the only way Walbot would miss something in front of it, would be if it was a black sound absorbing material. You can see how these two little additions can help Walbot tremendously. Now lets add these sensors to Walbot.

Step 1. Get the sensors! I put the link to get them above this. I also suggest you get the 3-pin JST Cable for Sharp Sensors because they're pretty hard to find elsewhere. Now skip a week ahead when the UPS guy delivers them, and lets get to work. First you need a way to mount them. You will need to make a mounting bracket for them, I made mine out of a strip of aluminum, but it doesn't really matter. You can try to copy the shape of my bracket, anything works as long as it fits and holds it in place.

Step 2: Attach the sensor to the bracket. Unscrew the top front two 8-32 cap screws just enough so theres space in between the standoff and the base. Fit the sensor into place and screw it back together.

Step 3: pull the wires through to the top. On your PCB shield there are two sets of 3 holes on the front side of the board labeled INFRA1 and INFRA2. Solder the red wire to the hole labeled VCC ( hole closest to the IN in INFRA), solder the black wire to the middle hole, and solder the white wire to the last hole labeled Ana2 or Ana3 (hole closest to the RA in INFRA). You can also to choose to use polarized connector pins instead of soldering the wires directly to the board.

Step 4: Download this code which includes extra features using the Sharp infrared sensors. Compile and upload this to your Walbot, and it should be smarter than ever!

Note: I haven't had much time to test the new code, so if someone finds anything wrong with it or sees a way to make it better just leave a comment.
« Previous StepDownload PDFView All StepsNext Step »
3 comments
Jan 8, 2012. 2:44 PMsmokiemcpott says:
Oh, softwarelink not work :(
Nov 25, 2011. 11:03 AMHERNAN MOMA says:
Brandon I cant find de code for the Infra red sensor
Nov 9, 2008. 12:21 AMjimsondefrancia05 says:
hey bredon were we can find this code #include "WProgram.h"

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
33
Followers
5
Author:Brandon121233