Arduino Obstacle Avoiding Robot? Answered

I have made the chassis and everything for my robot, but to make my robot even go remotely forward, I have to code leftservo.write(-100); rightservo.write(100); And even then it goes in a big circle to the left. I have tried to code it less for the right motor but it just goes backwards. Can you please tell me why this happens and how to fix it.

Question by D5quar3   |  last reply


How should I get started in robotics? Answered

My "final" goal is to make a water obstacle avoiding robot that is solar powered; but i realize that's not happening anytime soon :D. help is appreciated

Question by The_Gnome   |  last reply


URGENT!!!sketch for arduino robot with ping?

I am making an arduino obstacle avoiding robot for my science project.. But i am not getting a suitable sketch for a ping to use with it. I am only getting that of sharp ir sensor. Please help me out with a sketch..its urgent..below i have linked the site where there is the sketch and the project dat i want to make..... http://communityofrobots.com/tutorial/kawal/how-make-your-first-robot-using-arduino

Question by Ankan Nayak   |  last reply


ARDUINO not powering up!?

I have made an arduino uno robot, i have run 2 motors via the l293d ic which i've powered with a 9v battery regulated to 5v. The whole thing worked very well when run with the usb but when I plugged a 9v battery to the arduino, it did'nt work. Please suggest a sol. fast, its urgent again!!!

Question by Ankan Nayak   |  last reply


ITS URGENT! Arduino not working with external power supply?

I have made arduino uno u3 robot, i have used 2 geared motors via a l293d using one 9v battery and tried power the arduino with a 9v battery, then with 9v adapter but it did'nt work, I also tried powering the board via the Vin pin, also through the usb cable using the 9v batterg and adapter, but it didnt work either.when i plug it to the laptop with usb everything works very fine. Please give me a sol. soon urgent i hav the exhibition after 3 days!!

Question by Ankan Nayak   |  last reply


Whats wrong with the sketch??

This arduino robo, there is no servo, this runs only with 2 geared motors, i made the sketch according to the needs bt it doent seem to making those turns even after sensing the obstacle. The ping sensor is functional and connected properly and thel293d ic is also functional..Pls tell me whats wrong with dis sketch..........  #include #define LeftMotorForward 11 #define LeftMotorBackward 10 #define RightMotorForward 9 #define RightMotorBackward 8 #define USTrigger 4 #define USEcho 5 #define MaxDistance 100 NewPing sonar(USTrigger, USEcho, MaxDistance); unsigned int duration; unsigned int distance; unsigned int FrontDistance; unsigned int LeftDistance; unsigned int RightDistance; void setup()  {     pinMode(LeftMotorForward, OUTPUT);   pinMode(LeftMotorBackward, OUTPUT);   pinMode(RightMotorForward, OUTPUT);   pinMode(RightMotorBackward, OUTPUT); }      void loop()                                           {                                            FrontDistance = distance;                               if(FrontDistance > 40 || FrontDistance == 0)          {    moveForward();                                      }   else                                                  {     moveBackward();         moveStop();                                           navigate();   } } void moveForward()                                    {   digitalWrite(LeftMotorBackward, LOW);   digitalWrite(LeftMotorForward, HIGH);   digitalWrite(RightMotorBackward, LOW);   digitalWrite(RightMotorForward, HIGH); } void moveBackward()                                 {     digitalWrite(LeftMotorForward, LOW);   digitalWrite(LeftMotorBackward, HIGH);   digitalWrite(RightMotorForward, LOW);   digitalWrite(RightMotorBackward, HIGH); } void moveLeft()                                     {     digitalWrite(LeftMotorForward, LOW);   digitalWrite(LeftMotorBackward, HIGH);   digitalWrite(RightMotorBackward, LOW);   digitalWrite(RightMotorForward, HIGH);   } void moveRight()                                   {     digitalWrite(LeftMotorBackward, LOW);   digitalWrite(LeftMotorForward, HIGH);   digitalWrite(RightMotorForward, LOW);   digitalWrite(RightMotorBackward, HIGH); } void moveStop()                                    {   digitalWrite(LeftMotorBackward, LOW);   digitalWrite(LeftMotorForward, LOW);   digitalWrite(RightMotorForward, LOW);   digitalWrite(RightMotorBackward, LOW); } void scan()                                       {     distance = sonar.ping_cm();   delay(500); } void navigate() {     moveLeft();     delay(1000);     scan();                                               LeftDistance = distance;                                moveRight();                                      delay(1000);     scan();       RightDistance = distance;                                    if(RightDistance < LeftDistance)                      {      moveLeft();                                           delay(200);                                          }     else if(LeftDistance < RightDistance)                 {      moveRight();                                          delay(200);                                          } }

Question by Ankan Nayak   |  last reply


HOW CAN I BUILD AN OBSTACLE AVOIDING ROBOT WITHOUT MICRO CONTROLLER??? Answered

Hey guys i want to build an obstacle avoiding robot without micro controller. i had built an obstacle avoiding robot with arduino. If you have any idea of obstacle avoiding robot without micro controller, please share it with me.

Question by makesomeso   |  last reply


Asking a servo to sweep on an obstacle avoidance car?

