mk93
Posts: 1
Joined: Sat May 28, 2016 4:39 am

First time poster! Multiple questions

Sat May 28, 2016 5:31 am

Hello Pi community!

This is my first time posting, and I appreciate you for reading it. Currently I have a project in mind, and I am not sure how to complete it. My girlfriend really enjoys making pictures with perler beads(http://tinyurl.com/jazou6o).

There are two ways she can buy the beads, one way she can buy them is little packets of single color of 1,000 beads, which cost about $3, or 11,000 mixed-colored beads for $15. She buys them in bulk, and in the small packets depending on the project she is working on. Currently with the mixed-colored box of 11k, she takes a toothpick or her fingers and sorts the beads depending on what color she needs, and this is extremely time consuming. The beads are extremely small and are not easy to grasp, and she has to move the box around to sort through what is basically sand.

What I want to do is create a machine that can sort the beads using a simple camera that will determine the color of the beads(through capturing a picture/or a video stream which captures stills) and then control some kind of arm that will then direct the bead into the correct bin.

I currently own a raspberry pi 2 model B. I am looking for tips/suggestions/leads as to where I should start poking to find out how I can create something like this. I really appreciate any tips I can find, thank you so much! :D

epoch1970
Posts: 3877
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: First time poster! Multiple questions

Sat May 28, 2016 10:10 am

My math skills are very poor and I am afraid I am beyond the age I can remedy to that really. But what comes to my mind is that instead of trying to replicate what your GF can do, you could have the machine do a simpler task, repeatedly. Like, 'brightest color on the left, others on the right'.
Or perhaps the beads have a physical characteristic other than color that sets them apart, such as weight. So you wouldn't need a robotic arm, but a simpler device like a fan would suffice...
How many colors are there?

I'm subscribing to this thread :)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
joan
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: First time poster! Multiple questions

Sat May 28, 2016 10:16 am

It depends on the size of the bead. There are youtube videos (perler bead sorter).

What size beads?

User avatar
Dis93
Posts: 132
Joined: Thu Apr 07, 2016 8:30 pm
Location: Wuthering, Yorkshire

Re: First time poster! Multiple questions

Sat May 28, 2016 10:19 am

Try searching for M&M or Skittles sorting machine videos too.

curious4872
Posts: 73
Joined: Sun Nov 29, 2015 3:33 am

Re: First time poster! Multiple questions

Sat May 28, 2016 11:02 am

Hi Mk,

I'm not an expert but I would not personally do this project, because the requirements are so difficult - I have little real-world experience with robots so perhaps other people can chime in, but it seems that this is the level of difficulty of producing a piece of factory equipment that scans an assembly line and rejects pieces that don't qualify: i.e. it doesn't seem easy at all.

That said, here's how I would attempt to rig up this rube-goldberg machine. First I would get a kitchen funnel, and attach a tapered cap to it but with one tiny little hole that only one of the pieces can fall through so that you get a steady stream of perler beads.

Then you've achieved separation - now you need to do identification and sorting. Since there's a whole stream of these things you would need to process at a very-high framerate. Being close to the hardware would be better, so this actually sounds like it's a better match for an arduino project. With an Arduino you could do pixel-by-pixel scanning directly from a camera. I think the beads would still be falling too quickly, so I would next investigate whether I could put the whole thing on some sort of incline so that it slows down. Actually, forget the funnel, build an inclined tray like this:
http://www.rockler.com/easy-sorter-funnel-tray

Okay, at this point you have beads hopefully slowed down. Next, for identification, you could read pixels directly from a camera, such as this one http://www.arducam.com/camera-modules/5mp-ov5642/ which can do 120 frames per second. Under a bright light, you would identify pixels from an arduino using arduino software. Next you would need to bin these somehow. You need some kind of mechanical way to separate them. I think factory lines do it via puffs of air ("air sorting"). Your beads are too small to the skittle sorting thing like this - https://www.youtube.com/watch?v=lFkFKcE9Zek - another example that's too large for you: https://www.youtube.com/watch?v=Bk48Wux2XcA -- I think that's a no-go.

I don't know how people make puffs of air with an arduino, I'd investigate that. Google how people do that. You might be able to get a speaker to do it, since they turn electrical signals into movement of air anyway and they're cheap - http://forum.arduino.cc/index.php?topic=197123.5;wap2 is something to investigate. for sure you could mechanically get some kind of action similar to this - https://www.youtube.com/watch?v=TV7jOEWVQHU

In total you have:

- Separation into stream of individual beads

- Identification

- Sorting decision

- Physical movement into bins

I would grade the difficulty of this project as a 10/10 for a learner. I wouldn't do it.

If you want to do all this on the raspberry pi then you would want to use something like this viewtopic.php?f=32&t=74097 - as you can see the latencies are very, very high - you would want to slow your stream of beads down considerably, to just a few per second, because the recognition is too slow.

This project isn't a great match for doing on a raspberry pi in my opinion, and the mechanical aspects are the most challenging. It would be considered an expert project.

pksato
Posts: 295
Joined: Fri Aug 03, 2012 5:25 pm
Location: Brazil

Re: First time poster! Multiple questions

Sat May 28, 2016 12:08 pm

Hi,
A color sensor (search on ebay,TCS3200) can be used to detect the beads color. More easy to use that a camera, no need to lean computer vision (openCV).
Or nor so easy, TCS3200 convert color (light) intensity to frequency, and RPi is not good to measure frequency with precision. Arduinos can do a better job.

But, the main problem is the mechanical device.
A funnel to select one bead at time;
A conveyor belt, to move bead (drive by step motor);
A window for detector (camera or sensor, only one);
Actuators to scrap bead to a collector (one by color);

Heater
Posts: 13916
Joined: Tue Jul 17, 2012 3:02 pm

Re: First time poster! Multiple questions

Sat May 28, 2016 12:54 pm

I think this is a great project for a Pi. And not at all hard.

1) Separation into stream of individual beads

