Pages: [1]   Go Down
Author Topic: Robot chassis first test  (Read 1189 times)
0 Members and 1 Guest are viewing this topic.
Tacoma, WA
Offline Offline
Full Member
***
Karma: 4
Posts: 192
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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:
/*  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);
}
Logged

Brian from Tacoma, WA
Arduino evangelist - since Dec, 2010.

Rome - Italy
Offline Offline
Full Member
***
Karma: 2
Posts: 246
Arduino UNO "Noob" User
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nice little robot  smiley-eek
Logged

Newcastle, England
Offline Offline
Sr. Member
****
Karma: 2
Posts: 489
Always learning!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!   smiley-mad  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.
Logged

My website: http://www.harryrabbit.co.uk/electronics/home.html Up and running now! (Feel free to look round!) smiley-grin

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 36
Posts: 5519
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!   smiley-mad  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...
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Pages: [1]   Go Up
Jump to: