GROUP 1
Hi! We are three students, Pablo Arbués, pilar martínez and Mario Concellón, from Cardenal Xavierre school and we're going to explain to you how we made a light seeker robot!!
First of all the list with the materials and tools we have used:
。Arduino nano
。A breadboard
。Male-male wires
。3 wheels
。Two DC motors
。Two 4.5v batteries
。L298n
。Screw divers
。Wires (solid core wires)
。platform made of plastic (where the robot is)
- SCHEME
-CODE.INO
Hi! We are three students, Pablo Arbués, pilar martínez and Mario Concellón, from Cardenal Xavierre school and we're going to explain to you how we made a light seeker robot!!
First of all the list with the materials and tools we have used:
。Arduino nano
。A breadboard
。Male-male wires
。3 wheels
。Two DC motors
。Two 4.5v batteries
。L298n
。Screw divers
。Wires (solid core wires)
。platform made of plastic (where the robot is)
- SCHEME
-CODE.INO
int enA = 6; int in1 = 9; int in2 = 8; int enB = 5;
int in3 = 7; int in4 = 10; velocities of the wheels
const int Fast = 225; DC motors going fast const int Slow =0; DC motors going slow. const int RightLightSensor = 0; declare the analog pins for the photoresistors
const int LeftLightSensor = 2; declare the analog pins for the photoresistors
int SensorLeft; intensity light (left) int SensorRight; intensity light (right) int SensorDifference; diference of light intensity between left and right (absolute value) int SensorThresh = 80; sensitivity to light intensity void setup() { pinMode(enA, OUTPUT); pinMode(enB, OUTPUT); pinMode(in1, OUTPUT); pinMode(in2, OUTPUT); pinMode(in3, OUTPUT); pinMode(in4, OUTPUT); pinMode(LeftLightSensor, INPUT); pinMode(RightLightSensor, INPUT); //Serial.begin(9600); } void loop(){ SensorLeft =analogRead(LeftLightSensor); "reading the ldr" delay(3); SensorRight =analogRead(RightLightSensor); delay(3); SensorDifference = abs(SensorLeft - SensorRight); if (SensorLeft > SensorRight && SensorDifference > SensorThresh) { //turn right turncarright(); } if (SensorLeft < SensorRight && SensorDifference > SensorThresh) { //turn left turncarleft(); } if (SensorDifference < SensorThresh+1){ //forward carforward(); } } void turncarleft(){ "moving the car left" Serial.print("turncarleft"); Serial.print("\n");*/ digitalWrite(in1, HIGH); left DC MOTOR ahead digitalWrite(in2, LOW); ditaiglWrite(in3, HIGH); right DC MOTOR ahead
digitalWrite(in4, LOW); analogWrite(enA, 0); left DC MOTOR slow analogWrite(enB, Fast); right DC MOTOR Fast delay(300); } void turncarright(){ "moving the car right"
Serial.print("turncarright"); Serial.print("\n");*/ digitalWrite(in1, HIGH); left DC MOTOR ahead digitalWrite(in2, LOW); digitalWrite(in3, HIGH); right DC MOTOR ahead digitalWrite(in4, LOW); analogWrite(enA, Fast); left DC MOTOR slow analogWrite(enB, 0); right DC MOTOR fast delay(300);
}
void carforward(){
"moving the car forward"
Serial.print("carforward"); Serial.print("\n");*/ digitalWrite(in1, HIGH); left DC MOTOR ahead digitalWrite(in2, LOW); digitalWrite(in3, HIGH); right DC MOTOR ahead digitalWrite(in4, LOW); analogWrite(enA, Fast); left DC MOTOR slow analogWrite(enB, Fast); right DC MOTOR slow delay(300); } void stopthecar(){ Serial.print("stopthecar"); Serial.print("\n"); digitalWrite(in1, LOW); digitalWrite(in2, LOW); digitalWrite(in3, LOW); digitalWrite(in4, LOW);
delay(1); }
These are photos of the final result:
These are some of the pictures we also took while making the project.
Links to similar projects: https://galideas.wordpress.com>sitio>upload
Comments and youtubr link of our project:
Our video shows that our robot has got a problem, which is that it starts to spin, instead of following the light in a straight way. This is doue to the fact that one of our motors broke while working on it, so we had to find another one, which resulted to be a little bit different than the original one, having less power, so it r9tates slower.
We have worked a lot, a lot, but we still have something to check and learn!! This has been a great project and we would like to do more and to investigate more about arduino!!
https://youtu.be/x7VTCNLOWfQ
(That is the youtube link to the video)
Comentarios
Publicar un comentario