Open source coffee sorter project

I was thinking of using something that’s got a TPU on it. Might be cheaper to use a $150 board with a TPU designed to run models on the edge than it would be to use a Pi ( or similar ) and run it on the ARM.

1 Like

Ah, I see where you’re going with this. Amazing hardware find! It seems a lot has moved since I last looked into this area in early 2018.

The other hardware challenge in your proposal would be about how to integrate a compressed air system for bean ejection into a low-cost sorter. It seems you’re targeting a higher-performance, higher-priced machine. (1500 USD maybe? Do you have a goal for the price?) For that it could work with compressed air. Linear actuators like in the skittle sorter you mentioned would probably be cheaper. But since they are mechanical moving parts, long-term reliability is a bit of an unknown …

Hi, Toshota-san,

This is Wen. I am a coffee roaster in California. Looking for a small scale bean sorter.

Your bean sorter is lovely. Wondering how many pounds of beans can it process per hour? Any product spec can you share? When do you plan to take it to the market?

Regards,
Wen

Hi, Matthias,

Thanks for starting this project! Much needed!

While my heart goes to the smaller coffee farm owners and farmers, as a small boutique coffee roaster myself, I have endured enough pain of sorting green and roasted beans by hands. Like to address this asap. I am looking at two options: 1. to buy a commercial small scale bean sorter; 2. to participate the open source community to help to build a production quality bean sorter.

If you know of any commercial small scale bean sorters, which are GTM to close to GTM, please point it my way. I would much appreciate it.

On the other hand, in previous life, I was a software developer of embedded storage systems and ran product development before. I can help on UI development, script, driver, Linux, good at C/C++/Python/Java, some knowledge about iOS app as well … I also have a 3D printer, Nvidia boards and chips, and access to deep learning expertise. Let me know if any specific area that the community could utilize my skills and speed up the project development. Thank you!

Regards,
Wen

1 Like

Hello Wen, thank you for joining our little coffee sorter community here :slight_smile:

I feel with you about the pain of manual sorting. Didn’t do too much of it before deciding I want a machine, but had found myself in the middle of manual sorting when our first batch of coffee imported from Nepal arrived in parchment shell (and obviously unsorted) due to miscommunication. So, blue skin is Nepali English for silver skin, and white skin is parchment shell. Now I know :smile:

Then: you’re sorting roasted beans? I can imagine that makes good sense as it’s quite easy to tell unripe beans apart after roasting. I have never heard of doing that job with optical sorters so far … would be a novel thing, and certainly good for the flavor …

Unfortunately I have no machine to recommend from personal experience yet. There are several Chinese machines selling for 12 - 15 kUSD, very similar to the one introduced to us here by @smallcolorsorter above. I believe that’s the minimum possible price right now. If you can find one of recommendable quality, maybe you could band together with other artisanal roasters in your area and get one machine together? In that case, you could mount it to a trailer to allow simple sharing between 4-10 locations. We have done something similar with a 1960s shop roaster we restored and mounted into an old firefighter equipment trailer:

For that, definitely talk to @oojoshua from Hawaii, who is determined to make the open source coffee sorter a reality and, like you, is well-versed in software engineering, has a makerspace etc… I am tempted to propose you join forces and finish this project. Sadly I can’t invest much time personally until end of August this year due to too many full-time jobs. But I’ll support you the way I can: tech feedback, making connections, some design work maybe.

1 Like

Hi, Matthias,

Thanks for the feedbacks! I will reach out to @oojoshua.

Sharing a sorter sounds like a interesting idea. Never thought about that. And it’s interesting to know the blue skin and white skin difference in Nepal :smile:

-Wen

1 Like

Hi , @wyang san
Thank you for your comment.
The machine on youtube can process only one pound per hour. The future target is up to 20 pounds per hour. How many pounds/h do you need ? I am struggling to reach the target such as mechanism and algorithm. I will share the progress on youtube and at next Maker fair Tokyo.

2 Likes

nice project. although I can’t participate in the tech part of it, I can share my marker drawing of manual coffee grinder coffee%20mill-small

3 Likes

Hi everyone,

I’m new here and got here by coincidence after many hours of searching for small scale colour sorters…
Let me introduce myself, I’m Dennis Waterman and my wife and I run a small coffee roasting business in The Netherlands. We import our green coffee directly from the farmers (most of them we know personally, some if them we so far only had contact with by email and telephone), mostly from Ecuador and Mexico and also some small amounts from Costa Rica and Nicaragua.