Make a long thin ramp out wood or plastic or aluminium U section. Have it inclined at shallow angle such that
beads don't just slide down it.

Arrange for it to be vibrated, perhaps with a vibrator motor out of an old mobile phone.

Now, a pile of beads placed at one end will start to separate out and migrate down the ramp, at some point you will have them going by almost one by one.

The thing about this set up is you can adjust the speed by increasing/deceasing the vibration. Get it down to some rate the Pi can handle reliably, which will be pretty quick anyway,

2) Identification

I'm sure a colour sensor as suggested above can do this. For example: https://www.parallax.com/product/28302

3) Sorting decision

A few lines of your favourite language to read the sensor, determine the colour and decide to hit the actuator or not.

4) Physical movement into bins

I'd start by detecting only one colour. When you see it you want to divert the bead off the ramp.

A little air blast would do it but sounds a bit complicated to me. How about the hairy end of a little paint brush hacked off and
attached to a servo. Sweep them off! A servo is easy to drive from the Pi, it' just a PWM signal and you have no electronics to build.

There we go. Job done in an afternoon !

Now this set up is only selecting one colour at a time and multiple runs with a different colour decision would have to be made.
That's OK for a prototype. If it works well then one could add further sensors along the length of the ramp.

The accuracy may not be 100% but again running them through again will remove more and more of the wrong colour, Or
perhaps having 10% of the wrong colour in your sorted buckets is good enough.

Sounds like a fun project.
Memory in C++ is a leaky abstraction .

PiGraham
Posts: 3671
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: First time poster! Multiple questions

Sat May 28, 2016 1:29 pm

This Skittles sorter is really nice.
https://www.youtube.com/watch?v=H7HTQai7Wwg

I think using an RGB colour sensor is a good option. Something with a digital interface like this
https://www.adafruit.com/product/1334

The tricky bit is to feed the beads and present them to the sensor and sorting mechanism without jams. Escapement mechanisms are common. A pocket holds one bead and that keeps other beads out. Move the pocket, past a sensor then a chute and then the empty pocket will admit one bead for the next cycle

curious4872
Posts: 73
Joined: Sun Nov 29, 2015 3:33 am

Re: First time poster! Multiple questions

