High speed M&M sorting machine

来源:互联网 发布:淘宝收取费用 编辑:程序博客网 时间:2024/05/17 02:16
High speed M&M sorting machine
www.reviewmylife.co.uk 2-3
M&M sorting machines are a popular project for people who like combining electronics, programming and machine building. I decided I’d try to make my own version but with a different approach to the majority of existing M&M (or Skittles / Smarties!) sorting machines out there.
Most of them send a single M&M down a chute to a simple colour sensor where the colour sensor will then take a second or two to figure out the colour. A servo motor will then rotate a chute that will direct the M&M into the correct pot.
My approach sends M&Ms down a chute to start with. But I don’t stop the M&M for colour recognition. Instead I use an iPhone to capture the colour of the M&M as it is in freefall. As it is still falling the iPhone talks to a Bluetooth module attached to an Arduino and that fires off the correct electro magnet controlled gate. This sends the M&M into the correct pot. Even though this is just a rough prototype it is reasonably fast because the colour recognition and path that the M&M takes down the chute is decided and determined whilst the M&M is moving under gravity. Here’s a video of the prototype:
mandm sorting machine front 12
mandm sorting machine front 12
I’d been thinking about making an M&M sorter for a while as a fun project so I could play around with an Arduino. But I didn’t want to stop the M&M for colour recognition or use a servo motor to direct the M&M as these approaches seemed slow to me.
It was this video of a high speed coin counting machine that got me thinking about some kind of binary gate that would deflect the M&Ms into the correct place. https://www.youtube.com/watch?v=2GGKYHf8DQo. What they’ve done is really cool and impressive – the coins zoom through a sensor faster than you can see, and are nudged down the correct path by a pop up nodule.
Starting from the top of the machine I had to figure out how to ‘release’ the M&Ms one by one.
I did attempt to make some kind of spinning ‘thing’ that would shoot M&Ms down a tube in the style of the coin sorter video I saw. It did kind of shoot them down the tube, but mostly it sent the M&Ms flying all around my living room. I still don’t know if I’ve found them all!
The problem here was making the M&Ms come out one at a time (they often came out in bunches), and the fact that they flew out at different angles and velocities – this would lead to them bouncing around which would make it hard to predict where they were going to go next.
mandm sorting machine dispense experiment 17
mandm sorting machine dispense experiment 17
I also experimented with a cylinder that the M&Ms would go into first, and then they’d fall though the holes when the holes lined up. I realised here that the amount of torque I’d need to rotate these two tubes would be too much for my motors. Plus there was still the problem of the M&Ms falling out in twos.
mandm sorting machine dispenser experiment 18
mandm sorting machine dispenser experiment 18
I had more success with trying to replicate this tried and tested design adopted by a number of other successful M&M sorters. The M&Ms are in the container and they drop into the holes as the holes become empty.
mandm sorting machine dispenser experiment
mandm sorting machine dispenser experiment
The trick to success is to ensure that the height of the hole that the M&M drops into is about the same height as the M&M. This ensures that only one M&M is in the hole at a time. And then as the M&M rotates and approaches the chute it goes under a covered area (like a bridge which touches the surface of the spinning disk) which ensures that when the M&M and the hole line up only the M&M in the hole can fall down.
mandm sorting machine dispenser 10
mandm sorting machine dispenser 10
The bridge is barely visible in the photo as it is obscured by the sides – it is right at the front and is secured into place with that screw. The piece of foam board on the left perhaps helps to encourage the M&Ms into the hole but may not be necessary. I have the dispenser angled to the back so that the M&Ms fall to the edges (I want to ensure that they all go through the sorter).
I initially bought a 6V 500RPM motor from Amazon, and a set of motor mounts to attach the motor to the spinning disk.
I tried to decrease the speed to something sensible using a set of gears that I got from Maplin. However with my crude setup there was so much juddering that it prevented the M&Ms from falling smoothly.
mandm sorting machine motor gears 3
mandm sorting machine motor gears 3
So I bought a 12V 80RPM high torque motor from eBay along with a motor speed controller which allowed me to direct drive the spinning disk. It was much smoother now, and this shows that simpler is often better.
mandm sorting machine motor 14
mandm sorting machine motor 14
I’d decide to try deflecting the M&Ms down the correct chute by using electro magnets to control quick reacting gates. Electro magnets can react very fast – much faster than the slow turning of a servo.
I first bough a very small low powered electro magnet – it was useless as it was so tiny it wouldn’t have been able to move anything. So I bought a bigger 12V 2A pull magnet from eBaay. This had pulling power (and goes back to its original position when the power is off because of the spring).
My first attempt was a simple ‘pull’ gate. Here the pulling of the magnet would close the gate.
mandm sorting machine slide gate 7
mandm sorting machine slide gate 7
I tried doing this with both the magnet on the same level as the chute (above) and also below the chute (below).
mandm sorting machine chute experiment
mandm sorting machine chute experiment
The problem was that the magnet only pulls 1cm, and taking the diagonal into account that does not fully close the chute. It worked a lot of the time, but sometimes an M&M would slip past the gate. As I couldn’t find electro magnets with a larger pull length (one with 2-3cm would have made all this much simpler!) I went for a ‘chop’ gate instead.
As the electro magnet pulls back the gate ‘chops’ downwards by means of 3 pivot points. This design turns the small amount of electro magnet movement into something much larger which can cover the entire width of the chute diagonally.
The difficulty is figuring out the exact shape and size of the moving parts. I didn’t have any scientific way of doing this – I just experimented. First using thin cereal box cardboard as shown in the image on the right. Then using rigid plastic sheet that I bought from a hobby shop. On the left is the final design I went for. These gates react extremely fast, and make quite a bang as the plastic hits the bottom of the chute.
mandm sorting machine electro magnet gates experiment
mandm sorting machine electro magnet gates experiment
I had to make 5 of them and here is what they were looking like when glued (using a glue gun) onto the foam board. I added a bit of black tape (which was loose at the bottom) to slightly muffle the sound.
mandm sorting machine side electro magnet gate
mandm sorting machine side electro magnet gate
I knew that I was going to use an Arduino to control the M&M sorter so it seemed natural to buy the Arduino compatible colour sensor that most of the other projects were using. The colour sensor is in the photo on the left and is the thing that the bright white light is coming from. What I discovered though using it was that the sensor is very slow. You have to individually sample the 4 colour sensors (red, green, blue and white) and then figure out the colour. This isn’t as easy as the sensors aren’t calibrated with each other, so you need to figure out the calibration first.
mandm sorting machine side arduino bluetooth
mandm sorting machine side arduino bluetooth
I abandoned the colour sensor as too slow (I can see why the designs that use this sensor have to stop the M&M to figure out the colour now) and decided to use an iPhone 5S camera instead. The iPhone’s camera and CPU was fast enough to film the M&M in free fall and 1) spot that there was an M&M in the field of view and 2) figure out what colour it was. The traditional cheap colour sensors available for the Arduino wouldn’t have even been able to detect that an M&M was even there as it wizzed past in freefall.
The camera is placed a bit back from the chute to give it a wider field of view. And for efficiency it is only processing the vertical strip of pixels that make up the chute. No need to process the parts of the image that the M&M will never appear in.
I bought a Bluetooth LE module for the Arduino (shown in red above) so that the iPhone could talk to the Arduino.
To make determining the colour more simple I flattened the colour palette of the video images as they came in. I made it so the software only saw the colours of the M&Ms that I was interested in seeing (so no shadows which were a big problem!) and everything else was white. It was then simply a matter of counting the number of coloured pixels, and then if the number was above a threshold sending the Bluetooth command to the Arduino.
mandm sorting machine iphone 5
mandm sorting machine iphone 5
Here you can see the Bluetooth board plugged into the Arduino and wired up to the relay. Wires are then heading out of the relay to the electro magnets.
mandm sorting machine back arduino 13
mandm sorting machine back arduino 13
Once the three key problems of the 1) M&M dispenser, 2) electro magnet gates and the 3) colour recognition were solved it is just a matter of putting it all together. This involved a lot of foam board and glue from a hot glue gun.
I used a sharp hobby knife to cut the foam board, and bought a cutting compass so that I could cut neat circles for the dispenser.
As I started testing various bits together I did find a few problems.
Here’s a side view of the assembled prototype.
mandm sorting machine side 15
mandm sorting machine side 15
And here is the front view. It differs slightly from the version in the video as I extended the M&M ‘pots’ at the bottom to store more M&Ms and I added a button to turn the motor on/off at the top as well as a speed dial for the motor.
mandm sorting machine front 12
mandm sorting machine front 12
I have a small compilation of video snippets of earlier M&M sorting experiments on YouTube.
I think there is a lot of potential for improving on this design. I think with some improvements the speed and accuracy of the M&M sorting could be better.
Currently the gates are in a line – this causes slight timing issues – there is less time between the camera recognising the M&M colour and the first gate needing to fire than the last gate needing to fire. NES4_Life came up with the suggestion of having all the chutes arranged in circle (like a flower) and then have the chutes move into the centre at the correct time. This would mean a fairly constant time between colour recognition and firing the electro magnet which could simplify things, especially if the speeds get higher. I did a quick test of the concept (below) and I think it has potential but I haven’t figured out exactly how to do it.
mandm sorting machine flower gate experiment 24
mandm sorting machine flower gate experiment 24
Here a partial list of what I bought – I’ll try to add more if I remember!
Bought and used on final prototype
Bought but not used on the final prototype
Here’s a list of other M&M sorting projects that I’m aware of (in alphabetical order). It is definitely worth looking at all of them to get inspiration for your own.
Lego Mindstorms M&M Sorting Machine Lego Mindstorms NXT – The M&M Dispencer m&m’s sorter m&m sorter #3, take two M&M sorter M&M Sorter (da Vinci’s Workshop) Skittles Sorting Machine 3 Sorting Machine – Skittles and M&M’
And there’s even more if you search on YouTube!
If you like this post please consider linking to it using this code:
<a href="http://www.reviewmylife.co.uk/blog/2014/12/22/high-speed-mandm-sorting-machine/" >High speed M&M sorting machine</a>
If you like this post please consider linking to it using this code:
原创粉丝点击