I am just a few weeks into learning how these things work, and as such, have primarily been looking at coding from examples and getting them to fit with what I am doing.  Here's the setup.  We (my students and I) have built an elegoo 4 wheeled arduino platform car.  Primarily, we are using it to autonomously move around the classroom, however we've found that the ultrasonic sensor just isn't cutting it.  We've added an optical sensor, which helps, and I've figured out the coding on getting that working.  Now, we are looking at having the servo holding the ultrasonic sensor to sweep 45 degrees to the left, then 45 to the right, and repeat.  We feel that we may be able to prevent some wall crashes and chair crashes that happen when the car comes in at an angle.  Here is the code we have now. The ABS and ACS numbers are different to account for the variances in motor manufacturing (the car wouldn't drive straight if all motors were spun up at the same speed).  We do have a second arduino hooked up mainly to control the LED's the kids added, but that code and board does not affect anything for this code and board. #include Servo myservo; int Echo = A4;  int Trig = A5; int in1 = 6; int in2 = 7; int in3 = 8; int in4 = 9; int ENA = 11; int ENB = 5; int ABS = 120; int ACS = 115; int angle = 0; const int avoidPin = 10; int rightDistance = 0,leftDistance = 0,middleDistance = 0 ; void _mForward() { analogWrite(ENA,ABS); analogWrite(ENB,ACS); digitalWrite(in1,LOW); digitalWrite(in2,HIGH); digitalWrite(in3,LOW); digitalWrite(in4,HIGH); Serial.println("go forward!"); } void _mBack() { analogWrite(ENA,ABS); analogWrite(ENB,ACS); digitalWrite(in1,HIGH); digitalWrite(in2,LOW); digitalWrite(in3,HIGH); digitalWrite(in4,LOW); Serial.println("go back!"); } void _mright() { analogWrite(ENA,ABS); analogWrite(ENB,ACS); digitalWrite(in1,LOW); digitalWrite(in2,HIGH); digitalWrite(in3,HIGH); digitalWrite(in4,LOW); Serial.println("go right!"); } void _mleft() { analogWrite(ENA,ABS); analogWrite(ENB,ACS); digitalWrite(in1,HIGH); digitalWrite(in2,LOW); digitalWrite(in3,LOW); digitalWrite(in4,HIGH); Serial.println("go left!"); } void _mStop() {   digitalWrite(ENA,LOW);   digitalWrite(ENB,LOW);   Serial.println("Stop!"); } int Distance_test()   {   digitalWrite(Trig, LOW);     delayMicroseconds(2);   digitalWrite(Trig, HIGH);    delayMicroseconds(20);   digitalWrite(Trig, LOW);     float Fdistance = pulseIn(Echo, HIGH);    Fdistance= Fdistance/58;         return (int)Fdistance; }  void setup() {   myservo.attach(3);   Serial.begin(38400);       pinMode(Echo, INPUT);      pinMode(Trig, OUTPUT);   pinMode(avoidPin, INPUT);    pinMode(in1,OUTPUT);   pinMode(in2,OUTPUT);   pinMode(in3,OUTPUT);   pinMode(in4,OUTPUT);   pinMode(ENA,OUTPUT);   pinMode(ENB,OUTPUT);    _mStop(); } void loop() {   boolean avoidVal = digitalRead (avoidPin);       myservo.write(90);     delay(500);     middleDistance = Distance_test();     #ifdef send     Serial.print("middleDistance=");     Serial.println(middleDistance);     #endif     if((middleDistance<=50) || (avoidVal==LOW))     {           _mStop();       delay(500);                               myservo.write(5);                delay(1000);            rightDistance = Distance_test();       #ifdef send       Serial.print("rightDistance=");       Serial.println(rightDistance);       #endif       delay(500);        myservo.write(90);                    delay(1000);                                                        myservo.write(180);                    delay(1000);       leftDistance = Distance_test();       #ifdef send       Serial.print("leftDistance=");       Serial.println(leftDistance);       #endif       delay(500);       myservo.write(90);                    delay(1000);       if(rightDistance>leftDistance)        {         _mright();         delay(180);        }        else if(rightDistance        {         _mleft();         delay(180);        }        else if((rightDistance<=50)||(leftDistance<=50) || (avoidVal=LOW))        {         _mBack();         delay(180);        }        else        {         _mForward();        }     }      else         _mForward();                     }

Question by KevinM560   |  last reply


sketch for arduino obstacle robot using seed motor shield v2.0?

Hi everybody, im barely started writing sletch so i need help, i build a obstacle robot and i used  arduino uno r3 seeed motor shield v2.0 one servo tamiya twin motor gear box hc-sr04 sensor  so i dont really know how to start writind the sketch.....

Question by salvador.lopez1   |  last reply


What is the program code for arduino obstacle avoiding robot it has IR remote and receiver module with HC-SR04 sensor?

It has HC-SR04 ultrasonic sensor , arduino uno R3, L293D motor driver , and Infrared remote and Infrared receiver module.

Question by KodakH1   |  last reply


I wan to Do A Gps Guided Rc Car controlled via 3g (web) with obstacle avoidance ?! Anyhelp !?

Hey Guys !! I Need Your Help my project is to do a Gps Guided Rc Car controlled via 3g (web) with obstacle avoidance + video streaming from the rc car to the web  I am Using Arduino UNO .. I will be glad if someone could help ?! Thanks in Advance 

Question by abedier   |  last reply



Can anyone help me in programming in arduino to make my robot autonomous.

My robot uses Arduino, Motor Shield, 2 DC-Motors & 3 Ultrasonic sensors. I just want my robot to sense the object infront of it (about 30cm ahead) and make the logic itself whether to go left or right (if any obstacle is present in the left side then my robot should go in the right side & vice-versa or if the obstacles are present on both sides, then it should move back). Thanks in advance!

Question by Abhineet Mishra   |  last reply


Construction of a robot learning to move in internal rooms

I am looking for a person who knows how to make a robot that will move inside the space, avoid obstacles and create maps of the rooms in which he works?

Topic by finder11   |  last reply


i will the 4wdrobot with lcd that show the obstacle and the distance cm help please the code?

