Hello, I am in a project that I must deliver in 4 days. The project consists of a conveyor belt driven by a motor that stops when an infrared sensor detects the object. A robot arm then picks up the target and sets it aside. The problem I have is that I don't know how to tell the motor to stop when an object is detected. The other problem is that my infrared sensor doesn't stop detecting (and no, it doesn't get sunlight). I would also like to know if the project can be done only with a geared motor, an infrared sensor, the arduino and the servo motors. I would be very grateful if someone could help me because the project is too important. Thank you
I think you left out the conveyor belt part. What part does your motor play in the conveyor belt operation?
Does you program work to tell the motor to start and to stop?
To get any help at all you need to provide a lot more information. Begin with a block diagram showing all the parts and how they are wired together, Including power for the motor and for the Arduino.
Then show us the code you used to test the IR sensor. Also show us the code you used to test the motor. Have you combined all the logic into a single program? If so, show that as well.
Good luck.
Show us what you have done so far.
What are your skills in this ?
Show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.
In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.
Use the </> icon from the ‘reply menu’ to attach the copied sketch.
Thank you very much for your reply.
Right away I'll show you the model and the real wiring (I think there are many things missing but that's what I know, I hope you can help me :))
How the hell did you put your hand up for this project - with only four days to deliver ?
I’ve been doing this stuff for years, and even if I had all the parts in hand, a really basic prototype without any frills would take all those four days.
I suspect there’s more to your problem than stated.
Hello,
I appreciate your response, and yes, I have gotten into a very difficult project. I have the robot arm available with all the servos connected and ready to be programmed and the conveyor belt is already done but I don't know where to start programming. Now I show my initial circuit so you can see if you can help me.
Oh my! I was hoping that the ask was to stop the conveyor for an existing robot arm to pick the part. If you have to program the arm too, you are in trouble.
How wide is your conveyor belt? If it's wider than whatever you need the arm to grab, you'll need something to tell you how far across the belt the part is. Orientation may matter too, complicating matters further.
I already did a test programming the robot arm and got it to pick up an object and put it down somewhere else. The problem is in the conveyor belt. How I tell the motor to stop when the IR sensor detects the object. Then start the code of the robot arm. Thanks for your answer!
The code I used to test the IR sensor is this one:
int sensor = 2;
int valor = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode (sensor, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
valor = digitalRead(sensor);
if (valor == HIGH); {
Serial.println("detectado");
}
}
This is a problem: if (valor == HIGH);
You need to remove that semicolon otherwise it will always print that it detected an object.
Debo eliminar el punto y coma que va despues de HIGH) ?
Yes
The sensor still has the same problem. It looks like I mismodified the code. show it again?
int sensor = 2;
int valor = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode (sensor, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
valor = digitalRead(sensor);
if (valor == HIGH) {
Serial.println("detectado");
}
}
What IR sensor are you using?
This zum bloqs IR sensor
Code looks correct. Not sure why it doesn't detect.
Don’t know if the sensor is open drain/collector use:
pinMode (sensor, INPUT_PULLUP);
I have changed the code and now the sensor detects an object without having one in front of it
By the way, did you see the photo of the connections?