Introduction: Color Sorting Machine Using Evive- Arduino Based Embedded Platform

About: STEMpedia is a place bringing project-making tools at one place- kits, online courses, coding platforms, controller app and tons of free learning resources.

The DIY Arduino Color Sorter project is an interesting project to introduce kids to the basics of an infrared (IR) sensor and a servo motor the DIY way. In this project, we’re going to show how to make a DIY color sorter that can sort black objects from the white ones using an IR sensor and servo motor. The IR sensor will detect the color of the object and if it is white, the servomotor will remove it from the conveyor belt.

We’re going to program our color sorter in PictoBlox - a graphical programming software based on Scratch with advanced hardware interaction abilities. You can download PictoBlox from HERE.

Ready for sortin’? Let’s get going!

Step 1: List of Components Required:


  • evive
  • Dual Shaft BO Motor
  • BO Wheel
  • Micro Servo Motor with Accessories
  • Male to Female Jumper Cable 20cm
  • Colored Cardboard
  • Colored Chart paper
  • Ice cream stick
  • Hot Glue Gun


Note: All the above electronics components can be found in evive Starter Kit. With it, we can make number of exiting projects and the Young maker's guide with the kit, just makes the concepts clearer.

Step 2: Making the Support for the Conveyor

The conveyor belt is nothing, but the black belt like the belt on the treadmill. The conveyor belt support plate house our motors and wheels and some other components which we will discuss in the latter part of the project.

Take a piece of cardboard or corrugated sheets whose length will almost the length will be equal or of the conveyor belt, this will be the support plate of our color sorting machine.

Now, we need to attach the pulley. The pulley is the mechanism that makes the conveyor move. The DC motor and the wheel will be acting-pulley in our case.

Make two holes at both the horizontal ends of the support plate of the size of the shaft of the DC Motor. (Fig 1)

Insert the DC motors into these holes and fix it using the hot glue.

Make smaller holes next to the DC motor to pass the wires coming out of the DC motors through them. (Fig 2)

Step 3: Making the Base for Our Conveyor

Now, take another piece of cardboard whose width is the same as that of our conveyer support system. This will support our Color Sorting Machine to stand still.

Fix the Support plate onto the base plate using hot glue.

Step 4: Attaching the Wheels

Before attaching the wheels, we need to add more grip to them so that they can hold the conveyer belt nicely.

Make grips on both the wheels using a hot glue gun attach them to the DC Motor shafts.

Step 5: Testing and Attaching the IR Sensor

In this project, we are going to sort only the two basic colors of life: black and white. Thus, we will simply use the IR sensor as it can do all the needfuls.

You can try sorting the other colors too with the help of the color detector too.

Before we add the IR Sensor to the project, let’s first test it to see whether it's working properly or not.

Bring out evive.

Attach the IR Sensor sensor to it by connecting:

VCC of the sensor to +5V of evive,
GND of the sensor to the GND of evive and
Signal Pin to the Digital Pin 2 of evive.

Pin State Monitor of evive helps to check the status of both analog and digital pin. If your sensor is working perfectly fine, the number corresponding to Pin 2 will change to 0 when you bring white sheet next to the sensor and 1 if it far away or it is a black paper. If the sensor is not working properly, turn the potentiometer knob on the IR Sensor using a screwdriver till it is working.

Put evive in aside, and take out the connections. Now, attach the IR Sensor to the support plate using a pair of M3 bolt and nut.

Thus, it will check whether a white object is passed in front of the IR Sensor or the black object and notify the evive.

Step 6: Attaching the Servo

The work of the color detector is done, the brain needs to take the actions i.e, collect the white objects in one box and the black in other. We want the black objects to complete the path of the conveyer belt and get collected at the end. And the white to come out of the line beforehand.

As we need to keep the white ones out of the line, we will use a micro servo to do so.

Thus, take a micro servo and attach servo head to it using a self-threading screw.

Now, on the top of the servo horn attach an ice cream stick as you to push the white objects away. Now, ice cream won’t go with our fancy color sorter machine, thus, decorate it the way you want. (FIg 1)

Once done, attach it to a small distance from the IR Sensor. (Fig 2)

As soon as the IR sensor detects the white box. The servo will change the angle thus bringing the ice cream on the conveyor belt, pushing the white box out of the belt. And coming back to its original position.

Step 7: Making the Conveyor Belt

Now, all the components are added, it’s time to bring in the conveyer belt. The conveyor belt will be used to move the box from one end of the machine to the other.

Cut the colored chart paper whose length needs to be little more than the double the width of the support plate.

Bring the two ends of the conveyor belts closer and glue them together using double-sided tape and wrap it around the pulley as shown in the above fig.

With this the assembly of the conveyor belt is complete.

All you need to do is make the connections and write the code for the same.

Step 8: Making the Connections

Make the connection of all the electronic component as given below

  • IR Sensor:
    • VCC: +5V of evive
    • GND: GND of evive
    • OUT: Digital Pin 2 of evive
  • Servo Motor:
    • VCC: +5V of evive
    • GND: GND of evive
    • Signal: Digital Pin 3 of evive.
  • DC Motors:
    • Motor1: Motor Channel 1 of evive
    • Motor2: Motor Channel 2 of evive

Step 9: Code for the Color Sorter

To make the color sorter simpler, write the following script in PictoBlox- a scratch based graphical programming platform, by dragging and dropping few blocks below each other. You can download PictoBlox from here.

Step 10: Conclusion

With this, your color sorter is all set to differentiate the black from the white!

DIY Summer Camp Contest

Participated in the
DIY Summer Camp Contest