After my first OpenCV project which dealt with object tracking, I decided to do something a little more challenging and complex, but also more fun. I went for M&M sorting. You might have already seen this idea being realized somewhere online, I know I’ve seen a ton of different examples. However, everyone seems to have a different approach to doing it, so I figured I’ll give it a shot myself.
For those of you that want to jump straight into the action or just want to watch the pretty M&Ms fly about, you can go directly to my video showing the program execution:
If you’re interested in some more details on how the sub-parts of the project function, take a look at this video explaining things a bit better:
Finally, for those of you more into reading, and those looking for the specifics let me present the fine details of the project:
– Nothing special about the loader and unloader. They are simple servo motors which are just instructed to rotate back and forth to drop the M&Ms.
– The print head of the printer (Epson C43UX) acts as a transport mechanism. It’s run by the printer’s original bipolar stepper motor (Model EM-462). The stepper itself is being controlled by an SN754410NE H-Bridge. The following image taken from the Arduino site (http://arduino.cc/en/Reference/StepperBipolarCircuit) shows how to connect and drive the stepper motor:
– NOTE: I couldn’t find too many details about this stepper motor online so I had to do most of my calculations manually by different measurements and experimentation. As it turns out, the motor (EM-462) has a coil resistance of 9.2 Ohms and a coil wire diameter of 0.28 +/- 0.02 mm. Its current rating is 1A. Using Ohm’s law we may calculate that the motor voltage rating is around 9V. Also, the stepper moves 7.5 degrees per step, so 48 steps for a complete circle. This is important to know in order to set the stepper up properly in the Arduino code. I had it setup with 50 steps in the beginning and it was skipping steps every now and then.
– The printer’s power supply has 3 wires. I cut off the middle wire, and just took the positive voltage and ground wires. The power supply gives a voltage of 36.1V between those wires. I used a 7809 voltage regulator to drop the voltage down to 9V, however, 36V is a bit of an upper limit on that regulator so it gets extremely hot. I’ll probably look into using the LM317 regulator to get the project running more stable.
– NOTE: I have a disassembly video for the Epson C43UX which I will upload as soon as possible and link it to this post so you can follow along if you want.
That’s more or less it. There are a bunch of places where I could improve on this project, like the loading mechanism which is quite flimsy in its current state. Also, I’m probably going to include a white LED to point to the M&Ms while the camera analyzes them so that I get better results regardless of lighting conditions. Additionally, I’ll do some more work on the 9V voltage regulator so that I find a good solution which won’t overheat as much as what I currently have. I’ll be sure to post updates as soon as any improvements come along.
I hope you enjoyed this little project. Feel free to post any questions or comments.