rumble bee?

Posted on 15/01/2009 by crazyraver
Modified on: 13/09/2018
Project
Press to mark as completed
Introduction
This is an automatic import from our previous community platform. Some things can look imperfect.

If you are the original author, please access your User Control Panel and update it.

well since i put my other prototype on the side, i have decided to build my little rumble bee? its a $20 USD RC car from New Bright (cheap generic brand), which was suprisingly moduler constuction, i didng have to break any plastic or destroy the RF reciever which i may use in another project. so far it will go forward till it sees something that is 15 inches away, then back up, still working on the turning, it seems that the gears are sliping when trying to turn so i may have to fasion a new turing ...


rumble bee?

well since i put my other prototype on the side, i have decided to build my little rumble bee? its a $20 USD RC car from New Bright (cheap generic brand), which was suprisingly moduler constuction, i didng have to break any plastic or destroy the RF reciever which i may use in another project. so far it will go forward till it sees something that is 15 inches away, then back up,

still working on the turning, it seems that the gears are sliping when trying to turn so i may have to fasion a new turing system, so far i really like the ping sensor, because of how easy it was to get it to work with the arduino in less then 10 mins....i also decided to go with the ladyadas Motor sheild for ease of use, later on i will build more H bridges based on her designfor other projects,

i am still palning on adding headlights back up lights and turn signals. i am also planning on making a motion tracker on top of the bed 

more to come when i get the steering corrected and some better video with better light

 

my sample cod so far, i will be using my own custom header file soon enough to stream line the code but for the moment i will use the AFmotor.h header so far the code after it compiles takes 4.5kb

 #include <AFMotor.h>

AF_DCMotor motor(4, MOTOR12_64KHZ);
AF_DCMotor turn(2, MOTOR12_64KHZ);
int pingPin = 9;

void setup()
{
  Serial.begin(9600);
  motor.setSpeed(200);
  turn.setSpeed(0);
}

void loop()
{
  long duration, inches, cm;

  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // We give a short LOW pulse beforehand to ensure a clean HIGH pulse.
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  // The same pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
 


  delay(100);
 if (inches > 15) {
 
  motor.run(FORWARD);
  turn.run(RELEASE);
 }
 else {
    motor.run(BACKWARD);
    turn.run(BACKWARD);
    delay(400);
   
 }
}

long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

roll around and chase the cats

  • Actuators / output devices: 2 9v DC moters
  • Control method: autonomous
  • CPU: Arduino
  • Power source: 9.6v nicd 1000mA
  • Programming language: C/wire
  • Sensors / input devices: Ping))) Ultra Sound, more to add later
  • Target environment: indoor
LikedLike this to see more

Spread the word

Flag this post

Thanks for helping to keep our community civil!


Notify staff privately
It's Spam
This post is an advertisement, or vandalism. It is not useful or relevant to the current topic.

You flagged this as spam. Undo flag.Flag Post