/*  2011-10-03  robot4wd_06.pde  Eric Pavey - www.akeric.com  This software is released to the wild, free to be used and modified.  If you use it,  I just ask for some credit ;)    Program to drive the 4wd robot chasis using an arduino paired up with a ping))) sensor  and a servo for collision detection.    Hardware:    Arduino Duemilanove (but I'm sure any others will work)  http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove  Arduino is powered off a 5xAA producing 7.5v, sitting in the belly of the chassis.    Main chassis is the "4wd mobile platform" from DF Robot  http://www.dfrobot.com/index.php?route=product/product&path;=37&product;_id=97  http://www.makershed.com/ProductDetails.asp?ProductCode=MKSEEED8  http://www.rugcommunity.org/page/dfrobot-4wd-arduino-mobile    Motor control using the Adafruit motorshield:  http://www.ladyada.net/make/mshield/index.html  There doesn't seem to be API docs, but there is this header file:  https://github.com/adafruit/Adafruit-Motor-Shield-library/blob/master/AFMotor.h  Motor shield is powered off 4xC batteries (6v).    Paralax ping))) :   http://www.parallax.com/tabid/768/ProductID/92/Default.aspx  http://www.arduino.cc/en/Tutorial/Ping  Notes:  I had to rewire the ribon connecting the ping to the motorshield:  The  ping's ribon is ground\+5v\signal, but the motorshield's input pins order are +5v\ground\signal.  It works from 2cm to 3m.    Paralax (Fubata) "standard servo":  This is found in the "PING))) Mounting Bracket Kit":  http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/CategoryID/22/List/0/SortField/0/Level/a/ProductID/248/Default.aspx  This is plugged into the 'servo2' port on the motorshield.  It uses the servo library:  http://arduino.cc/en/Reference/Servo    Much of the ping code at the bottom is taken straight from the Arduino examples.  */ //-------------------------------------------------------------------------- // Library include stuff: #include   // needed for the motorshield. #include   // motorshield needs this for running servos. #include LiquidCrystal lcd(3, 4, 5, 6, 11, 12); //-------------------------------------------------------------------------- // globals: // ping))) stuff: int g_pingPin = 19; // this is actually analog pin 5, pretending to be digital, on the motorshield. long g_collideDist = 50; // in cm, how far before collision mode kicks in? long g_cm = 300; // the current ping reading, just ana initial default. boolean g_checkLeft = false; // used for collision detection boolean g_checkRight = false; // used for collision detection boolean g_checkCenter = false; // used for collision detection int g_leftDist = 0;  // used for collision detection int g_rightDist = 0;  // used for collision detection // motor stuff: AF_DCMotor g_motor1(1, MOTOR12_8KHZ); // back left AF_DCMotor g_motor2(2, MOTOR12_8KHZ); // back right AF_DCMotor g_motor3(3, MOTOR12_8KHZ); // front right AF_DCMotor g_motor4(4, MOTOR12_8KHZ); // front left byte g_motorSpeed = 255; // max is 255 // Mode (state) stuff: byte g_mode = 1; // 1 = drive, 2 = proximity check, 3 = turning byte g_driveDir = -1; // 0 = stop, 1 = straight, 2 = right, 3 = left // servo stuff: Servo g_servo2; int g_servo2pin = 9; // servo2 uses digital pin 9, even though the docs say pin 10... int g_servoCenter = 98; // in degrees.  98 is straight ahead based on how I mounted the servo (it must be     // a little inaccurate).  full left is 180, full right is 0.     // Servo is flipped upside down, fyi int g_servoRight = 135; // how far right?  Max is 180, full right. int g_servoLeft = 45; // how far left?  Min is 0, full left. // time stuff unsigned long g_time;  // global time tracker unsigned long g_ptime;  // global previous time tracker unsigned long g_elapsed = 0;  // helps keeping track of framerate. unsigned long g_interval = 33; // in ms (about 30fps).  This slows down the processing allowing the     // multiple systems to play nicely together.  Make this number smaller and it won't have enough     // time for each state to run properly:  The servo won't do a full sweep when scanning. unsigned long g_turnlength = 750; // in ms, how long to turn for.  Since we don't know how far     // it turns, we just guess on how long it should.  The type of terrain turing on has a great     // effect on what this should be.  This value works well for my hardwood floors. unsigned long g_turnUntil; // used to track how long to turn. //-------------------------------------------------------------------------- // setup \ loop : void setup() {   // Attach & center the servo:   g_servo2.attach(g_servo2pin);   g_servo2.write(g_servoCenter);  // center it by default   // Setup our framerate stuff   g_time = millis();   g_ptime = g_time; } void loop() {   // Main program entry point.     // Need to keep the aiming and the piging at a fixed rate, or the closer the object gets   // to the ping the faster it will aim, and do bad stuff.   g_ptime = g_time;   g_time = millis();   g_elapsed += g_time - g_ptime;   // Wait for the proper amount of time to pass before we do anything:   if(g_elapsed < g_interval){     return;   }   else{     g_elapsed = 0;   }   //  Do stuff, based on the current mode:   if(g_mode == 1){     g_cm = ping();     // sometimes the sensor returns a 0 value that can foul up things :(     if(g_cm > g_collideDist || g_cm == 0){       // If there is nothing in our way, drive!       if(g_driveDir != 1){         g_driveDir = 1;         move(g_driveDir);       }     }     else{       // if we're too close to something, stop the motors and switch to 'proximity check' mode:       if(g_driveDir != 0){         g_driveDir = 0;         move(g_driveDir);       }       // initialize the proximity check stuff:       g_checkLeft = false;       g_checkRight = false;       g_checkCenter = false;       g_leftDist = 0;       g_rightDist = 0;        // switch to mode 2:       g_mode = 2;        }   }   else if(g_mode == 2){     // Do proximity check!     boolean checked = proximityCheck();      if(checked){       // Define which direction to turn.       // If the right distance is greater than the left distance, turn that direction,       // otherwise go the other way:       if(g_rightDist >= g_leftDist){         g_driveDir = 2;       }       else{         g_driveDir = 3;       }       // now that we've set which direction to turn, start timing how long the turn       // has taken, and switch to mode 3.       g_turnUntil = millis() + g_turnlength;       g_mode = 3;     }   }   else if(g_mode == 3){     // We must be turning!  The logic for switching to other modes is in that function.     turn();   } } //-------------------------------------------------------------------------- // Helper functions: void turn(){   // Executed when g_mode == 3   // Used to turn the robot.     if (millis() < g_turnUntil){     // keep'on turning...     move(g_driveDir);   }    else{     // If we're done turning, see if there is anything still in our way:     g_cm = ping();     // sometimes the sensor returns a 0 value that can foul up things :(     if(g_cm > g_collideDist || g_cm == 0){       // If there is nothing in our way go back to mode 1:       g_mode = 1;     }     else{       // If stuff is still in our way, turn more in the same direction until       // not blocked:       g_turnUntil = millis() + g_turnlength;     }   } } boolean proximityCheck(){   // Used when mode == 2:  Swing the ping left and right taking readings to   // find which way is safe to go.  Returns false when in the middle of the check   // operation, returns true when entire check process is complete.     // Current angle of the servo:   float angle = g_servo2.read();     // check left first: ( full left is 0 deg)   if(g_checkLeft == false){     if(angle > g_servoLeft){       g_servo2.write(angle-10) ;       return false;        }     else{       g_checkLeft = true;       g_leftDist = ping();       return false;       }   }   // check right second: ( full right is 180 deg)   if(g_checkLeft == true && g_checkRight == false){     if(angle < g_servoRight){       g_servo2.write(angle+10) ;       return false;          }        else{       g_checkRight = true;       g_rightDist = ping();       return false;     }   }   // Go to center position third:   if(g_checkLeft == true && g_checkRight == true && g_checkCenter == false){     if(angle != g_servoCenter){       g_servo2.write(angle-10) ;       return false;     }           else{       g_checkCenter = true;       return false;     }   }   // Finally if we've checked left, right, and got back to center, return true   // to tell the later code that the full check is complete:   if(g_checkLeft == true && g_checkRight == true && g_checkCenter == true){     return true;   }   else{     return false;   } } void move(byte mode){   // This function moves the wheels.  Can be called to when mode == 1 (driving) or 3 (turning).   if(mode == 0){     // all stop!     g_motor1.setSpeed(0);     g_motor2.setSpeed(0);     g_motor3.setSpeed(0);     g_motor4.setSpeed(0);   }   else{     // full speed!     g_motor1.setSpeed(g_motorSpeed);     g_motor2.setSpeed(g_motorSpeed);     g_motor3.setSpeed(g_motorSpeed);     g_motor4.setSpeed(g_motorSpeed);         // full speed, but which direction?     if(mode == 1){       // go straight       g_motor1.run(FORWARD);       g_motor2.run(FORWARD);       g_motor3.run(FORWARD);       g_motor4.run(FORWARD);     }     else if(mode == 2){       // turn right       g_motor1.run(FORWARD);       g_motor2.run(BACKWARD);       g_motor3.run(BACKWARD);       g_motor4.run(FORWARD);      }     else if (mode == 3){       // turn left       g_motor1.run(BACKWARD);       g_motor2.run(FORWARD);       g_motor3.run(FORWARD);       g_motor4.run(BACKWARD);     }   } } float ping(){   // Returns the distance in cm from the ping sensor.  Pulled from   // Arduino docs.     // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.   // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:   pinMode(g_pingPin, OUTPUT);   digitalWrite(g_pingPin, LOW);   delayMicroseconds(2);   digitalWrite(g_pingPin, HIGH);   delayMicroseconds(5);   digitalWrite(g_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(g_pingPin, INPUT);   long duration = pulseIn(g_pingPin, HIGH);    float cm = microsecondsToCentimeters(duration);   return cm; } long microsecondsToCentimeters(long microseconds){   // Simple conversion setp, kept as a function simply to illustrate   // how it works.  Pulled from Arduino docs.     // The speed of sound is 340 m/s or 29 microseconds per centimeter.   // The ping travels out and back, so to find the distance of the   // object we take half of the distance travelled.   //return microseconds / 29 / 2;   return microseconds / 58; }          // while(val == HIGH) {                  // Loop until pin reads a high value //val = digitalRead(ultraSoundSignal); //timecount = timecount +1;             // Count echo pulse time} //ultrasoundValue = timecount;          // Append echo pulse time to ultrasoundValue //lcd.clear(); //lcd.setCursor(0,0); //lcd.print("OBSTAKEL  cm "); //lcd.print(timecount/10); //delay(200); //if(timecount > 0){ //digitalWrite(ledPin, HIGH);}    