Sat May 28, 2016 1:47 pm

Heater wrote:Sounds like a fun project.
The poster did not list any technical experience with any technology, nor suggested any mechanical or optical approach, so while it may be an afternoon for someone who is an expert in all of the technologies, for a beginner I would say it will take a few weeks. It's tricky and requires expertise in multiple areas (mechanical separation, optical recognition) that have nothing to do with each other. The poster did not mention access to any technology other than a raspberry pi. It might be a few weeks before they even receive all the parts they would use.

By the way, with your setup, if there is recognition of colors, then mechanical ability to separate one color at a time is sufficient, because you can simply repeat the whole set up. Mixed -> Red, meaning the servo will separate out only reds, then change the code and change the separated-bin from the red one to a green one, and repeat mixed->green, separating out all the greens, and so forth. Likewise both false positives and false negatives are okay: suppose that when separating the reds from the mixed, 20% of the reds are not identified (stay in the mix, false negative) and 10% are mistaken decisions or the servo activates the wrong piece (a different color makes it into the red.) He can simply run through the mixed bag multiple times, so that he gets all the reds.

He could then modify the code for a "Quality assurance" mode that goes through the Red mix as input and rejects anything that isn't red.

Please note that this is factory-like level of automation, and in every way an extremely difficult project.

Assuming that the machine takes 10 seconds to separate a bead through the vibration setup, the machine would take 30 hours per color (per run) to go through the poster's mentioned bag of 11,000. (Obviously on the first run, there will be fewer beads in subsequent runs if colors are repeated). So it's very slow. if we reduce 10 seconds to 1 second, it will take 3 hours to go through a bag of 11,000 beads.

I think the fact that one bag of beads has 11,000 inside was missed when suggesting servo action. It's one of the main reasons that I mentioned puffs of air. That's just a huge number of beads.
Heater wrote:There we go. Job done in an afternoon !
An afternoon if you're 'buying", a month if you're "selling" :-D. I defy you to build this by tomorrow :-D

By the way I wonder whether it would be possible to attract the things with static electricity, since they're plastic, and somehow attract them to one of several bins located around the stream. Does anyone know:

-> Is there a circuit that can quickly create or discharge a static electricity field?

-> Could this be powered by PWM?

-> Would it be sufficient, and safe, for sorting plastic beads?

-> Will it be safe and not shock anyone :-D

This is just a blue-sky idea but I'm curious. Certainly easier than building a puff-of-air generator. It would be nice to be able to sort a stream of plastic beads just as they fall. Any physicists/electrical engineers in the house? :-D



Though I would again emphasize that this is an extremely difficult project.

User avatar
joan
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: First time poster! Multiple questions

Sat May 28, 2016 2:03 pm

Yes, and so much depends on the size of the beads.

I doubt it will be cost effective, you could probably buy several lifetimes supply of the sorted beads for the code of sorting small beads.

Buy one of these: http://www.buhlergroup.com/global/en/pr ... 0mpSbOH6Rt

epoch1970
Posts: 3877
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: First time poster! Multiple questions

Sat May 28, 2016 2:23 pm

