Introduction: Magical Marble Sorting Machine
Did you ever want to sort marbles?
Then you could build this machine. You will never need to shuffle through a bag of marbles again!
It is a magical marble sorting machine, using a color sensor fom Adafruit, type TCS34725 and a Leonardo Arduino from Littlebits. The machine sorts four different colors and it also counts the number of marbles per color. All electronic parts are made with Littlebits.
What is "LittleBits" ?
LittleBits makes a platform of easy-to-use electronic building blocks empowering everyone to create inventions, large and small.
They make technology kits that are fun, easy-to-use, and infinitely creative. The kits are composed of electronic building blocks that are color-coded, magnetic, and make complex technology simple and fun. Together they’re interchangeable in millions of different ways to empower kids to invent anything - from a sibling alarm, to a wireless robot, to a digital instrument.
For details about this electronic learning system see www.littlebits.cc
Step 1: Materials You Will Need:
The following Littlebits components, used for the electronic part of the machine:
1 USB Power
2 Adhesive shoes
3 Servo accessories
1 Split wire
1 Synth speaker
2 Mounting boards
1 Remote infrared trigger
1 Arduino Leonardo
1 MP3 player
1 Number+ bit
1 Wall wart power adapter
And some craft materials also to make an attractive machine:
MDF wood 6 mm
White cardboard 1 mm
Wooden marbles 25 mm
Color sensor Adafruit TCS34725
Set of M3 bolts and nuts and washers
Set of M3 standoffs, various lenght
Paint (yellow, green, blue, red, purple,, black)
Step 2: The Heart of the Machine
The color sensor is connected via I2C (SDA,SCL) and the GND and 5 Volt VCC connections on the front of the Arduino.
I2C is a very easy serial connection used for communication between the sensor and the Arduino.
(SDA on the D2 input and SCL on the D3 input). You can check the Adafruit website for more details on the color sensor and the I2C connection. See: www.adafruit.com/product/1334
They also supply the Arduino library you will need.
Step 3: How Does It Work ?
The Littlebits Arduino Leonardo has three output connections, D1, D5 and D9.
D1 is used to activate the kick mechanism servo to send a marble into the sorting lanes. It also resets the marble counter and activates the MP3 player which is loaded with a nice bell sound.
D5 is used to set the storage selector servo in the right position, depending on the outcome of the color sensor and it sets the hand pointer servo to point to the detected marble color on the front of the machine.
D9 is used to show the number of marbles of a certain color on the Number bit, also located on the front.
The Littlebits Arduino Leonardo has three input connections. D0, A0 and A1.
In this machine only A0 is used for the Infrared remote detector which activates the final counting after the machine has stopped sorting. Via this connecting the whole machine is also powered with 5 Volt via the USB power supply..
Step 4: The Marble Warehouse
For the warehouse (where the unsorted marbles are stored) I used a cylindrical cardboard container from MyMuesly and added a cardboard spiral path to its outer surface with a small fence to keep the marbles in place.This spiral path is glued on a number of litle red wooden cubes. See www.mymuesli.com/
Step 5: The Kick Mechanism and the Marble Sorter
I made a cardboard selector to send the marbles into their storage lanes. Dimensions WxDxH 74x33x20 mm with a sloped surface inside. The selector is glued on the circular servo accessory. I made it as small as possible, adding too much weight on the servo made it jitter a lot...
Next I made a wooden & cardboard cyllindrical device, the kick mechanism. It is glued to a circular servo accessory. When the servo is turned on, it catches a marble and kicks it into the cardboard selector from step 2.
Step 6: The Lanes
Made from white cardboard, each lane just wide enough for the 25 mm marbles. Mounted with a slope so the marbles slide into the lanes.
Step 7: Where Is the Color Sensor?
I made a wooden ramp with the TCS34725 color sensor inside. The marble, catched inside the kick mechanism lands on top of the sensor so it can measure the color. It has a small piece of clear plastic on its surface to avoid blocking the marble on the hole where the sensor is located.
Step 8: Where Is the MP3 Player?
The mp3 bit is loaded with a bell sound and is mounted inside the main box together with the synth speaker on a upside down mounting board. It sounds a bell when a marble is sorted.
Step 9: Counting
Behind a white cardboard background the number+ bit and a servo are mounted. The servo is connected to a hand pointer which makes the same moves as the marble selector. This servo is connected to the circuit via a dimmer to adjust the angle of the hand pointer. The counter remembers the amount of marbles per color and is reset to zero when the final counting procedure is activated via the remote control.
Step 10: Move It Move It !
See the machine in action !
You will never need to shuffle through a bag of marbles again!
Step 11: Programming !
The color sensor reads three values of each marble, red, green and blue. Depending on the value of these colors the marble selector is pointed to a certain storage lane. When there is no marble detected, the selector moves to a halt position. I wrote two small programs for the Arduino, the main program detects and sorts and counts the marbles, the second program is only used to detect the three color values from the sensor and show them on screen. This was neccessary because the communication via the arduino screen monitor conflicted with the main program. I nearly bricked my Arduino when I tried to combine this with the main program.
Second Prize in the
Arduino Contest 2016