Question by pe2hlc   |  last reply


Can I merge the"arduino bluetooth robot" project with a " sound responding robot " project?

I would like to make a robot that follows the sound of a clap but when it finds an obstacle it stop and it waits for a commant from the phone.

Question by ΜαρίναΤ   |  last reply


Contest ideas

I want to make the Create a navigational robot. It can already navigate pretty well, but it is not very intelligent. I want to add Sharp GP2D120 IR sensors so that the robot can recognize an obstacle before it bumps into it. Then it will turn and look for a clearance before it will move ahead. This means it is very unlikely to get stuck. Currently I'm working on a CMUcam, so that when integrated onto the Create, it can follow a white line around, and might come in handy for other purposes as well. I am also toying with the idea of using GPS navigation as I have the receiver and antenna that was used for another project. If GPS is integrated, the Create will be able to move from one waypoint to the other while avoiding obstacles on its path.

Topic by anant   |  last reply


Contest ideas

I want to make the Create a navigational robot. It can already navigate pretty well, but it is not very intelligent. I want to add Sharp GP2D120 IR sensors so that the robot can recognize an obstacle before it bumps into it. Then it will turn and look for a clearance before it will move ahead. This means it is very unlikely to get stuck. Currently I'm working on a CMUcam, so that when integrated onto the Create, it can follow a white line around, and might come in handy for other purposes as well. I am also toying with the idea of using GPS navigation as I have the receiver and antenna that was used for another project. If GPS is integrated, the Create will be able to move from one waypoint to the other while avoiding obstacles on its path.

Topic by anant 


Im will create the 4wdrobot with lcd that show the obstacle and the distance cm help please the code?