Our main time consuming activity is … cleaning coffee. Both before and after roasting. We deal with a lot of natural coffees and beans can have any color shade from light green to dark green cinnamon and chocolate brown which is all fine. The ones we don’t want are the ones that are grey or blueish grey, broken beans and beans with black spots. And I can tell you, especially in the Ecuadorian coffees there are a lot of those… From some of the coffees we actually take 10-15% of the beans out as being defects (in our view). We recently started having them cleaned in Ecuador, but though it helps their standard of cleaning is not ours and we still have to manually clean and get rid off about 3-5% of the beans.
Now there are a lot of defects one can spot in green coffee, but beans from unripe berries is difficult. In a washed coffee it’s clearer as they have lighter colour, but in a natural coffee it’s not so easy. So those we usually take out after roasting as the unripe ones don’t really get much darker than light cinnamon colour and can thus be picked out easily. Hence, we clean the coffee twice!

And so to save ourselves the hours of work, not to mention the sore finger tips, we are looking for a small scale colour sorter for coffee. Unfortunately even the small laboratory models still have a price tag that is about our annual turn over and so they’re unreachable for us at this moment.

I run into this forum and of course it would be very interested in the final product. Also, I would love to somehow contribute. I cannot help you with the design and construction (I’m originally a civil engineer) but I do do a fair amount of programming - mostly Pascal and PHP, occasionally some Python, and my C/C++ and Fortran have become a bit rusty over the years. I could also contribute with photo’s of beans in almost any colour we have them as well as photos of bean defects. I literally have kilos of defects here that I could take pictures of if you like…

Hope to hear from you,

Dennis
Engrano (www.engrano.nl)
The Netherlands

1 Like

Hello Dennis, thank you for joining us here and confirming that there is a demand for these small sorters :slight_smile: Also thanks for confirming that sorting roasted beans is a meaningful thing to do. I suspected this myself after finding light colored beans in our roasts of Nepali coffee.

I became more interested to finally continue and complete this project, so maybe I’ll pick this as my winter project for this year. Since the hardware selection, mechanism design and also the AI image classifier are done already, creating a final mechanical design and the control software in order to get to a functioning prototype is not such a huge step anymore.

In this project, OpenSCAD will be our open source 3D CAD tool of choice from now on, no longer FreeCAD. OpenSCAD is about programming rather than drawing your 3D models – so as you seem to like programming, this could be something for you if you have time at your disposal to get into it. In case you want to start a CAD model of the machine already: use the BOSL2 library in addition to plain OpenSCAD. It’s not quite finished, but already by far the best general-purpose helper library for OpenSCAD (and I have looked around a fair bit).

Hi Matthias, as the dust clouds of Christmas coffeegeddon are settling I installed OpenSCAD last weekend and had a look. Seems to be pretty straight forward…
From what I’ve seen right now there are only some design sketches for the coffee sorter, am I correct? I’m not sure if you would like me to put those into OpenSCAD? Since they’re just sketches without any measurements it will become more of an artist impression than a workable design spec for production. Just let me know …

Over Christmas I had some time to think what a color sorter would require…and one of them would of course be the possibility the sort according to different color sorting profiles. Not only in case one wants to clean roasted coffee as well as green coffee, but even within green coffees there can be a wide variety of colors. Last week I was cleaning an anaerobic natural processed coffee from Ecuador that is really quite bright green and very uniform (at least the non-defects are) whereas we also have a naturally dried coffee that has quite a variety ranging from greyish green to almost cinnamon color. But I presume that was already taken into account …

Actually, after a few weeks with OpenSCAD I found that it is too hard to work with in practice (fillets etc. are all very difficult to achieve). And: I found a much better tool, also programmatic 3D CAD, also open source :slight_smile: That comes after looking through really all available programmatic CAD tools, so you can be certain that this won’t change again. Also it uses Python, so you’ll be more familiar.

That tool is CadQuery. It’s relatively unknown, but for no good reason, as it has a much better tech foundation than current OpenSCAD. I also designed the first few coffee sorter parts with it already, which you can find in my latest commits here. Here’s the most finished one, a 3D printable, parametric chute that lets the beans slide from the slow to the fast belt to individualize them and to move them into the center of the belt at the same time:

image

I think the next goal would be to design the missing few 3D printed parts essential for the functioning of the coffee sorter: an input tube, a conveyor belt, and an object manipulator. I have design ideas for all three by now, so if you’d want to do one in CadQuery I’d provide enough details for you to do that. No need to create the full design in CadQuery as we tried in FeeCAD – that can wait until the first prototype works, which avoids re-doing the drawings too many times.