curious4872 wrote:Assuming that the machine takes 10 seconds to separate a bead through the vibration setup, the machine would take 30 hours per color (per run) to go through the poster's mentioned bag of 11,000.
For my part I fail to see why accuracy or speed are so important. In the end the OP is not selling bags of sorted beads, he just needs to churn enough for creating pictures, one at a time.
So even if sorting 1.000 beads to end up with 100 of each color was to take something like 2 days (he won't be attending the machine 24/24...), why not?
By the way I wonder whether it would be possible to attract the things with static electricity, since they're plastic
Intriguing idea!
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

PiGraham
Posts: 3671
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: First time poster! Multiple questions

Sat May 28, 2016 7:02 pm

joan wrote:Yes, and so much depends on the size of the beads.

I doubt it will be cost effective, you could probably buy several lifetimes supply of the sorted beads for the code of sorting small beads.

Buy one of these: http://www.buhlergroup.com/global/en/pr ... 0mpSbOH6Rt

This is an important point. Balance the cost of the sorted against the cost saving of buying unsorted vs sorted beads.
Balance the time it will take to build (and maintain) a sorter vs the time it takes sorting manually.

Still, its a good learning experience for someone who is handy with tools.

PiGraham
Posts: 3671
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: First time poster! Multiple questions

Sat May 28, 2016 7:04 pm

Static electricity is probably the enemy, more likely to make beads stick than control them.

Heater
Posts: 13916
Joined: Tue Jul 17, 2012 3:02 pm

Re: First time poster! Multiple questions

Sat May 28, 2016 7:34 pm

curious4872,
An afternoon if you're 'buying", a month if you're "selling" :-D. I defy you to build this by tomorrow :-D
I love it. You are right, I am wildly optimistic.

It would take me a month to gather together all the parts and materials required, and find a work space to do it in.

Economically it makes does not seem to make much sense. But it sounds ike a fun project, a challenge, that won't cost so much.

Speed should not be a worry. I think four per second should be easily doable, 14400 per hour.

Trying to get static electricity to behave is a asking for trouble.
Memory in C++ is a leaky abstraction .

User avatar
joan
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: First time poster! Multiple questions

Sat May 28, 2016 7:46 pm

It would probably be cheaper to buy a hundred thousand white beads and then dye them in colour batches.

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: First time poster! Multiple questions

Sat May 28, 2016 8:20 pm

joan wrote:It would probably be cheaper to buy a hundred thousand white beads and then dye them in colour batches.
That is thinking out of the bead box (I love it!)... or, how about just DIY making a bead machine that produces the beads she needs (all the same) on a wire ring...

My daughter not only wants to sort them, she wants to have them automatically strung on a very thin wire in batches of 150, all the same, without having to do it by hand !

I'm watching this thread with intense interest...
marcus
:ugeek:

Ian B
Posts: 8
Joined: Sat Feb 20, 2016 11:43 am
Location: Ayrshire, Scotland

Re: First time poster! Multiple questions

Sat May 28, 2016 9:48 pm

Sounds like a great, fun project. Who cares about the economics versus pre-sorted bags, the price point of the Pi is that icheap you experiment without fear, and when the project is challenging and has a practical use you are guaranteed even more fun

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: First time poster! Multiple questions

Sat May 28, 2016 10:01 pm

joan wrote:It would probably be cheaper to buy a hundred thousand white beads and then dye them in colour batches.
Since they are obviously made by each colour, the fact that they are sold mixed requires that they be mixed by the manufacturer. The solution seems to be, don't do that. Of course perhaps these are the sweepings from Bob the Klutz who keeps tripping and dropping trays full of the things all over the shop floor.

curious4872
Posts: 73
Joined: Sun Nov 29, 2015 3:33 am

Re: First time poster! Multiple questions

Sun May 29, 2016 1:14 am

MarkHaysHarris777 wrote:
joan wrote:It would probably be cheaper to buy a hundred thousand white beads and then dye them in colour batches.
That is thinking out of the bead box (I love it!)... or, how about just DIY making a bead machine that produces the beads she needs (all the same) on a wire ring...

My daughter not only wants to sort them, she wants to have them automatically strung on a very thin wire in batches of 150, all the same, without having to do it by hand !

I'm watching this thread with intense interest...
I thought this thread was just a curiosity, but I guess it's a real problem. To be honest I even thought that the OP's story about the girlfriend needing to sort plastic might be a "cock-and-bull" story, and they really wanted some exactly analogous function, hence my talk about how hard it is to do at scale. The reason I thought it might just be an invention is exactly what stderr just said:
stderr wrote:Since they are obviously made by each colour, the fact that they are sold mixed requires that they be mixed by the manufacturer.
so that I thought it's obvious that if the time was put into research, the OP could simply find bags by color, sold closer to manufacturing cost. It also seemed likely that since there was so much extra work put into separating the mixed bag, it might be a form of price discrimination by one particular manufacturer: if you have don't want to spend the time to separate them by hand, you pay a higher cost. But since these aren't patented or anything, that would only apply to one or a few manufacturers - some smaller manufacturer is obviously selling them color by color and closer to cost - it's just a matter of finding them.

Finally even if it is just a perler bead sorter, it could be fun even if there were some other source that it was available from. However, I think the project is too hard to be fun for a complete beginner.

Anyway with the additional information that others have this problem too, I'll continue my thinking. So, I agree with other posters that electrostatic is a complete no-go. However, I was thinking of how it would be nice not to have to build a puff of air - if the things were magnetic (ferromagnetic, attracted by magnets) you could just build an electromagnet to divert them. That is a very simple circuit: http://www.instructables.com/id/How-to- ... n-Arduino/ no servo required, literally just a metal nail and some wire. Too bad there's no way to make the beads temporarily ferrous.

However, since perler beads are SO light, I would emphasize that to eject them into a bin, a paper clip with a post-it on it is enough - your electromagnet just has to attract a paper clip.

So the set-up is actually really workable:

-> Inclined plane "funnel" tray, perhaps with a vibration motor attached to it per above suggestion. The result should be a slow stream of perler beads

-> camera over a specific spot of where the beads fall.

-> An electromagnet as built above pulls a paperclip with a post-it on it and secured to return once the electromagnet is off, in order to push perler beads into a separate bin.

As for the new idea of stringing them into strings of 150...well no ideas there :-D

epoch1970
Posts: 3877
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: First time poster! Multiple questions

Sun May 29, 2016 1:32 am

curious4872 wrote:As for the new idea of stringing them into strings of 150...well no ideas there :-D
What if the bin is itself a funnel, with a narrow tube long enough to hold 150 beads in vertical position? When the tube is filled, pass a piece of string in the center, lock both ends and open the tube.
Manual operation I guess...
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

klricks
Posts: 6622
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: First time poster! Multiple questions

Sun May 29, 2016 1:59 am

The intended use of the perler beads is to place them on a 'peg board' like material forming a design or picture. Then a hot iron is pressed down to melt or fuse the beads into one solid piece.
So after the sorter machine is built we need to make a pick -n- place machine...... Then a wave flow machine or hot iron press.......
FYI - The beads come in 3 sizes: 2.5mm, 5mm, and 10mm. (dia = height).
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

User avatar
Cancelor
Posts: 757
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: First time poster! Multiple questions

Sun May 29, 2016 6:05 am

first get all parts in a row :) www.youtube.com/watch?v=DGtNS2O1EnA
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