/* 2011-10-03 robot4wd_06.pde Eric Pavey - www.akeric.com This software is released to the wild, free to be used and modified. If you use it, I just ask for some credit ;) Program to drive the 4wd robot chasis using an arduino paired up with a ping))) sensor and a servo for collision detection. Hardware: Arduino Duemilanove (but I'm sure any others will work) http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove Arduino is powered off a 5xAA producing 7.5v, sitting in the belly of the chassis. Main chassis is the "4wd mobile platform" from DF Robot http://www.dfrobot.com/index.php?route=product/product&path=37&product_id=97 http://www.makershed.com/ProductDetails.asp?ProductCode=MKSEEED8 http://www.rugcommunity.org/page/dfrobot-4wd-arduino-mobile Motor control using the Adafruit motorshield: http://www.ladyada.net/make/mshield/index.html There doesn't seem to be API docs, but there is this header file: https://github.com/adafruit/Adafruit-Motor-Shield-library/blob/master/AFMotor.h Motor shield is powered off 4xC batteries (6v). Paralax ping))) : http://www.parallax.com/tabid/768/ProductID/92/Default.aspx http://www.arduino.cc/en/Tutorial/Ping Notes: I had to rewire the ribon connecting the ping to the motorshield: The ping's ribon is ground\+5v\signal, but the motorshield's input pins order are +5v\ground\signal. It works from 2cm to 3m. Paralax (Fubata) "standard servo": This is found in the "PING))) Mounting Bracket Kit": http://www.parallax.com/Store/Robots/RoboticAccessories/tabid/145/CategoryID/22/List/0/SortField/0/Level/a/ProductID/248/Default.aspx This is plugged into the 'servo2' port on the motorshield. It uses the servo library: http://arduino.cc/en/Reference/Servo Much of the ping code at the bottom is taken straight from the Arduino examples. */ //-------------------------------------------------------------------------- // Library include stuff: #include // needed for the motorshield. #include // motorshield needs this for running servos. #include LiquidCrystal lcd(3, 4, 5, 6, 11, 12); //-------------------------------------------------------------------------- // globals: // ping))) stuff: int g_pingPin = 19; // this is actually analog pin 5, pretending to be digital, on the motorshield. long g_collideDist = 50; // in cm, how far before collision mode kicks in? long g_cm = 300; // the current ping reading, just ana initial default. boolean g_checkLeft = false; // used for collision detection boolean g_checkRight = false; // used for collision detection boolean g_checkCenter = false; // used for collision detection int g_leftDist = 0; // used for collision detection int g_rightDist = 0; // used for collision detection // motor stuff: AF_DCMotor g_motor1(1, MOTOR12_8KHZ); // back left AF_DCMotor g_motor2(2, MOTOR12_8KHZ); // back right AF_DCMotor g_motor3(3, MOTOR12_8KHZ); // front right AF_DCMotor g_motor4(4, MOTOR12_8KHZ); // front left byte g_motorSpeed = 255; // max is 255 // Mode (state) stuff: byte g_mode = 1; // 1 = drive, 2 = proximity check, 3 = turning byte g_driveDir = -1; // 0 = stop, 1 = straight, 2 = right, 3 = left // servo stuff: Servo g_servo2; int g_servo2pin = 9; // servo2 uses digital pin 9, even though the docs say pin 10... int g_servoCenter = 98; // in degrees. 98 is straight ahead based on how I mounted the servo (it must be // a little inaccurate). full left is 180, full right is 0. // Servo is flipped upside down, fyi int g_servoRight = 135; // how far right? Max is 180, full right. int g_servoLeft = 45; // how far left? Min is 0, full left. // time stuff unsigned long g_time; // global time tracker unsigned long g_ptime; // global previous time tracker unsigned long g_elapsed = 0; // helps keeping track of framerate. unsigned long g_interval = 33; // in ms (about 30fps). This slows down the processing allowing the // multiple systems to play nicely together. Make this number smaller and it won't have enough // time for each state to run properly: The servo won't do a full sweep when scanning. unsigned long g_turnlength = 750; // in ms, how long to turn for. Since we don't know how far // it turns, we just guess on how long it should. The type of terrain turing on has a great // effect on what this should be. This value works well for my hardwood floors. unsigned long g_turnUntil; // used to track how long to turn. //-------------------------------------------------------------------------- // setup \ loop : void setup() { // Attach & center the servo: g_servo2.attach(g_servo2pin); g_servo2.write(g_servoCenter); // center it by default // Setup our framerate stuff g_time = millis(); g_ptime = g_time; } void loop() { // Main program entry point. // Need to keep the aiming and the piging at a fixed rate, or the closer the object gets // to the ping the faster it will aim, and do bad stuff. g_ptime = g_time; g_time = millis(); g_elapsed += g_time - g_ptime; // Wait for the proper amount of time to pass before we do anything: if(g_elapsed < g_interval){ return; } else{ g_elapsed = 0; } // Do stuff, based on the current mode: if(g_mode == 1){ g_cm = ping(); // sometimes the sensor returns a 0 value that can foul up things :( if(g_cm > g_collideDist || g_cm == 0){ // If there is nothing in our way, drive! if(g_driveDir != 1){ g_driveDir = 1; move(g_driveDir); } } else{ // if we're too close to something, stop the motors and switch to 'proximity check' mode: if(g_driveDir != 0){ g_driveDir = 0; move(g_driveDir); } // initialize the proximity check stuff: g_checkLeft = false; g_checkRight = false; g_checkCenter = false; g_leftDist = 0; g_rightDist = 0; // switch to mode 2: g_mode = 2; } } else if(g_mode == 2){ // Do proximity check! boolean checked = proximityCheck(); if(checked){ // Define which direction to turn. // If the right distance is greater than the left distance, turn that direction, // otherwise go the other way: if(g_rightDist >= g_leftDist){ g_driveDir = 2; } else{ g_driveDir = 3; } // now that we've set which direction to turn, start timing how long the turn // has taken, and switch to mode 3. g_turnUntil = millis() + g_turnlength; g_mode = 3; } } else if(g_mode == 3){ // We must be turning! The logic for switching to other modes is in that function. turn(); } } //-------------------------------------------------------------------------- // Helper functions: void turn(){ // Executed when g_mode == 3 // Used to turn the robot. if (millis() < g_turnUntil){ // keep'on turning... move(g_driveDir); } else{ // If we're done turning, see if there is anything still in our way: g_cm = ping(); // sometimes the sensor returns a 0 value that can foul up things :( if(g_cm > g_collideDist || g_cm == 0){ // If there is nothing in our way go back to mode 1: g_mode = 1; } else{ // If stuff is still in our way, turn more in the same direction until // not blocked: g_turnUntil = millis() + g_turnlength; } } } boolean proximityCheck(){ // Used when mode == 2: Swing the ping left and right taking readings to // find which way is safe to go. Returns false when in the middle of the check // operation, returns true when entire check process is complete. // Current angle of the servo: float angle = g_servo2.read(); // check left first: ( full left is 0 deg) if(g_checkLeft == false){ if(angle > g_servoLeft){ g_servo2.write(angle-10) ; return false; } else{ g_checkLeft = true; g_leftDist = ping(); return false; } } // check right second: ( full right is 180 deg) if(g_checkLeft == true && g_checkRight == false){ if(angle < g_servoRight){ g_servo2.write(angle+10) ; return false; } else{ g_checkRight = true; g_rightDist = ping(); return false; } } // Go to center position third: if(g_checkLeft == true && g_checkRight == true && g_checkCenter == false){ if(angle != g_servoCenter){ g_servo2.write(angle-10) ; return false; } else{ g_checkCenter = true; return false; } } // Finally if we've checked left, right, and got back to center, return true // to tell the later code that the full check is complete: if(g_checkLeft == true && g_checkRight == true && g_checkCenter == true){ return true; } else{ return false; } } void move(byte mode){ // This function moves the wheels. Can be called to when mode == 1 (driving) or 3 (turning). if(mode == 0){ // all stop! g_motor1.setSpeed(0); g_motor2.setSpeed(0); g_motor3.setSpeed(0); g_motor4.setSpeed(0); } else{ // full speed! g_motor1.setSpeed(g_motorSpeed); g_motor2.setSpeed(g_motorSpeed); g_motor3.setSpeed(g_motorSpeed); g_motor4.setSpeed(g_motorSpeed); // full speed, but which direction? if(mode == 1){ // go straight g_motor1.run(FORWARD); g_motor2.run(FORWARD); g_motor3.run(FORWARD); g_motor4.run(FORWARD); } else if(mode == 2){ // turn right g_motor1.run(FORWARD); g_motor2.run(BACKWARD); g_motor3.run(BACKWARD); g_motor4.run(FORWARD); } else if (mode == 3){ // turn left g_motor1.run(BACKWARD); g_motor2.run(FORWARD); g_motor3.run(FORWARD); g_motor4.run(BACKWARD); } } } float ping(){ // Returns the distance in cm from the ping sensor. Pulled from // Arduino docs. // The PING))) is triggered by a HIGH pulse of 2 or more microseconds. // Give a short LOW pulse beforehand to ensure a clean HIGH pulse: pinMode(g_pingPin, OUTPUT); digitalWrite(g_pingPin, LOW); delayMicroseconds(2); digitalWrite(g_pingPin, HIGH); delayMicroseconds(5); digitalWrite(g_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(g_pingPin, INPUT); long duration = pulseIn(g_pingPin, HIGH); float cm = microsecondsToCentimeters(duration); return cm; } long microsecondsToCentimeters(long microseconds){ // Simple conversion setp, kept as a function simply to illustrate // how it works. Pulled from Arduino docs. // The speed of sound is 340 m/s or 29 microseconds per centimeter. // The ping travels out and back, so to find the distance of the // object we take half of the distance travelled. //return microseconds / 29 / 2; return microseconds / 58; } // while(val == HIGH) { // Loop until pin reads a high value //val = digitalRead(ultraSoundSignal); //timecount = timecount +1; // Count echo pulse time} //ultrasoundValue = timecount; // Append echo pulse time to ultrasoundValue //lcd.clear(); //lcd.setCursor(0,0); //lcd.print("OBSTAKEL cm "); //lcd.print(timecount/10); //delay(200); //if(timecount > 0){ //digitalWrite(ledPin, HIGH);}

Question by pe2hlc   |  last reply


robot motor question.

I would like to ask if what motor can you suggest so that our intended user can know that our robot is moving? our intended users are the visually impaired so our robot will help them to navigate. our robot is an obstacle detection robot thanks

Topic by bryan_caray   |  last reply


Lego Mindstorms Motor preforming strange?

I have a group of students using lego mindstorms to program a robot to go though an "obstacle" course it starts fine with a simple black line following program but after it comes to the first obstacle a red line it is supposed to stop for 2 seconds and then move forward 2 rotations of the BC motors at 30 power only the C motor moves and with what I am guessing to be 80+ power and the B motor acts like it is trying to spin with 5 power.  The students have hard rebooted the NXT brick, used several different computers to upload the program, made different programs but the issue still persists.  Any help would be much appreciated.  I have even done my own programs and encounter this problem. 

