in this section we learn about how to make a Color sorting machine (Black and white) using Arduino and IR Sensor and also learn about how this Color sorting machine works .
making video:
HOW IT WORKS ?
This Color sorting machine works based on the IR sensor . We know this IR sensor detects the colors black and white. When a Black color object is near to this IR sensor, then servo motor passes that Black object on one side the same thing happens to the white color as well . These two colors are short by opposite to each other.
HOW TO MAKE THIS ?
follow the below process to make this project .
components
- Arduino BuyNow
- IR sensor BuyNow
- Servo BuyNow
- breadboard and Wires BuyNow
If you want to buy Arduino components, I am giving my affiliate links. If you buy the components using my affiliate links, it will help to our channel and website growth. so do these small help.
circuit diagram:
connect that all the components as shown in the below circuit diagram
then after connect that all components upload the below program to Arduino
code :
#include <Servo.h>
Servo myservo;
#define sensor 7
int sensorstate;
void setup() {
pinMode(sensor, INPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
myservo.attach(9);
myservo.write(90);
delay(1000);
}
void loop() {
myservo.write(90);
if(digitalRead(sensor) == HIGH){
myservo.write(0);
delay(500);
myservo.write(90);
delay(500);
Serial.println("WHITE");
}
else if(digitalRead(sensor) == LOW){
digitalWrite(13, HIGH);
myservo.write(180);
delay(500);
myservo.write(90);
delay(500);
Serial.println("BLACK");
digitalWrite(13, LOW);
}
delay(5000);
}
if you have any doubts regarding to this project, contact me on Instagram or comment on YouTube video. I will help my best.
0 Comments