Arduino Robot Build
Tuesday, July 2, 2013
Tuesday, May 14, 2013
Arduino Robot Build 0.1
I am a master electrician and an electrical engineering student at the University of Michigan-Dearborn turning my classroom skills into a hobby. I am working on building a robot platform to experiment with the Arduino Uno micro-controller.
Purchased parts include: (1) Arduino Uno,(2) Parallax Continuous Rotation Motors.
The body is made from a square piece of Lexan plastic, the motor mounts are cast aluminum angle, the wheels are 1/2" plexiglass, and the third wheel is a chair caster. There are not any sensors mounted right now. I programmed the robot using Arduino open source software (See code below). I have it performing forwards and backwards motion, CW and CCW circles, and left and right turns. Each motor is attached to the 5 VDC on the board and their own PWM digital output pin.
#include <Servo.h>
Servo leftMotor1, rightMotor1;
void setup()
{
leftMotor1.attach(11); //attach motors to proper pins
rightMotor1.attach(9);
delay(1000);
}
void stop()//stop motors between actions
{
rightMotor1.write(90);
leftMotor1.write(90);
delay(1000);
}
void loop()
{
rightMotor1.write(0);//forward
leftMotor1.write(101.5);
delay(5000);
stop();
rightMotor1.write(180);//backward
leftMotor1.write(78.5);
delay (5000);
stop();
rightMotor1.write(0);//turn left
leftMotor1.write(90);
delay(3000);
stop();
rightMotor1.write(90);//turn right
leftMotor1.write(180);
delay(3000);
stop();
rightMotor1.write(180);//back right
leftMotor1.write(90);
delay(3000);
stop();
rightMotor1.write(90);//back left
leftMotor1.write(0);
delay(3000);
stop();
rightMotor1.write(0);//circle left
leftMotor1.write(97);
delay(2000);
stop();
rightMotor1.write(85);//circle right
leftMotor1.write(180);
delay(2000);
stop();
}
Subscribe to:
Posts (Atom)