Resistor Sorter

Introduction: Resistor Sorter

Resistor sorter is a project which separates the required resistor from a bunch of resistors. The resistor which the user needs is separated using this device. It is a boon to the people associated to electronics and IT. This project has been built using all the waste products and Arduino board(Mega).

Why I build Resistor Sorter:-

This is based on a real life problem.While working in a lab, when a person needs resistors there is mostly a huge bunch of resistors filled up in a box. Using multi-meter is:-

  • highly stress full task.
  • consumes lot of human labor.
  • Time consuming

How it works?

  • This project is build by combining many small projects. Such as: - LCD display, keypad, Servo.
  • Once the resistor is left in the funnel, when green light glows. It goes straight into the pipe.

  • A servo is present at the bottom of the funnel which blocks the path/pipe and does not let the resistor pass through. Now the resistor is stationary at one point.

  • Voltage divider has been built to calculate the value of resistor and current.

  • Once the reading is taken the servo at the bottom rotates and opens the path for the resistor to pass and fall on the decision plate.

  • If the value of resistor is within range, the decision plate will rotate clockwise.

  • Else if the resistor is not of that range the plate will rotate anti-clockwise.

Step 1: List of Materials

Name -Quantity -Specs

  • Arduino Mega 1 Standard(you can use any other board also)
  • resistor 1 100k Ohm
  • led 2 Red and Green
  • Jumper Wires 30 - 40 Male to Male
  • Bread Board 2 Standard
  • Keypad 1 (4*3)
  • LCD Display 1 (16*2)
  • Servo Motors 4 Mini Servo (180 degree)
  • A4 size sheet * 1, cardboard(as big as shoe box), piece of thermocol
  • Led strip(optional)

Step 2: Working Principle of RS

Resistor sorter is detecting the value of resistors using the Ohm's law V = I * R.

  1. We store the value of known resistor as R1. and let unknown resistor be Rd.
  2. When we supply 5v to the series circuit some amount of voltage drops at R1 and we get the left over voltage at v_out.

  3. let the voltage drop = V2.

  4. Using V = IR, we calculate I = V2 / R1.

  5. We know current remains the same in series connection.

  6. Now we again use V = IR to calculate the value of Rd, Rd = V_out / I.

Now we are ready to build the project..

Step 3: Connect All the Components

Now first gather :-

  • Keypad
  • Arduino Board
  • LCD(16*2)
  • Servo Motors
  • Jumper wires
  • led

and start make the circuit as mentioned below.

LCD(16*2)

  • Rs = A2;
  • E(enable) = A3;
  • D4 = A4;
  • D5 = A5;
  • D6 = A6;
  • D7 = A7;

Keypad

ROWS = {8, 7, 6, 5}; //connect to the row pin outs of the keypad
COLS = {4, 3, 2}; //connect to the column pin outs of the keypad

Servo motors

  • M1 = 9;
  • M2 = 10;
  • M3 = 11;
  • M4 = 12;

Leds

led1 = 52;
led2 = 53;

Step 4: Setting Up Servo Motors

The servo motors have to be connected in the order. M1; M2; M3; M4. as shown in the picture. The motors will have to be connected to an external power supply. If this is not done the project will malfunction.

While setting up the motors use the code below.

#include<Servo.h>
Servo M1;
Servo M2;
Servo M3;
Servo M4;
void setup() {
M1.attach(12);
M2.attach(11);
M3.attach(10);
M3.attach(9); }
void loop() {
M1.write(90);
M2.write(90);
M3.write(90);
M4.write(90);
delay(15); // waits for the servo to get there
}

Step 5: Coding

#include <LiquidCrystal.h>
LiquidCrystal lcd(A2, A3, A4, A5,A6, A7);

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};

