In this project we are going to make an automated sorting system that uses colour coding to sort a product, helping in managing a warehouse.
Due to the increasing demand for goods, automation is nowadays required in industries and warehouses for efficient production and management of products. It is much beneficial in terms of saving time and money, as sorting/managing products manually consume a lot of effort and working hours. This task becomes even more complicated when we need to handle a large number of different products.
Additionally, the widespread use of online shopping has made warehouse management a critical factor in timely delivering products.
So, today we are going to make an automated sorting system that uses colour coding to sort a product, helping in managing a warehouse. Here we will be using a colour sensor that will detect the colour code of a particular product. So let’s start the project by collecting the following components.
Bill Of Materials
Coding
In the Arduino IDE, install the required library by going to Sketch → Library Manager and enter Arduino_APDS9960 and Servo in the search box.
Now, include the Servo and Arduino_APDS9960 libraries in the code.
Then we will create the setup function and set the baud rate = 9600 for serial communication. Next, we will set the servo pin number. You can use any PWM pin of the Arduino board for servo motor. Here I have selected pin number 9.
After that, create a loop function for retrieving the sensor RGB value of the object colour. Next, we will create an if() function to compare the r (red), g (green) and b (blue) values.
We will now check the colour of an object that has the maximum value among the rgb spectrum. For example, if the object colour is red, then the greatest value amongst the rgb spectrum is ‘r’. This way the colour of an object can be determined. Then the servo motor function can move the servo motor to a particular angle.
After uploading the code to Arduino, connect the components as shown in the circuit diagram.
Connection
Testing
Now power the Arduino and the servo with a 5V battery. Also, make sure to place the colour coded product near the sensor. If the object colour code is red, then the servo motor will be moved to a particle position for sorting as set in the code.