Aside from this, I got myself a small FDM 3D printer so I can actually manufacture these parts drawn in CadQuery.

That’s important to keep in mind, yes! It means we can’t simply ship the software pre-configured for coffee, as coffee can look so different. Instead, the machine would need a “training mode” where it is fed good beans and then defects of the coffee to sort. That’s possible, but when using the deep learning algorithms it might require doing the model training on server computers (or to wait for 30 hours …).

In other news, I got contacted by Roberto, a farmer from Brazil looking for a similar machine. He made me aware of Google’s newly released Coral AI based teachable sorter demo model. The hardware (Coral AI USB compute stick) it uses is just 60-70 EUR and can execute the sorting algorithm ten times faster than the RPi 4 that I wanted to use previously. So that’s great, as it can really increase the throughput of this small machine :slight_smile:

Also I’m working on the machine development as my winter project now and hope we can get to a first functioning prototype in spring. Since you’re interested to join it means it’s no longer a single-person project and I should upload my design ideas etc. somewhere so you can collaborate efficiently. Give me a few days for that …

Ok, I will install CadQuery within the next few days so that I can contribute.

With respect to the learning process. I’m sure you’ve give it far more thought than I did, so maybe I’m saying nonsense now… But around 2 years ago I gave it a thought as I was considering building a color sorter myself. Since I’m a civil engineer specalized in in building foundations I’m not equipped with pre-knowledge on how to set it up…so what I made up was this:

  1. Learning process: a learning mode where the machine is fed for instance 100 approved coffee beans - it calculates the average and standard deviation for H,S and L over all beans.
  2. The user has to determine what deviation is considered acceptable for H, S and L (hence, they’re input values). This averages and acceptable ranges make up a “sorting profile” that can be stored - probably a sorting profile per type of coffee must be determined.
  3. Sorting process: for every bean that passes a low-res photo is made and per bean the average and standard deviation of the H, S and L is determined. If the average values of H, S and L do not fall within the range specified in the sorting profile the bean is discarded. If the average H, S and L are within range but the standard deviations of H, S and L within the bean itself is too large (hence the bean is very irregularly coloured) the bean is also discarded.

I had the idea at the time to write some code to see if that works and just test it on a bunch of photos of coffee beans. However, other obligations came in between and I haven’t done much on it. If it would work the learning process would be pretty fast. Of course the more beans are used in the learning mode the better the results.

Similarly I had been thinking on how to determined the size of the bean and how close the shape is to an ellipse. If it’s very far off the shape of an ellipse it’s probably a deformed or broken bean that one wants to discard.
But my basic idea was to let the machine do a minimum of learning and give the user parameters to play with the acceptable ranges for beans to be approved rather than trying to create a lengthy learning process.

1 Like

Been playing around this weekend. A bit of a struggle now and then, but I’m starting to understand it…

auger

1 Like

Nice, and it looks useful :slight_smile: It’s also a good demonstration of CadQuery advantages, since screw threads are still notoriously difficult in OpenSCAD.

Indeed CadQuery is not the easiest to learn, esp. since documentation and examples are partially incomplete. However, I had a good look what examples and tools are available around the web and documented my findings here. That’s pretty surely everything relevant specifically for CadQuery work right now; hope it’s a useful link collection for learning CadQuery. I found the examples esp. helpful.

On my side, I have collected all my notes, design requirements, documentation pointers etc. into the Dynalist document (same one that also contains the CadQuery link list from above). I also sent you an invitation to edit that document to the e-mail address associated with the account here on the platform (requires free signup at Dynalist).

In that document, you’ll find a short list of essential custom parts to design. So once you feel ready with CadQuery, you could choose one of them: the belt mount bracket or the object manipulator. Also I found a specific style of wrapping CadQuery designs into Python classes, which I’d like to establish as a convention for now. You can find it in the designs I published in the sorter’s Github repository. (Note recent repo name change.)

I went through the document, impressively complete! I do have one comment though that may influence the design already…and that is on the assumption of 1 kg/hour. We usually have our coffee cleaned by hand in the country of origin, most recently last November in Ecuador where we bought the annual 17x 69kg of coffee, hence almost 1200 kgs. They have 4 ladies cleaning and it takes them 4 days to do so. Counting on the average working day of 10 hour that would lead to cleaning 7.5 kg per hour per person.
The price backs that up…we pay US$ 0.20 per kg for cleaning and knowing that salaries there for unskilled labour are in the order of US$ 1-1.5 per hour it would indeed require them to clean at least 5 kgs per hour to make it worth it for the farmer…
If we clean it ourselves, that is my wife and I, depending on the coffee we do about 2 kgs an hour for a very bad quality natural process coffee up to 5 kgs an hour for a good quality washed process coffee…

