• Not this time :)

    Fabien-Chouteau10/09/2016 at 18:54 0 comments

    The Hackaday Prize 2016 is almost over, my project is not finished.

    Here's the current status:

    • The dispenser is working (video)
    • I got color detection more or less working. At least good enough for this project (image)
    • I'm still not sure if I will be able to move the candy out of the channel during their free fall. I will probably need a bigger compressor for that.

    The biggest hurdle in the last two months was the incident with the OpenMV. I fried it and I still don't know how :( I got a replacement from lextronix.fr, but too late to be able to continue.

    Thanks to everyone who supported this project for the Hackaday Prize. I still think the project is doable, so stay tuned, I will finish this thing !

  • Making the candy dispenser

    Fabien-Chouteau08/08/2016 at 19:28 0 comments

    The dispenser is the part of the project that will extract one candy at a time from the bin. It's not as easy as it sounds. My design is inspired by other builds found on the web, but I increased the number of holes in the rotating plate to have a higher throughput. There is no good reason to use a stepper motor, other than the fact that I had this motor lying around for years. It's also an opportunity for me to play with a 555 chip to generate the pulse train (schematic).

    Here is the build video:

  • Change of course

    Fabien-Chouteau08/01/2016 at 19:32 0 comments

    I got my laser cut frame in the mail!. It's beautiful, all the parts fit together... but the main channel is too small... That's not a big problem, I will just use smaller candy!

    Now, the main idea in this project is to eject the candy from the main channel into a dedicated bin depending on their color, and doing it with compressed air. Let's see if it works:

    As you can see it doesn't work very well. It seems like the pressure is not high enough to change the course of the candy. Maybe my compressor is not powerful enough (I get ~4 bars or ~60psi) or maybe it's the solenoid valves that drop the pressure. As shown at the end of the video, rolling the candy down a slope, instead of dropping them free fall, works a little better.

    Anyway, I will carry on with the next part of this project which is the dispenser. It's the part that will extract one candy at a time from a bin where all the candy are stored.

  • Computer vision is not easy

    Fabien-Chouteau06/26/2016 at 20:44 2 comments

    It's been a little while since my last update. My attention was drawn by a project at work but now that it's launched I can focus on the High Speed Candy Sorting Machine.

    First things first, the High Speed Candy Sorting Machine was selected for the Hackaday Prize 2016 final round!!! This is amazing! Thanks for the support, this will give me the extra motivation to finish this project on time.

    Computer vision

    I've started to work on computer vision using the OpenMV board. Of course, my firmware will be in Ada. You can have a look at the sources here and here.

    To implement color detection, I compare all the pixels from the camera snapshot with a set of reference colors. Each of the reference colors matches the color of a candy. For each pixel I need to compute a distance between the reference color and the color of that pixel. The classic RGB format is very bad for computing distance between two colors, so I translate the RGB values to the LAB color space. It is then trivial to get the distance between two LAB values. Using this distance value, I can tell to which reference color the current pixel is the closest.

    To speed up the process, I pre-calculate every RGB565 to LAB inside conversion table during initialization. With this table, converting from RGB to LAB is blazing fast.

    For the moment I use the QQVGA2 resolution (128, 160). It's not a lot of pixels,but it's maybe already too much. I don't need a fine resolution to detect colors of candies that will be very close to the lens and having less pixels means faster image processing.

    Laser cut frame

    Last week-end, I ordered laser cut acrylic parts from a German website, formulor.de.

    I didn't know this website, but it looks like it's the only online laser cutting service in Europe.

    You can find the designs (3D and SVG) in the project repository: here

  • Solenoid valves and some music...

    Fabien-Chouteau04/03/2016 at 18:22 0 comments

    (I explain why I made this machine at the end of the log)

    Today we are going to talk about solenoid valves, i.e. how to control compressed air using electricity.

    They are usually very expensive and only used by professionals. Fortunately, I found these Airtac valves on Amazon for about 10 euros each (which is dirt cheap).

    I will not try to explain in detail how solenoid valves work. But basically by sending electricity to a coil I can open the valve and release the compressed air. If you want more info, you can go here.

    Here are some pictures of the valves I will use. The mechanical part:

    Mechanical part of the solenoid valve

    The solenoid with terminal blocks to connect to the power supply:

    I can chain them to save space and use less tubes and fittings:

    To control the valves with a micro-controller, I use a simple circuit with a Mosfet transistor:

    I then repeat the circuit six times on a proto board and connect the solenoids:

    Harmonica Machine

    To test what I've made so far - the air tank, the solenoid valves and the circuit - I had the idea of using the compressed air to blow in an harmonica. After a few attempts, it seems that only 4 notes work: C, E, G and a lower c. That's good enough for a small melody, so I hook up my circuit, plug the compressor with the valves and the air tank, and program an STM32F4 with a small piece of software that triggers the solenoid valves to play music (sources). You can see and hear the result at the top of this project log.

  • Air compressor and DIY air tank

    Fabien-Chouteau03/28/2016 at 19:34 0 comments

    With this project I try to use as little moving parts as possible, that's why I want the candy to be ejected of the main channel by compressed air instead of a mechanical system. For my source of compressed air I will use a cheap and compact off the shelf compressor.

    In that category, the airbrush compressors seem like a good fit, so I bought a Wiltec AF18-2 for about 60 euros online. This model does not come with an air tank.

    It can go up to 4 BAR (60 psi) which is more than enough, but I think the throughput is too low.

    An air tank would solve that problem by storing air when it is not needed (like a capacitor for electricity). This givesa more steady stream of air. There is a Wiltec model with an included tank but I already bought my compressor, so I had to make my own air tank.

    For this I got a few quick fittings and a 6mm silicon tube.

    I cut a hole in the cap of a plastic soda bottle and glued a straight fitting with epoxy. The joint is air tight and can probably handle more pressure than the bottle itself.

    Then I just had to put the cap back on the bottle and install it on the compressor.

    Next time I will play with solenoid valves.

  • First design

    Fabien-Chouteau03/17/2016 at 07:31 0 comments

    Here are my first thoughts on the project design:

    Candy drop

    The candy will drop one by one from a container. For the moment, I don't know if I will be able to separate the candy without a mechanical system. I've seen a few designs already, but maybe I will have to make my own to get the speed I'm looking for.

    Color detection

    Then gravity will push one candy down the main channel where it will drop in front of a camera. The camera will provide a high speed color detection without having to stop the candy during its fall. I don't expect the algorithm to be too difficult, at least the first naive version, since only the color needs to be detected. And to keep it simple, one of the first requirements will be that only one candy can be in front of the camera at a time. For the platform I'd like to use OpenMV, a Raspberry Pi with camera module could be a good alternative.


    To separate the different colors, I plan to use compressed air. A compressor will provide a continuous stream of air. Solenoid valves, controlled by the color detection software, will release the stream that will push a candy into one of the side channels. The timing will have to be precise to catch the candy during its fall.