Week 17 | | Wildcard Week

Fab Academy 2018 | Archive


I decided to make a machine which can separate two balls of different colours. I used 2 servo motors, one servo works as a gate has colour sensor on it. Second servo works for giving direction to which the ball should fall. My three components are connected with Arduino nano.

I lasser cut the machine’s body which includes two containers for two balls separated by a wall. The body of machine I designed in such a way that it creates a slope, making easy to drop the balls in container.

On top of the body, I carved a hole from which we will put balls.

The ball will go into the hole, by the colour sensor it will detect colour and the servo will move accordingly. The main idea was to separate the colours so that I can understand it’s basic logic and take this project to a more better level.

I made the design in fusion and cutted the parts.



After making this, I laser cutted the parts, the files are in the file section below. After assembling all the parts and fixed all the electronics stuff and then it looked something like this.



I checked the code and it was working with the board For making it look more better, I spray painted it with black color. Black gave it decent look as well as helped me to calibrate and differentiate frequency values for green and red balls i had (before spraying, I used blue taps to get accuracy of color sensor)



I used black tape for more shiny look of the design. I sticked te components with glue gun and sticked black tape on it.


Code for controlling both servo, taking color sensor as input. (check files to download)
#include<Servo.h>

Servo m1,m2;

int s2 = 6;
int s3 = 7;
int outPin = 8;
int red,grn,blu;
void setup() {
  m1.attach(9);
  m2.attach(10);
  Serial.begin(9600);
  // put your setup code here, to run once:

}


void loop() {
    m1.write(0);
  m2.write(35);
  delay(5000);
  digitalWrite(s2, LOW);
    digitalWrite(s3, LOW);
    red = pulseIn(outPin, LOW); // Reading RED component of color
  
    digitalWrite(s2, HIGH);
    digitalWrite(s3, HIGH);
    grn = pulseIn(outPin, LOW); // Reading GREEN component of color

    Serial.println(red);
    Serial.println(grn);
    Serial.println("-------------");

 
 
 if (red < 40 && grn < 40 ){
      m2.write(0);
        delay(1000); 
      m1.write(180);
      delay(1000);
         
  }
  else if(red <= 70 && grn <= 70 ) {
    
     m2.write(70);
      delay(1000); 
      
      m1.write(180); 
      delay(1000);
       
    }
delay(1000);

}

Files