Considering the remark in the document that a faster sorting speed may need mechanical adjustments it may be worth already considering that, because I think that for 1 kg/hour coffee farmers wouldn’t like to make the investment.

Ah, well, two more related remarks then …
It’s assumed the coffee sorter will run 24 hours a day…that is not so sure either. I’ve been in many farms where the only electricity comes from a generator and they for sure won’t let a generator run the whole night just for a coffee sorter - the fuel price just doesn’t make up for the few kgs of coffee sorted during the night.
Related to that … as an extra spec. The coffee sorter should be able to handle a sudden power down. Hence if it runs on some kind of Linux it has to be considered that it will not always get a nice shutdown. Actually, it quite often won’t - even if it has a power button that acts like a soft power off (hence generates a orderly shutdown in the background) people will often not use that and just unplug it while running. Whether that is ignorace, hurry or careless…it happens. So then of course the next time it’s switched on it shouldn’t have a corrupted Linux that won’t boot anymore…

1 Like

Makes a lot of sense. The 1 kg/h throughput was calculate for a Raspberry Pi 4 based machine. With the new option to use a BeagleV board with hardware acceleration for the image recognition, achievable throughput is 3.6 - 4.8 kg/h for coffee, and for that we’d need mechanical adjustments anyway. I have adapted the proposed design now to accommodate that. It will need two solenoids (16 EUR each) and one camera (30-50 EUR?) in addition.

For off-grid locations, a running the sorter on a LiFePO4 battery seems an economic option, since the machine will only need ~10 W. I added your remarks about generator operation there.

Ah yes, good point. Added it.

Well done to everyone who is continuing to work on this project - each time I see a new post I get excited all over again!

I’ve installed CadQuery and am exploring it. It looks like people are already on task of generating the parts (and way more skilled than I am!) but if there are any simple bits that I can tackle, I’m open to giving it a go. I tried to explore the parts already in the repository but wasn’t sure where to access the imported local ‘utilities’ library.

I have access to a small 3D printer and a laser cutter if we need to test any parts etc.

Keep up the excellent work!

1 Like

Thank you for the support, it means a lot!

Help with CAD design would be great actually. For your start with CadQuery, I have marked the easy-to-draw parts with a :cherries: (cherries) icon in our list of custom parts. Namely: the input control knob; a carrying handle; cable routing aids; and an electronic enclosure. These parts will not be needed for the prototype but later for a production model, so there is no rush at all for that work. But they are relatively straightforward parts that are good for learning CadQuery alongside.

Some tips for a start with CadQuery:

  • It’s definitely not the easiest tool to learn, but unlike any 3D CAD drawing tool it enables completely parametric designs, which is a big deal for a machine like this. For example, in the future it might allow us to create a machine for walnut sorting by just changing a few parameters and letting the CadQuery script calculate the parts to print.

  • I made a list of helpful CadQuery documentation links, examples and accessories. Had posted that link also above already.

  • If you work on a part, you can first create the geometry with fixed numbers as arguments for 3D object creation, rather than making everything parametric from the start. Also at the start you don’t have to try to put everything into classes and methods like I did – all in one Python file is fine. If you stop there, it’s already helpful for me as I’ll have the ideas in code and just need to wrap it into a parametric design and a class structure. You can do that as well of course; but doing it all at once together with trying to get the geometry right and learning CadQuery could be a bit too much complexity to handle at once.

Just save all the files you see in this directory into one directory on your computer, and the import utilities line will be resolved automatically from the utilities.py script in your directory.

The “proper” way to get all these files is of course with this command:

git clone https://github.com/tanius/smallopticalsorter.git

But in case you don’t know git yet, no need to learn it right away. Can wait until you made some progress with CadQuery.

1 Like

Another bit of progress :slight_smile: I just finished the input tube socket part, shown below. Not sure yet about the final measures and angles, but that’s easy to configure for a parametric design. CadQuery source code is available in the repo, as usual.

Now only two more essential parts to go (coffee bean pusher and belt unit) …

Optical Sorter Tube Socket by matyaz on Sketchfab

1 Like