Automatic sorting machine – Mechatronics Student Project

This machine was created as a student project for the subject Construction & CAD, at the Mechanical Engineering faculty in Skopje, by a team of five students.
It is a machine that is sorting two types of plates. One of the plates have holes and the other ones don’t have. Our task was to develop a machine that will sort out these plates automatically. We have came out with this solution, which actually won the first place out of 25 other machines.

How It Works


This is how the Automatic Sorting Machine works:

  • The plates are fed into the machine by hand.
  • The roller aligns the plates to fall in the plate magazine one by one.
  • When the plate reach the bottom of the sorter, it triggers a micro switch.
  • When the switch is on, the LED turns ON.
  • If the plate has a hole the Photocell will receive more light and the motor will rotate to one side.
  • If the plate doesn’t have a hole the Photocell will receive less light and the motor will rotate to the other side.

Circuit Schematic


 

The machine uses PIC16F628A micro-controller and it is programmed using MikroElektronika.

Source Code


/********************************************************************************/
/* Mechatronic Design Team */
/* Proekt po Konstruiranje i CAD */
/* "Dizajn i razvoj na nov ured za razdeluvanje na dva tipa plocki" */
/* */
/* */
/* */
/* Mikrokontroler: PIC16F628A */
/* Oscilator: Interen na 4MHz */
/* */
/* Dekemvri, 2012, Skopje */
/********************************************************************************/
void left () {

RB2_bit = 1; //motorot pocnuva da se dvizi na levo
delay_ms (500); // motorot se dvizi do krajna leva polozba
delay_ms (500);
delay_ms (500);
delay_ms (500);
PORTB = 0x00; //koga ke stigne do krajnata leva polozba se gasi
delay_ms (200); //vreme za kocenje na motorot
RB3_bit = 1; //se aktivira relejot za promena na nasokata
delay_ms (20);
RB2_bit = 1; //motorot pocnuva da se dvizi desno
delay_ms (500); //sredna pozicija na motorot
delay_ms (500);
delay_ms (500);
delay_ms (500);
PORTB = 0x00; //motorot se gasi koga ke dojde do sredina
delay_ms (150); //vreme za kocenje na motorot
}

//////////////////////////////////////////////////////////////////////////////

void right () {
RB3_bit = 1; //Se uklucuva relejot za promena na nasoka na motorot
delay_ms (30);
RB2_bit = 1; //motorot pocnuva da se dvizi desno
delay_ms (500);
delay_ms (500);
delay_ms (500);
delay_ms (500); //motorot se dvizi do krajna desna polozba
PORTB = 0x00; //koga ke stigne do krajna desna polozba se gasi
delay_ms (200); //vreme za kocenje na motorot
RB2_bit = 1; //motorot pocnuva da se dvizi levo
delay_ms (500); //sredna pozicija na motorot
delay_ms (500);
delay_ms (500);
delay_ms (500); //sredna pozicija na motorot
PORTB = 0x00; //motorot se gasi koga ke dojde do sredina
delay_ms (150); //vreme za kocenje na motorot
}

//////////////////////////////////////////////////////////////////////////////

void main() { //pocetok na glavna programa
TRISB = 0x00; //PORTB Izlezi
TRISA = 0xff; //PORTA Vlezovi
CMCON = 0x07; //gasenje na komparatori
do {
delay_ms (50);
PORTB = 0x00;
if (PORTA.b0==1) { //dali ima kocka?
delay_ms (100);
if (PORTA.b1==0) { //dali ima otvor?
left (); } //ako ima otvor dvizi se levo
else (right ()); }} //ako nema dvizi se desno
while (1); }Code language: Arduino (arduino)

3 thoughts on “Automatic sorting machine – Mechatronics Student Project”

Leave a Comment