Skittle Sorting Machine


#1

Hello, everyone. We just finished our first project with the Odrive. So, I figured I would share it here.

The project is a skittle sorting machine using the Odrive to control two axis.

You can watch our video series on the project here:

The Odrive worked pretty well for us. The only thing we really had to work around was the lack of serial communication. First we tried to just connect our microcontroller to the Odrive as a slave on the spi bus. Initially this worked, but had inconsistent issues with the internal buffers in the Odrive. Not wanting to debug that deeply into the ST micro, we ended up switching to using the gpio pins as a type of parallel communication. This gave us 8 commands that we could send in one clock, which was enough for this application.

So, the Odrive has hard coded motion profiles for the feedwheel and one of the parallel commands is “go/stop.”

Then, there are 5 commands to tell the bottom servo motor to go to the position associated with each color of skittle.

The hole position are hardcoded offsets from the first hole. There is a command that allows you to set the position of the first hole.

The last command is used to home the bottom servo motor to the index on the encoder.

It was a fun project, and I am glad to finally see something like the Odrive being developed.


#2

Cool project! Looks like ODrive was working pretty well for you. Oskar implemented UART comms in a test branch the other day, and could use well… somet testing!. https://www.youtube.com/watch?v=HMVhxns--_4

I like those hollow shaft encoders you have. Do you know where to get them retail/what they cost retail?

Is that the PSoC 4 or 5LP? Nice little micro, but getting going is quite a bit more difficult than with "Genuino"s. Especially if you want bootloading or serial comms (not to mention the IDE is C only, no C++). Poisonally, for super quick projects I use a PJRC Teensy 3.2, which is an ARM Cortex M4 that is Arduino compatible. I turn to the PSoC if I need the analog handling or the UDBs.

Can’t beat the price on those PSoC dev kits though, especially if you get a Cy8ckit-059 and get BOTH processors programmed up for the $10 they cost.


#3

Thanks.

I have really enjoyed these encoders. I tried them on suggestion from other on the forum here.
They are the AMT-102: https://www.arrow.com/en/products/amt102-v/cui-inc

Just remember to buy a connector for it.

I can definitely agree with the getting started issues. (I came from starting in arduino) The documentation is thorough but it is very much made for engineers. So, it is a case of: no one can find the information except those who already know where it is. Now that I happen to know where everything is, setting up comms and other peripherals is “drag-and-drop.”

You actually can use C++ in a PSoC, you just have to let the compiler know what you are doing. No one really teaches these things though. (Not very clearly anyway) Maybe I should make some videos on the subject.

Yeah, I love the little stick dev kits. the kit costs less than the microcontroller in one-off costs. And, once you have one, you can break off the programmer and use that as your USB programmer for future PSoC projects.


#4

+1 on these encoders; I’ve been using them with brushed motors on some projects and have been extremely happy with them. For ~$23 (and next day free shipping on Arrow), you can’t beat them.


#5

I can exercise the UART branch! Any tips on where to start? Do I just need to send the same string commands as the USB interface? e.g. can I send g commands to get params and set setpoints with s v and c?


#6

Ah, yeah forgot. The commands are the same, but you start a command with ‘$’ and end it with ‘!’ or a new line. Example:

$p 0 150 0 0!

Would tell motor 0 to move to 150 with 0 feed forward. I think it’s set up for 115200 baud right now.


#7

Yeah, If you implement it basically the same way as the USB serial, then it is easy enough for people to add to (or re-write) the command parsing function.


#8

Awesome!
@Bauerslab do you mind if I link to your video in a newsletter email?


#9

Thanks. Not at all. Go ahead.