In this Instructables, we’ll build an automated color chip sorter using a meArm robot arm and a TCS3200 color sensor. This is part of my intermediate level curriculum for middle and high school students at my robotics workshop. MeArm is an excellent educational tool to teach students about mechatronics and inverse kinematics. Combining MeArm with a TCS3200 color sensor which is an economical solution for detecting color by utilizing red, green, and blue led lights to measure reflected RGB values, we could build an automated color chip sorter that teaches students about automation using a robot.
Step 1: Parts and Tools
- MeArm laser cut acrylic kit. (Picture shows wood kit. Get acrylic kit as self tapping screws don't really work on wood as well as in acrylic.)
- 4 servo motors (I used cheap TowerPro SG90 servos)
- Mini breadboard
- TCS3200 Color Sensor
- 4 x AA battery pack for independent power supply to servos
- A piece of 1x1 wood as a color sensor station
- A piece of 1x4 wood as a base for MeArm and a breadboard
- Color chips
- Color chip dispenser (you can make it with cardboard)
- Color chip bin (you can make it with cardboard)
- Dopont cables
- Usual tools such as a wire cutter, soldering iron, and glue gun were used in this project.
Step 2: MeArm Assembly
MeArm is an opensource robot arm designed by Phenoptix and you can either purchase a complete kit directly from https://www.mearm.com or buy individual components from various on-line sources. Since we’re building 10 units in the workshop, I went with latter. If you have a laser cutter, you could cut your own pieces as well.
Build instructions for MeArm v1.0 is already well-documented by Phenoptix on this Instructables so please refer to that documentation when putting together the robot arm. Additionally, I’ve made a larger base using a piece of 1x4 wood to mount both the MeArm and a mini breadboard for Nano.
Step 3: TCS3200 Color Sensor
The technical specifications for TCS3200 color sensor is found at http://www.dfrobot.com/wiki/index.php/TCS3200_Color_Sensor_(SKU:SEN0101).
The sensor module I purchased didn’t come with a circular ring to isolate LED lights from the sensing element so I made a circular ring using a Nerf bullet and glued it to the sensor module. (See photo)
Step 4: Electronics
Wire all the components according to the diagram. I’m using 4 x AA batteries as a separate power supply for servos. Nano is powered by USB.
Step 5: Code
Anyone who tried to manually set servo values in MeArm may have experienced that:
- servo motors/arm move too fast
- difficult to visualize the correct angle values for target gripper locations
Well, both problems could be remedied by a library called meArm (https://github.com/yorkhackspace/meArm). The library only requires x,y, and z coordinates of a target position and it does all the hard work of calculating correct angle values for servos. (Perfect for students. They understand Cartesian coordinates.)
You must download and install this meArm library into your Arduino library folder first.
And then, download the attached Arduino IDE code. Comments in the code should explain what’s going on in the code. It was written for Nano but it should work on other Arduino boards with no or little mods.
Step 6: Calibration
In order for the code to detect red, yellow, and green chips correctly, we have to supply the correct range of RGB values seen by the color sensor for these chips. I ran the code in DEBUG mode to see what RGB values it sees for red, yellow, and green chips and manually hardcode the range into the code until the code detects correct color 100%. You must do this each time you run the code because the sensor is very sensitive to ambient light.
Step 7: Future Improvements
Calibration and hardcoding RGB values into the code is very arduous process. I think the better way to handle this is to allow the code to learn the color. One way to achieve this learning is by having a self-calibration routine in the setup section to go through several sets of red, yellow, and green chips in prescribed manner and let it figure out the lower and upper limits of the RGB values for red, yellow, and green color chips.
amirhosein640 made it!