After testing some code on my previous Arduino Uno, I realised it was old and faulty so I had to buy a new board. I ended up buying this, the eleven by freetronics, an arduino uno compatible board. It will be used for this project now.
Below are the latest shots of the circuit board now with the coordinate logic circuit added; there are two identical circuits, one for x and one for y. A rough diagram of this is also below. In summary each circuit has 4 lines connected to 4 terminals. The 4 wires of the photo interrupter which will carry out the coordinate system.One line will run to ground, one will run to the arduino (pin 8 for the first circuit and pin 9 for the second circuit), one will run to 5V on arduino through a 510ohm resistor (the light blue resistor with yellow band), and the last will run to 5V on arduino through a 4K7 resistor (darker blue resistor).
These are the final trimmed, tinned and wired up photo interrupters.
Below is the mock X-axis of the robot. It currently functions for forward movement, reversing and stopping. It works on a pulley system where one side is spun by a motor connected to a pulley wheel which was CAD modeled and 3D printed to match the D shape of the motor. A rubber band is wound around the two wheels and the centre is connected to the X-axis. One thing you will notice is compared to the original robot design, the rod location, x axis structure and motor location has been moved down. This is because when the motor was fixed above, the pulley didn't work very efficiently so I had to make a free section in the centre to make the pulley and rods as close as possible. This is all quite flimsy right now mostly taped together so it will be just pictures for now. After I build the real lego structure of the x and y axises I will be posting a video of their function. The rubber band will be replaced with something more durable, and the metal rods will be replaced with thicker brass rods which will allow for smoother movement.
The arduino code for this mock X-axis is as follows; it carries out forward movement, reverse and stopping:
//Automated Gantry Warehousing Robot
const int Xdir=6;
const int Ydir=4;
const int Xenable=5;
const int Yenable=3;
void setup()
{
Serial.begin(9600);
pinMode(Xdir, OUTPUT);
pinMode(Ydir, OUTPUT);
pinMode(Xenable, OUTPUT);
pinMode(Yenable, OUTPUT);
digitalWrite(Xenable, LOW);
digitalWrite(Yenable, LOW);
}
void loop()
{
XForward();
delay(1250);
XStop();
delay(1000);
XReverse();
delay(1250);
XStop();
delay(1000);
YForward();
delay(500);
YStop();
delay(1000);
YReverse();
delay(500);
YStop();
delay(1000);
}
void XForward(){
digitalWrite(Xenable,LOW);
delay(30);
digitalWrite(Xdir,HIGH);
digitalWrite(Xenable,HIGH);
}
void YForward(){
digitalWrite(Yenable,LOW);
delay(30);
digitalWrite(Ydir,HIGH);
digitalWrite(Yenable,HIGH);
}
void XReverse(){
digitalWrite(Xenable,LOW);
delay(30);
digitalWrite(Xdir,LOW);
digitalWrite(Xenable,HIGH);
}
void YReverse(){
digitalWrite(Yenable,LOW);
delay(30);
digitalWrite(Ydir,LOW);
digitalWrite(Yenable,HIGH);
}
void XStop(){
digitalWrite(Xenable,LOW);
digitalWrite(Xdir,LOW);
}
void YStop(){
digitalWrite(Yenable,LOW);
digitalWrite(Ydir,LOW);
}
No comments:
Post a Comment