Heater
Posts: 13916
Joined: Tue Jul 17, 2012 3:02 pm

Re: First time poster! Multiple questions

Sun May 29, 2016 7:13 am

Excellent.

That's a few more parts than I had in mind !
Memory in C++ is a leaky abstraction .

PiGraham
Posts: 3671
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: First time poster! Multiple questions

Sun May 29, 2016 7:35 am

Sorting by colour seems like a very reasonable task, not much more difficult than M&Ms sorting. It can be done with a simple RGB sensor. A basic Arduino can do it, so a Pi is up to the task. It doesn't require complex programming, just read a colour value , compare it to a set of target colour values and move a servo. The complexity is in the mechanical handling.

SOrting by orientation to string the beads is much, much harder, both in the sensing and the handling.

These are beads:

Image

They are approximately as long as they are wide and have sharp 'corners' between flat faces and round sides. Unlike M&Ms they are not smooth and may catch. Ideally spherical objects are easiest to feed because they roll over one another. The equal width to height means the beads will fit a pocket hole equally well in any orientation. That doesn't matter for colour, but it's crucial for stringing. It will be difficult to rotate a bead to align it.

https://www.youtube.com/watch?v=YRt-_E1jE8k

Potentially a (full) weekend project.
Last edited by PiGraham on Sun May 29, 2016 9:16 am, edited 1 time in total.

User avatar
Cancelor
Posts: 757
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: First time poster! Multiple questions

Sun May 29, 2016 9:08 am

Spot on video, but servos are so slow. If a solenoid could be used to 'fire' them in the right direction it could be so much faster.

I feel a whole new competition coming out of this. :P
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

Return to “General discussion”