Self Navigating Arduino Robot

Posted on 11/08/2017 by nschreiber0813
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.

Dear: LMR I am hoping to build a self navigating robot. Right now it only obstacle avoids. It uses arduino mega, 12 volt motor driver, Ping sensor, and a 2s lipo battery. I used arduino and programmed it mostly in one day. Here is the code. I will post a video shortly.  The chassis is made from an old excavator toy I found at the dump. I took the excavator part off of it since it was only used for decoration and striped it's electronics. Then I screwed onto it a two by four piece of wood to ...


Self Navigating Arduino Robot

Dear: LMR

I am hoping to build a self navigating robot. Right now it only obstacle avoids. It uses arduino mega, 12 volt motor driver, Ping sensor, and a 2s lipo battery. I used arduino and programmed it mostly in one day. Here is the code. I will post a video shortly. 

The chassis is made from an old excavator toy I found at the dump. I took the excavator part off of it since it was only used for decoration and striped it's electronics. Then I screwed onto it a two by four piece of wood to help mount electronics and then screwed a pencil case on top of it. While the pencil case was on top of it I then drilled some necessary holes to help out with the electronics and motor reach the arduino and motor driver. Thanks!!! Wish me good luck!!!

From: Noah

#include <NewPing.h>
NewPing sonar(3, 5, 200);
void setup() {
  // put your setup code here, to run once:
 Serial.begin(9600);
 pinMode(13, OUTPUT);
 pinMode(12, OUTPUT);
 pinMode(9, OUTPUT);
 pinMode(8, OUTPUT);
 pinMode(7, OUTPUT);
 pinMode(6, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  if(sonar.ping_cm() <= 30)
  {
    CCW(255);
  }
  if(sonar.ping_cm() > 30)
  {
    Forward(255);
  }

}
void Forward(int Speed)
{
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  analogWrite(9, Speed);
  digitalWrite(8, LOW);
  analogWrite(7, Speed);
  digitalWrite(6, LOW);
 
}
void Backward(int Speed)
{
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(9, LOW);
  analogWrite(8, Speed);
  digitalWrite(7, LOW);
  analogWrite(6, Speed);
}
void CCW(int Speed)
{
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  analogWrite(9, Speed);
  digitalWrite(8, LOW);
  digitalWrite(7, LOW);
  analogWrite(6, Speed);
}
void CW(int Speed)
{
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(9, LOW);
  analogWrite(8, Speed);
  analogWrite(7, Speed);
  digitalWrite(6, LOW);
}
void Stop()
{
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
}

UPDATE: 8/21/2017

Dear: LMR

I managed to get the robot to obstacle avoid better. Enjoy the new video and thanks to all those who had helped me. It means a lot.

From: Noah

#include <NewPing.h>
NewPing sonar(3, 5, 200);
void setup() {
  // put your setup code here, to run once:
 Serial.begin(9600);
 pinMode(13, OUTPUT);
 pinMode(12, OUTPUT);
 pinMode(9, OUTPUT);
 pinMode(8, OUTPUT);
 pinMode(7, OUTPUT);
 pinMode(6, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  Forward(255);
  if(sonar.ping_cm() <= 30)
  {
    Backward(255);
    delay(1000);
    CCW(255);
    delay(250);
    Stop();
    delay(1000);
  }
}
void Forward(int Speed)
{
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  analogWrite(9, Speed);
  digitalWrite(8, LOW);
  analogWrite(7, Speed);
  digitalWrite(6, LOW);
 
}
void Backward(int Speed)
{
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(9, LOW);
  analogWrite(8, Speed);
  digitalWrite(7, LOW);
  analogWrite(6, Speed);
}
void CCW(int Speed)
{
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  analogWrite(9, Speed);
  digitalWrite(8, LOW);
  digitalWrite(7, LOW);
  analogWrite(6, Speed);
}
void CW(int Speed)
{
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  digitalWrite(9, LOW);
  analogWrite(8, Speed);
  analogWrite(7, Speed);
  digitalWrite(6, LOW);
}
void Stop()
{
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
}

Obstacle Avoids at the moment

  • Actuators / output devices: Gear DC motors
  • Control method: autonomous
  • CPU: Arduino Mega 2560
  • Operating system: none
  • Power source: Lipo 2s
  • Programming language: Arduino
  • Sensors / input devices: PING
  • Target environment: Indoors is best
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