Question by zhang-ting-yu   |  last reply


In a simple ir module using ir transmiitter and ir receiver to detect an obstacle , why black bodies are not detected ?

I have observed that black objects are not detected as ir rays are absorbed by the black object also the cicuit does not work when sunlight falls on it?how can i solve this problem?? please help ?

Question by sandiri   |  last reply


Can you tell me the code for arduino robot that has HC-SR04 Ultrasonic sensor , L293D , IR receiver module and remote?

It is a arduino obstacle avoiding robot , that has arduino uno R3 , L293D motor driver , HC-SR04 ultrasonic sensor , IR remote and receiver module on 2wD chassis.

Question by KodakH1   |  last reply


What sensor should i use for my robot? Answered

Right now my robot has a twin motor tamiya gearbox and 2 wheels in back and a servo with 2 wheels hot glued to it in front for steering and an arduino duomilanove for the brain and it works pretty good except there are no sensors so its not really a robot at all! What I want to do now is buy a sensor that will be able to make my robot avoid obstacles and my track my hand or something. I have ben looking at some sonar sensors, ping sensors, and those sharp ir sensors but i don't know what to pick. It would be great if someone could help me out also I am just getting started so something not tooooo hard to use i mean im up to the challenge though.

Question by Tanners   |  last reply


How to avoid CNC crashes

Hey.I am wondering if it is possible to define particular areas on the bed of my CNC machine which I do not want the toolhead to pass over. My setup is an Arduino powered CNC pen plotter running GRBL. I am generating GCode in inkscape. I know I can set a safe height for the tool to pass over work safely but what if that height doesn't suffice. Can I define an area that the tool must not pass through?As a simple example:Before running a file the tool is at the origin. On sending the file the tool will take the most direct path to the first line to cut/draw. Imagine there is an obstacle that would cause a collision if the tool takes this direct path. Can I do something to ensure the tool navigates around that obstacle?I hope that makes some sort of sense :)Any ideas appreciated

Topic by Henri.Lacoste   |  last reply


How can i make a robot with motors instead of servos? Were in the bay area can i buy servos? Answered

I just got a arduino a few weeks ago and i want to make a robot that has wheels and can avoid obstacles but if i used motors wouldnt i not be able to reverse or control speed?

Question by Tanners   |  last reply


OAWR Legs Lock Up

I'm currently assembling an Obstacle Avoiding Walking Robot, however I find the legs keep locking up.  Basically, as I move the legs the nuts are tightening to the point where the legs won't move any more.  I have washers in all the correct places so must be missing something else. Any tips on how to avoid this? Thanks. James.

Topic by jsluke   |  last reply


Experiment on whether and when a stuck up fan will break into flame.

Let us consider a typical home electric fan, and we put some obstacle to prevent the fan propeller from turning, then we switch on the fan on the fastest speed; will the fan and when eventually break into flame because the propeller cannot rotate? Have there been experiments to see what will happen? Marius de Jess

Question by Marius de Jess   |  last reply


Chasing Robots

Hey guys i need help with something. i have two obstacle avoiding robots. but i want them to chase and evade each other. like predator prey situations. so i have been trying to connect them with radio signals. does anyone have any ideas how i can do that? if not radio waves il listen to any ideas in IR instead. ur help would be appreciated. (yes i know im not using proper english lol)

Topic by faroos7   |  last reply


learning robot

Hey guys. friend and i are working on a project. we are trying to build a robot that will basically be able to follow a path. if there are obstacles in front it will go around them and then continue to the finishing point. no we also want it to learn about its surrounding. so if we bring the robot back to its starting point it will be able to get to the finish with out bumping into objects.we are planing to adopt this robot here https://www.instructables.com/id/Make-a-wall-avoiding-Robot!/?ALLSTEPSwhat do u guys think is it possible and if so how.the robot will learn by creating a grid in its memory using multi-dimensional arrays.

Topic by DELETED_kclv1988   |  last reply


Guidance needed - Need idea for elementary school Maker Faire - physical science station

Hi.Last year, I had the students build a scooter, create an obstacle course, run it through for our Maker Faire physical science station. It was fantastic. I'm looking for ideas for this year's activity. Criteria:- students must build something- students must physically do something with the built item- groups of 3-5 students- 30 min including disassembly All ideas are welcome!meganmeganmshields@yahoo.com

Topic by MeganS136   |  last reply


What is your biggest challenge to finishing a project?

Hey Guys, I have struggled with procrastination in the past, and its always been a constant challenge for me to finish a project due to it. I was curious if you lot had similar struggles when tackling a project. What is the biggest obstacle in your path to accomplish something? Is it just starting the work/project? Is it distractions? ADD? How about lack of motivation? Do you reach a plateau and eventually stop working on the project when your 60% done? If so, what goes through your head? How do you deal with it?

Topic by sal.afzal   |  last reply


Arduino Car

Hi, So in computer engineering I've got to make a arduino based car, I've added a whole bunch of features such as IR tracking, obstacle avoidance(proximity sensor), optical tracking(follow a black line), and remote control through an android based phone. Since I'm a total newbie to technology I'm having trouble. I would appreciate it if You guys can point me towards resources and arduino libraries(for coding) that will work for me. Right now for coding I've only got basic pseudo-code setup since I do not know what libraries to use. I have searched up many sketches online and looked at them but didn't really understand any of the code. Here's the basic pseudo-code I got setup on the things that I've got to work on: DC Motor (4 of em for the wheels) (I also plan to add a stepper motor for turning right and left so if you could direct me on that as well) //Import necessary library //Setup the motors and pins //If signal for forward received //Code for moving forward //Set speed //Else If signal for backward received //Code for moving backward //Set speed //Else If signal for right received (keep turning right till stop signal received) //Code for moving right //Set speed //Else If signal for left received (keep turning left till stop signal received) //Code for moving left //Set speed //Else If signal for stop is received (Should we slow down to a stop or just stop?) //Code for stop //Set speed IR (I've got transmitting and recording diodes) //Import Library //Declare Pin for the IR Sensor //While loop: Move Right //If IR signal is received //move forward //Else //Jump back to top of loop Proximity Sensor (obstacle avoidance mode) (I might either use the one from Lego kit or buy a separate one ) //Import Library //Declare Pin for proximity sensor //While Loop: Send out sonar(echolocation or whatever) every second //Is there any obstacle?   //Yes, turn right so many degrees, and go back to while loop   //No, move on forward at set speed //If you’re surrounded and cannot exit send out a message through flashing LED's ________________________________________________________________________________________________________ I'm not asking for the code or for any of you to do all my stuff for me, I'm just asking for direction and resources. Thank You

Topic by Dark_Pheonix   |  last reply


Scholarship Contest Idea: iRobot Streetview

