Go Down

Topic: Robot chassis first test (Read 1 time) previous topic - next topic

UnaClocker

http://www.youtube.com/watch?v=0hAjB8jpdzM
It's one of those cheap 4wd skidsteer chassis from China, I built a pair of H-Bridges with TIP122/TIP127 chips. In the video, I just have it run through the pre-programmed moves as a bit of a functionality test. I have no sensors on the unit yet.

And here's the sketch:
Code: [Select]
/*  Brian's TeensyBot sketch. 4wd SkidSteer chinese robot Chassis
    Teensy++ microcontroller
   
    Driver's Side Motor IO Pins:
    14 - Backwards
    15 - Forwards
   
    Passenger Side Motor IO Pins:
    25 - Forwards
    26 - Backwards
   
14,15,25 and 26 are PWM capable pins.
*/

void setup() {
  pinMode(6, OUTPUT);  // Onboard LED
  pinMode(14, OUTPUT); 
  pinMode(15, OUTPUT); 
  pinMode(25, OUTPUT); 
  pinMode(26, OUTPUT);
}

void goForward() {
  // Assuming allStop was called before this - Maybe I should call it from here, first?
  digitalWrite(15, HIGH);
  digitalWrite(25, HIGH);
}

void goBackward() {
  // Again, assume all stopped before this
  digitalWrite(14, HIGH);
  digitalWrite(26, HIGH);
}

void allStop() {
  digitalWrite(14, LOW);
  digitalWrite(15, LOW);
  digitalWrite(25, LOW);
  digitalWrite(26, LOW);
  digitalWrite(6, LOW); // onboard LED
}

void goLeft() {
  // Slight left turn
  digitalWrite(14, LOW);
  digitalWrite(25, LOW);
  digitalWrite(26, LOW);
  digitalWrite(15, HIGH);
}

void goRight() {
  digitalWrite(14, LOW);
  digitalWrite(15, LOW);
  digitalWrite(26, LOW);
  digitalWrite(25, HIGH);
}

void clockwise() {
  // Driver's side forward, pass side backward
  digitalWrite(14, LOW);
  digitalWrite(25, LOW);
  digitalWrite(15, HIGH);
  digitalWrite(26, HIGH);
}

void counterClockwise() {
  digitalWrite(15, LOW);
  digitalWrite(26, LOW);
  digitalWrite(14, HIGH);
  digitalWrite(26, HIGH);
}

void loop() {
  allStop();
  delay(100);
  digitalWrite(6, HIGH);
  goForward();
  delay(1500);
  allStop();
  delay(450);
  digitalWrite(6, HIGH);
  goBackward();
  delay(1500);
  allStop();
  delay(450);
  digitalWrite(6, HIGH);
  goLeft();
  delay(750);
  goForward();
  delay(750);
  allStop();
  delay(450);
  digitalWrite(6, HIGH);
  goRight();
  delay(750);
  goForward();
  delay(750);
  allStop();
  delay(450);
  digitalWrite(6, HIGH);
  clockwise();
  delay(750);
  allStop();
  delay(450);
  digitalWrite(6, HIGH);
  counterClockwise();
  delay(750);
  allStop();
  delay(300);
}
Brian from Tacoma, WA
Arduino evangelist - since Dec, 2010.

Nikka93


Onions

It is looking good!
I almost built a robot as a first project, but I could not find any wheels. I had the motors, arduino and a piece of MDF to screw the motors onto, as well as some microswitches as sensors, and all the code. The only problem was, I had no way to connect the wheels to the motors!   :0  Microswitches are good as sensors as they require very little operating force. By suspending them out on springs or something similar, you can have the sensors stopping the robot before it hits the wall.
My website: http://www.harryrabbit.co.uk/electronics/home.html Up and running now! (Feel free to look round!) :D

cr0sh


It is looking good!
I almost built a robot as a first project, but I could not find any wheels. I had the motors, arduino and a piece of MDF to screw the motors onto, as well as some microswitches as sensors, and all the code. The only problem was, I had no way to connect the wheels to the motors!   :0  Microswitches are good as sensors as they require very little operating force. By suspending them out on springs or something similar, you can have the sensors stopping the robot before it hits the wall.


You didn't have any 2-part epoxy or similar? Seriously, there are a TON of ways to connect wheels to motor shafts...
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Go Up