byte rowPins[ROWS] = {8, 7, 6, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {4, 3, 2}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

int error;
int max_per;
int min_per;

long int num,a,b = 0,c;

long R1 = 100000; 
long Rd;

int P1 = A1;
int P2 = A0;

double I;

double  v_in1;
double  v_in2;

double v_out;

double V1;  //input volatge 1
double V2;  //input volatge 2

#include <Servo.h>

Servo M1;
Servo M2;
Servo M3;
Servo M4;

int led1 = 52;
int led2 = 53;
void setup(){
  
   Serial.begin(9600);
   lcd.begin(16, 2);

  M1.attach(9);
  M2.attach(10);  
  M3.attach(11);
  M4.attach(12);

    pinMode(P1,INPUT);
    pinMode(P2,INPUT);

    pinMode(led1,OUTPUT);
    pinMode(led2,OUTPUT);
     
   lcd.setCursor(0,0);
   lcd.print("Resistor Sorter");
   Serial.println("Resistor Sorter");
   delay(1000);
   
   lcd.clear();
   
   lcd.print("Pls give value:-");
   Serial.println("Pls set resistance..");
   delay(1000);
   
   lcd.clear();

   lcd.print("Resistance:-");
   Serial.println("Resistance:-");
   lcd.setCursor(0,1);
   while(true)
    {
      char key = keypad.getKey();
      num = key;
      
      if(num)
      {
        if (key != '#')
        {
          a = num - 48;
          b = b * 10;
          b = b + a;
          Serial.println(b);
        }
        if(key == '#')
        {
          Serial.println("ok");
          lcd.print(b);
          delay(1000);
          
          lcd.clear();
          
          lcd.print("OK");
          delay(500);
          
          lcd.clear();
          
          Serial.println(b);
          break;
        }
      }
    }
}



void loop(){
  
 // lcd.setCursor(0,0);
 // lcd.print("working...");
  
  M3.write(0);
  delay(10);
  digitalWrite(led1,HIGH);
  digitalWrite(led2,LOW);
  delay(1000);
  digitalWrite(led1,LOW);
  digitalWrite(led2,HIGH);
  
  M1.write(120);
  M2.write(160);
  delay(10);
  
  delay(1000);
  
  Serial.println("reading");
  
 v_in1 = analogRead(P1);
 V1 = v_in1 * (5.0/1023.0);
 Serial.print(V1); 
 Serial.print("v          ");

 v_in2 = analogRead(P2);
 V2 = v_in2 * (5.0/1023.0);
 Serial.print(V2); 
 Serial.print("v          ");

 v_out = V1 - V2;
 Serial.print(v_out);
 Serial.print("           ");
 
 I = v_out / R1;
 Serial.print(I,6);
 Serial.print("A          ");

 Rd = V2 / I;
 Serial.println(Rd);


      lcd.clear();
      lcd.setCursor(0,0);
      lcd.print(Rd);

  
  M1.write(70);
  M2.write(90);
  delay(10);
 
  delay(1000);
  lcd.clear();
  
    error = 0.2 * b;

    max_per = b + error;
    min_per = b - error;



    /*while(true)
    {
      Serial.print(max_per);
      Serial.print("   ");
      Serial.println(min_per);
      break;
    }*/

    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print(max_per);
    lcd.setCursor(0,1);
    lcd.print(min_per);

    if(Rd <= max_per and Rd >= min_per)
    {
      lcd.clear();
      //Serial.println(Rd);
      lcd.print("found");
      M3.write(90);
      M4.write(30);
      delay(10);
     delay(1000);
    }
   else{
      
      M3.write(80);
      M4.write(150);
      delay(10);
      
      delay(1000);
      
    }
    
    M4.write(90);
    delay(10);
}
First Time Author Contest

Participated in the
First Time Author Contest

Be the First to Share

    Recommendations

    • Rocks, Gems, and Stones Speed Challenge

      Rocks, Gems, and Stones Speed Challenge
    • Tinkercad Student Design Contest

      Tinkercad Student Design Contest
    • Organization Contest

      Organization Contest

    Comments

    0
    seamster
    seamster

    1 year ago

    Impressive project, thank you for sharing!