My Idea is to make my a create robot go from point A to point B based on GPS position and not a set programmed path. The robot would be placed at point A and told to go point B based on GPS and the robot would figure out how to get there. The main problem with this will be dealing with unknown obstacles that the robot will run into and have to get around. The other difficulty will be in getting the GPS and the create to talk with each other. Once the create gets to point B it will take a picture then rotate 90 degrees and take another picture and so on till it gets a 360 degree view of the spot that it is in. If you have any questions please let me know. Ed

Topic by pong1092   |  last reply


Halo Reach forge world Racetracks

So I recently got Halo Reach, and I started messing around with Forge a few weeks back.  After a deleted prototype, I ended up making "Infinite 8", a racetrack map that has nice wide tracks and is shaped like the infinity logo.  It's not quite done (I'm still debating on whether to add grav lift boosters and obstacles) but I have a video of what I have so far on Youtube: If you want, you can post videos of your own forge world maps too! UPDATE:  here is me running a finished version of my course:

Topic by DJ Radio   |  last reply


quadcopter with kk board and arduino?

We are using a kk board 2.1.5 to control the  quad copter  and it works just fine.Well now we want to move a bit further and start making our own self stabilization algorithms based on slam algorithms . I want the public's opinion on using both the KK board (to auto stabilize ,don't want to mess around the PID  )  and adding a arduino duo in between the KK board and the receiver . So basically the idea is that the receiver signals are going to be altered using some mathematical functions to add features such as obstacle detection and avoidance  . My friend was rasing some doubts regarding this  as the signal input and pwm output might not be in sync Thanks in advance 

Question by cthaliyath   |  last reply


Anti-gravity Machine concept

This is a concept I came up with for an idea of an anti-gravity machine.  Let me just state for the record... I do not think this will actually work.  However, while I am quite certain this idea should not work... based upon my limited knowledge of science... it would seem like it could work.  Unfortunately I know I am never going to spend the thousands if not millions of dollars to build this concept to find out. The basic premise of the idea is the use of angular momentum to overcome the force of gravity.  Imagine if you will, a gyroscope spinning at such a high velocity that its outward force overcomes the downward force of gravity.  Naturally, one of the big obstacles is generating the speeds necessary to create the velocity such that angular momentum is greater than downward force. What I essentially propose is a spinning ring that is propelled in the same way as a maglev train.  Using Electromagnetic propulsion or EMP to accelerate a ring in a vacuum by the utilization of a flowing electrical current and magnetic fields may in theory generate the speeds necessary for the force to overcome gravity.  Unfortunately, the power to run such a vehicle and the weight to power ratio are significant obstacles. Two of these rings above one another I theorize can create tremendous propulsion if the angles of the rings were changed.  Using hydrolics to change the angle of alignment of these two rings may create incredible forward momentum.  Once more, such a vehicle would not be limited to operation within Earth's atmosphere unlike jet or other propulsion mechanisms.  In fact, it should operate at peak efficiency in a zero gravitational environment. This is all theory... and I'd love to know if it is indeed as crazy as it sounds.

Topic by DarkRubyMoon   |  last reply


Load and print file lines in processing?

I want to make a cnc/3D printer using arduino, and right now my main obstacle (besides slow shipping on the remaining motor drivers) is how to get G-code to the arduino.  I have a way to get the Gcode in a .txt file, but I need to separate every line, then send it over serial every ~2 seconds.  Is this possible with processing, and if so, how do I do it.  Note: it needs to send each line separately, and so the arduino reads it as X# Y#, not just ## ##  not sure if there's a difference, but if there is, it must be picked up that way.  Also, I have GloviePIE, (a keboard emulator), if that helps in any way.    Thanks

Question by jduffy54   |  last reply


How to generate a beep sound in a watch ? Answered

I'm working on an electronic design project : Smart Watch  this watch worn  by clients suffering  from early stages of Alzheimer disease  will play a role so that it guides the patient back to his/her house . We pre-defined a distance boundary that the client will not exceed (speedometer). I want to know if there is a device (sensor) that should be integrated in the watch  so that it generates or creates beep sound (or vibrations) once the client crossed or approaches the Limit distance boundary ( something similar to the beep sound in the car system when it approaches an obstacle ). And , if it is possible ,any ideas or hints on how to implement it on the watch ? Thank you in advance , and if you need more information please let me know :)

Question by ClearVision   |  last reply


Coil + magnet = power source.

People, I need your help! I'm a student at college and my primer subject is physics. Let's just say I know enough about electricity and power. But my major obstacle towards constructing stuff is electronics. I have only just scratched the surface of it. I want to make a power source out of a coil and a magnet inside (electrical induction). Can anyone point out how exactly to build the thing? My desired output voltage is about 5V, or sth. I'll use it for electronics, so the amperage doesn't really matter. I would also like to see a circuit that converts AC to DC, cause the coil will give out only AC and that's not good. Thanks in advance!

Topic by 5ar 


How to make a real Bluetooth range extender?

I want a bluetooth device that connects to my phone as a standard bluetooth headset and allows any bluetooth headset to connect to it as if it were my phone. I am thinking of using it (or chaining a few of them) to create a larger area for my bluetooth headset for my phone. THANKS!? (Yes...I have seen the antenna hacks, but they don't allow me to boost the power of the signal like I need to.  And, this device should also allow chaining to get the signal out a lot further and around metal obstacles.) Even better would be the ability to connect multiple devices to the extender so that multiple people could be on the same call on their bluetooth headsets simultaneously.  (Yeah...it's getting deep in here.  But the geek in me wants what it wants.)

Question by squishyalt   |  last reply


Coil + magnet = power source

People, I need your help! I'm a student at college and my primer subject is physics. Let's just say I know enough about electricity and power. But my major obstacle towards constructing stuff is electronics. I have only just scratched the surface of it. I want to make a power source out of a coil and a magnet inside (electrical induction). Can anyone point out how exactly to build the thing? My desired output voltage is about 5V, or sth. I'll use it for electronics, so the amperage doesn't really matter. I would also like to see a circuit that converts AC to DC, cause the coil will give out only AC and that's not good. Thanks in advance!

Topic by 5ar   |  last reply


SENSOR- Ultrasonic HC-SR04 (Interfacing HC-SR04 with 8051)

Hi friends, I am doing a project based on obstacle detector. It is a outdoor project hence i choose to buy an ultrasonic sensor to work efficiently on both bright sun light as well as dark nights. Now my problem is i am not able to interface this sensor with my controller. Anyone please tell me what input i must give to trig input of that sensor and what kind of output i get form the echo pin. also tell me how can i interface this sensor with the AT89S52. i have attached the user manual which i downloaded from internet.  Please help me with your valuable comments, Thanks in advance.

Topic by knachuthan   |  last reply


How can I create a program that allows me to run it and automatically upload a sketch to arduino without the software?

