Let's Make Robots!

Egon V3 - IR Remote Controlled

Navigate with IR Remote

Hey Again...

 

This is my third robot and I think they keep getting better.  I am new at this and prior to 2 months ago had never messed with any electronics or programming of any sort so please be kind.  This is Egon.  He started out around christmas time and a simple bot made from an IPAD box with two servos and a Ping ultrasonic sensor.  I then upgraded him to homemade IR sensors which you can see in the front of Egon.  When I posted my proof a concept a few weeks ago i was challenged to make him move around with an IR remote instead of just being autonomous.  Well, it took my two weeks but i have done it.  Oh yeah, and gave Egon a makeover a little with some commonly found electrical boxes from HomeDepot.  I had an old remote from a camcorder that I did not use anymore and it looked like a nice remote to use.  First thing I did was use an arduino sketch and one IR reeciever from RadioShack (38MHz) to read the codes for each button i was going to use with the serial monitor.  They codes were very consistant with each button push but i could not get them to work in any way or get a sketch to compile.  It took a while to figure out that i had to turn the HEX codes into Decimal codes for the arduino to decifer them.  I used the built in calculator on my windows computer to do the conversion.

Egon V3 uses the following:

2 Futaba S3003 servos modded for continuous rotation
1 IR Receiver from Radio Shack
1 IR Remote
Arduino Uno
Two cool light up eyes
9v Battery for Arduino
6v Battery for Servos

Misc. Hardware from home depot for the body

You can see the IR Sensors mounted on the front

 

Here is the code that was used to control him.  Im sure it can be done with shorter code...I am working in it...

 

//Start Code Here

 

#include <IRremote.h>
long int Buttons[9] = {
  1106673791,  //0 FORWARD RIGHT
  1106657471,  //1 FORWARD
  1106690111,  //2 FORWARD LEFT
  1106649311,  //3 LEFT
  1106681951,  //4 STOP
  1106665631,  //5 RIGHT
  1106698271,  //6 BACK LEFT
  1106645231,  //7 BACK
  1106677871}; //8 BACK RIGHT


int LmtrSpd=0;
int RmtrSpd=0;
#define LServoMtrPin 2
#define RServoMtrPin 3
#include <Servo.h>
Servo LServoMtr;
Servo RServoMtr;

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
int BtnPressed = 0;

int Ttime = 0;
int Ftime = 0;

void setup()
{
  Serial.begin(9600);
  LServoMtr.attach(LServoMtrPin);
  LServoMtr.write(92);
  RServoMtr.attach(RServoMtrPin);
  RServoMtr.write(92);

  irrecv.enableIRIn(); // Start the receiver
}

void dump(decode_results *results)
{
  if (results->decode_type == NEC)
  {
    unsigned long store = (results->value);
   
    for(int x=0; x<9; ++x)
    {
      if(store == Buttons[x])
      {
        BtnPressed = x;
       }
    }
  }
}

void loop()
{
  Ttime = millis();
  if (irrecv.decode(&results))
  {
    dump(&results);
    if(BtnPressed == 1) //Fwd
    {
      Serial.println("FWD");
      LmtrSpd=180;
      RmtrSpd=0;
    }
    if(BtnPressed == 2) //Fwd Right
    {
      Serial.println("FWD-RIGHT");
      LmtrSpd=180;
      RmtrSpd=23;
    }
    if(BtnPressed == 0) //Fwd left
    {
      Serial.println("FWD-LEFT");
      LmtrSpd=113;
      RmtrSpd=0;
    }
    else if(BtnPressed == 7) //Back
    {
      Serial.println("BACK");
      LmtrSpd=0;
      RmtrSpd=180;
    }
    else if(BtnPressed == 8) //back right
    {
      Serial.println("BACK-RIGHT");
      LmtrSpd=0;
      RmtrSpd=113;
    }
    else if(BtnPressed == 6) //Back left
    {
      Serial.println("BACK-LEFT");
      LmtrSpd=23;
      RmtrSpd=180;
    }
    else if(BtnPressed == 3) //Left
    {
      Serial.println("LEFT");
      LmtrSpd=0;
      RmtrSpd=0;
    }
    else if(BtnPressed == 5) //Right
    {
      Serial.println("RIGHT");
      LmtrSpd=180;
      RmtrSpd=180;
    }
 
    else if(BtnPressed == 4) //stop
    {
      Serial.println("STOP");
      LmtrSpd=90;
      RmtrSpd=90;
    }

    LServoMtr.write(LmtrSpd);
    RServoMtr.write(RmtrSpd);

    irrecv.resume(); // Receive the next value
  }
  int Ftime = millis();
  delay(25-(Ftime-Ttime));
}

 

Hope you like him and I am continuing to get better.....

 

Thanks..

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Wow. I agree with Maxhirez, that's a nice looking bot. Makes me want to redo some of my bots so they're not just a rat's nest of wires.

Thanks documenting it.

That's a nice looking bot.  10/10 on aestheticly pleasing use of materials!  Keep him coming.  Did you enjoy the experience?