Woo! It has been almost six months since EV3 was released and I recently realized I haven’t really played that much with it. In fact, if you follow the blog you will realize that I have done little Technic stuff too. LEGO is so addictive…
So I decided that it was time to play again with Mindstorms EV3. Have you see my review of it? If you recall the project available are robots like Track3r, Spik3r or some of the others. They looks awesome but really I don’t find them useful. So I decided that a nice project would be to use the machines and robots from NXT 2.0 set in the EV3. So, here it is the Color Sort3r :)
It is mostly the color sorter provided by NXT 2.0 instructions but I did some changes on the rotating tray as well as using other colors different of the one provided in NXT 2.0 instructions
The point behind Color sorter is to show the usage of Color sensor and Touch sensors. Keep in mind that you will have a hard time making this work with just EV3 because you need two touch sensors.
1st step: Ball dispenser
This is the first stage and it will set the base for the rest of the project, so it is quite complex to build with lots of steps, please refer to the Mindstorms NXT 2.0 instructions about how to build it.
The overall idea is to make the dispenser drop a ball at a time.
My changes has been related to using gears instead of knobs because I though it would be smoother but there is seems to be some serious backslash that damage precision. Also as the EV3 brick is different of the NXT 2.0 brick I had to do small changes to the way it is attached to the machine.
So here it is working.
Ball dispenser EV3 program
And here is the EV3 code. It is the first EV3 program that I do without any external help and I really find the language exasperating. Definitively I am going to grab something else to code this afternoon.
One nice difference between the EV3 and the NXT 2.0 graphical language is that in the switch block you can add cases using colors, instead of the cascade of if blocks on the NXT 2.0
Problems with Ball Dispenser
This model has a serious flaw in the dispenser tray as sometimes all the balls get stuck and none is dropped.
Problem: Dispenser’s tray don’t move
This can be caused by different things.
A) Please check all the cables are correctly connected.
B) Right? Ok, now check which cable goes to the motor that moves the tray ( the one that is further from you ) and check that it is the same you are operating at EV3 program. Is it the same?
C) Still with problems? Check that the gear attached to the motor can operate freely. I did some mistakes building and one axle was blocking the gear.
D) No? I did a little-modification to make the tray moves higher but it resulted in the tray not operating as expected, so make sure the beam that link the gear and the tray is 9U long.
Problem: Ball don’t fall
Shit happens. The way the tray is designed can ( and will ) make balls to block other balls from failing into the pit. I will show you some mods at the end to make it perform better.
2nd step: Color detector
Ok, balls are now dispensed from the tray one by one. You better run the machine inside a box or you will be chasing balls all around the house. So, in this new step we want to detect the color the ball has, so we can place it in a bucket of the rotating tray.
I used the color sensor from NXT 2.0 set because… ehmmm… I did a mistake. The Color sensor of the EV3 works better. There is very little to build in this step… so let’s see the code.
Color detector EV3 program
So here is the code.
In this step, we reuse the previous code and add a switch block with a case for each color we have: blue, red, yellow and green as a well as a case for the no color event.
Problems with Color detector
Ball don’t fall
I had this problem, now and when I built it using the NXT 2.0 set, just add a bit of space between the color sensor and the balls by raising it half stud at least.
Ball isn’t correctly detected
That happens sometimes if the light setting isn’t correct. Try a darker area away of direct sunlight, also it can happen if the color sensor is too far from the ball.
3rd step: Sorting tray
Again, you have so little to build here. The tray is pretty simple, you just need to be sure that the tray and the motor is aligned as explained in the instructions.
I have had some problems making it work correctly because I used gears instead of the knob gear that the manual proposed. It seems it wasn’t so good idea after all.
Sorting Tray program
Here is the code.
As you see it is pretty much the same with two minor additions, the initialization of the sorting tray and making it turns, 0, 90, 180 or 270 degrees depending on the detected color.
Problems with Sorting Tray
Tray doesn’t rotate
Check the motor, the one closer to you, is correctly plug and that you are sending commands to the right port. Also make sure there is nothing blocking it.
Ball doesn’t fall into the tray
This is mainly because you didn’t correctly aligned the tray. You have two options, take the tray away, turns the motor until it is correctly aligned and then place the tray again in the machine.
Another option, that it is the one that I used is to correct the tray position inside the code.
I found that when kids handled the machine the tray accidentally got blocked a few times and so I had to rewrite the tray initilization code twice. Don’t let kids play with the machine :) #easyfix
Wrong container chosen
It can happen because of two things:
a) It can be a fault of the color sensor that sometimes on some conditions can mistake a ball’s color. Try making less room between the ball and the sensor.
b) It can also happen because of the above problem that the tray gets misaligned.
Nah! I refuse to build this part. Do you know how hard and painful it was to look for missing balls after ShooterBot?!
Download EV3 project file for Color Sorter FREE
I have always said the same since I opened the EV3 box that the NXT 2.0 robots and machines were more interesting. This machine shows how to build a robot that can sort stuff based on color and I will show you on my next Mindstorms posts that with some modifications it can be adapted to other sorting purposes.
Value for money
Please like and share if you enjoyed it. And don’t forget to subscribe to The Technic Gear Youtube channel, you are just on click away of awesomeness.
11 thoughts on “Mindstorms EV3 Color Sorter MOC”
Pingback: The Best Ten LEGO Technic Sets ← LEGO Reviews & Videos
Where do you buy the colored balls??
They came with NXT 2.0, not really sure where you can buy them… I would try bricklink.com but the price of these balls is “ugly”
Where did you find the switch with 5 cases to differ colors? I use mindstoms ev3 software and only have the if-then-else-switch with 2 cases. Thanks, Norbert
Use the wait block and change the type to Color Sensor
Hi, This is a very cool program and my son wants to build it. We have a EV3. Can you please give us the ball dispenser build instructions. Thanks a lot!
It is part of the LEGO NXT 2.0 Set, I am sure that instructions are somewhere on the Internet… but on the other hand I am not so sure you can build it with just a EV3 set.
Hi Thanks so much for your reply. My son and I searched quite a bit but couldn’t find them – there are NXT2.0 set instructions for vending machine, fork lift, ball shooter etc. but not for a ball dispenser like the one you have in the video…. Is it possible for you to scan your instruction doc and email it to me? Sorry for the trouble, but I am not very good with mindstorm and my 9 year old very much wants to do this. I am just trying to help him out. Thanks!
how many sensors did you use in the color sorter part 3 and what is the sensors type
Do you can shared the structure please
the color sorter instructions are on the nxt 2.0 programming software. I managed to adapt it in some way that I can’t remember so I will try again sometime.