I have an Arduino uno board, and a robot that can follow, and have obstacle avoidance. My robot is designed for a person at school who has crutches for life, and the robot follows her with her books. I want to create a program with visual studio that automatically uploads each sketch to the board, depend on which button to click on. I already have visual micro for Visual Studio 10, and when I debug it or build it, it just uploads it to the robot. I need it to be a .bat file or a .exe file. If anyone could help me with this, I will be extremely grateful. Any ideas? Below I have a screenshot of what the program plans on doing.

Question by 28holes   |  last reply


Controlling a DC motor (12v) using a SN754410 Motor Driver Ic and 2 snap-action switches?

I am using a Arduino Uno with a SN754410 ic to control my 12v motor (exactly like diagram from http://itp.nyu.edu/physcomp/Labs/DCMotorControl) Managed to use a SPDT switch to change direction (sheer miracle for me) I plan to put 1 snap-action switch in front of my bot and 1 at the back, so it will travel forward until it hits an obstacle, then reverse all the way until it hits another obstacle. Once the motor is activated, it will go maybe go for 5 minutes, then pause for 10mins, then on for 5 mins again, and so forth. First attempt with the arduino so any help with detailed instructions about how to go about wiring these two extra switches and the programming code would be greatly appreciated! Also, I need it to be mobile so I'm thinking of connecting a 12v2.2AH/20HR sealed rechargeable battery to the motor itself, and another 9v for the board cos I read it regulates it to 5v. Will this be ok? Will it be able to last my bot for a few hours? My current code: int switchPin = 2;    // switch input int motor1Pin = 3;    // H-bridge leg 1 (pin 2, 1A) int motor2Pin = 4;    // H-bridge leg 2 (pin 7, 2A) int enablePin = 9;    // H-bridge enable pin     void setup() {     // set the switch as an input:     pinMode(switchPin, INPUT);     // set all the other pins you're using as outputs:     pinMode(motor1Pin, OUTPUT);     pinMode(motor2Pin, OUTPUT);     pinMode(enablePin, OUTPUT);     // set enablePin high so that motor can turn on:     digitalWrite(enablePin, HIGH);   }     void loop() {     // if the switch is high, motor will turn on one direction:     if (digitalRead(switchPin) == HIGH) {       digitalWrite(motor1Pin, LOW);   // set leg 1 of the H-bridge low       digitalWrite(motor2Pin, HIGH);  // set leg 2 of the H-bridge high     }     // if the switch is low, motor will turn in the other direction:     else {       digitalWrite(motor1Pin, HIGH);  // set leg 1 of the H-bridge high       digitalWrite(motor2Pin, LOW);   // set leg 2 of the H-bridge low     }   }

Question by email.jodi.now   |  last reply


Arduino ultrasonic sensor activating servo movement?

I am building a rc car as part of a pretty big project that has a bunch of other stuff on it . But one thing I can't figure out, being I'm only slightly familiar with arduino (UNO), is how to make a servo move when the sensor tells it to. I am going to attach a hook on the front to lift up an object so I can transport it. Now what I want to do is have the sensor detect the object when it is close enough to the hook (3-4") and then tell the servo to move a given degrees, around 25, just enough to pick it up. I've been toying with the code for the obstacle detecting robots trying to see if I cant modify that for this type of use but a lot of that code is backup commands, alternate routes and all that other stuff. just need a simple detect object, send signal to servo and servo moves the hook to pick the object up. Thanks  

Question by dmegill   |  last reply


Rat Brain + Robot = Research

Researchers have created a robot, controlled by a rat brain, to help study memory and look into the causes behind some debilitating diseases. The blob of nerves forming the brain of the robot was taken from the neural cortex in a rat foetus and then treated to dissolve the connections between individual neurons.Sensory input from the sonar on the robot is piped to the blob of cells to help them form new connections that will aid the machine as it navigates around its pen.The study has big implications, say the researchers.The brain cells have been taught how to control the robot's movements so it can steer round obstacles and the next step, say its creators, is to get it to recognise its surroundings.Once the robot can do this the researchers plan to disrupt the memories in a bid to recreate the gradual loss of mental faculties seen in diseases such as Alzheimer's and Parkinson's.Interesting stuff from the BBC.Side note: When you watch the video, notice the volume bar. But these go to eleven!

Topic by joshf   |  last reply


PVC Post

Hi, I'm a soccer coach.  I'd like to make some inexpensive posts to serve as obstacles/markers that I can use indoors.  I have 5' pvc pipe, but can't seem to locate or concoct something to hold the posts upright both affordably and that aren't too wide to get in the way of the players or the soccer ball.  Ideally, I'd have something that is only a few inches wide with a 3/4" hole in the center to hold my 3/4" pvc.   Thus far, the best thing I can come up with are a few 2.5/5lb thick plastic weight plates where the center hole happens to be just about 3/4" wide.  Those seem to quite difficult to come by though!  The next closest thing I've found were either heavy steel flanges or rubber mounts specifically designed to hold plastic posts.  At $8 or more/each though, I was hoping to find something a little less expensive. Anyone have any ideas? 

Topic by DDallen   |  last reply


Indoor spacial position system (indoor mini-gps)

Hi all! I'm hoping to work on a little system to allow a device to work out where it is in a room, with some degree of accuracy. I've thought of a few ideas; cameras and tracking points, sonar of some sort, and a few others, but they all have the caveat of requiring direct line-of sight, all the time. My most hopeful idea is that I could create a sort of mini GPS system, thus: A number of radiowave transmitters, perhaps FM, sit in the corners of the room, and transmit the time, or more likely something like 0-9999 in binary, all the time. My device then moves around the room, and works out where it is in the room, based on the number received by each of it's 3(?) radios, and the difference between them. There are a few potential caveats to this approach:   The radio waves may well bounce off the walls, and confuse the receiver.   The assumption is made that there's enough time between transmission of the signal and receiving to notice a difference   Obstacles to the line-of-sight might skew the difference The list is long. I don't suppose anyone has any input on this idea, do they? Graham

Topic by paradoxdetected   |  last reply


Left-handed and trying to mod the world around me.

I'm a left-handed person trying to remove obstacles in my everyday *workshop* routines. I've found one Instructable that suggests putting a chalkboard/whiteboard writing space on the *left* side of the desk. That's GENIUS! But it's not enough, and my Google-fu yields nothing more exciting across the interwebz. Do YOU have any lefty-friendly ideas?   My workshop activities--in case it helps give you some direction for responding: -beginning woodworking (I have a drill press, circ saw, and some other fancy toys) -sewing (Singer machine; also by hand) -intermediate to advanced Martha Stewart-esque crafty things Particular interests that have no bearing on my question but might help guide an otherwise vague response: -Making work spaces ergonomically healthier (I'm a 5'2 dancer/writer living with sciatica; husband is 5'11 and 38 years old with no desire to age faster by ruining his back some more) -the art and science of lighting interior rooms for their specific purpose/occupant's needs

Topic by AnnaUndercover   |  last reply