Projects‎ > ‎

Basic Bot

The Basic Bot is an Arduino based custom fab Boe-Bot ripoff. I created the chassis out of a 1/4'' aluminum plate.  Most of the components are attached with foam mounting tape. I drilled a couple of holes for the rear wheel assembly to attach to. There are (2) 4-40 set screws clamping the rear rod/wheel assembly in place. The front wheels and rear ball wheel are straight from Parallax's website. I bent the rod with a vise to hold the wheel (be sure not to bend it too tightly, the wheel needs a little room to move around). Drive is provided by 2 continuous rotating Futaba servos.  




Parallax sells an infrared receiver (the PNA4601M) and IR LEDs for use in object detection. They have provided some documentation to get this up and running on the Basic Stamp here. The basic idea is that you send out IR light at specific frequency, then check the detector for the same frequency light. You will only see light at the detector if it is reflected from an object. Using Parallax's documentation as a starting point I investigated what could be used as the freqout command with the Arduino. Luckily Paul Badger created a freqout function found here. I modified it a little bit so that it has the same arguments as the Basic Stamp version:


void freqout(int outpin, long freq, int t)  // freq in hz, t in ms
{
  long hperiod;                               
  long cycles, i;
  pinMode(outpin, OUTPUT);  

  hperiod = (500000 / freq) - 7; 

  cycles = ((long)freq * (long)t) / 1000;    

  for (i=0; i<= cycles; i++){               
    digitalWrite(outpin, HIGH); 
    delayMicroseconds(hperiod);
    digitalWrite(outpin, LOW); 
    delayMicroseconds(hperiod - 1);     
  }

  pinMode(outpin, INPUT);               

}


For some reason the frequencies seemed a little off compared to the PBasic version. I had to lower them to get the IR detector to respond:


int readIRDetector(int LEDPin, int detectorPin) {
    freqout(LEDPin, 31500, 1);
    return !digitalRead(detectorPin);
}
                                                        

You can adjust the frequency up and down to change the distance that it first starts detecting an object. Potentially you could scan through various frequencies to get a rough distance measurement instead of just having on/off logic. Also, I really need to add a third sensor in the middle, the bot gets a little confused when going through narrow passageways.









Sign in|Report Abuse|Print Page|Remove Access|Powered By Google Sites