Go Down

Topic: Project: Motion Tracking Cat Toy (Read 4 times) previous topic - next topic

armpit

#5
Jan 18, 2013, 05:25 pm Last Edit: Jan 18, 2013, 05:27 pm by armpit Reason: 1
Well, even with 0 interest on this forum for this project, I finished it anyway...

Un-mounted


Proof of concept mounting


Video of it in action

https://www.youtube.com/watch?v=JBTybxgcBr4



Complete parts list:
Arduino Uno - $30
MK802 Mini Android-based PC Hacked and running Gentoo linux to handle image processing - $45
2x 28BYJ-48 stepper with uln2003a controller  - $7
12v power brick to power steppers - Salvaged
Jumper wires - $5
5v Axiz Laser module - $10
Playstation Eye - $20
USB Hub - $20
Misc parts for mounting bracket - $25



It took 2 prototypes to settle on a design.
The original design was going to have the laser coordinates be based on a polar system, since this was to be mounted from the center of the ceiling. This made sense in my head, but in practice with the prototype it was very slow to respond any time the laser was near the center of the plane because many times nearly 90 degrees of rotation was required to get the laser to where it needed to be. I also had problems with wires getting tangled and had to implement a counter so that it would not rotate to the point of winding itself up.....
It was at that point that I decided I would scrap the design and start fresh with a standard Cartesian design that would solve all my problems.

I heavily modified the stepper library from sbright33 to suit my needs. This involved psudo-threading the library so that moth motors could move independently from each other at the same time (technically not the same time, but alternating every few hundred microseconds) as well as creating my own custom coordinate system for it to follow.


At first I also was planning to use wireless USB to transmit the webcam feed from the ceiling down to my main computer which would do motion analyzing and send back the coordinates that movement was detected at. I found an industrial-grade wireless hub, but regardless of what their claims said and after a week of trying different webcams out, it did not have the bandwidth support for HD webcam streams.
After some research, I settled on the MK802 Android MiniPC because of it's hack potential - planning to use it with linux to broadcast the webcam stream over my network to accomplish what the usb hub should have done.

Once I started playing with it, I realized that it had enough power to preform the image processing on its own - significantly slower (about 4fps instead of 60) but still quick enough to provide updates to the arduino faster than the motors could move.

The MK802 uses OpenCV and Python to handle the image processing, and communicates with the arduino over a serial port (the USB hub comes in here to support the webcam and the serial communication from one usb port). It sends the coordinates that the laser should point at, as well as a randomly chosen speed that it should travel on its way to those points. The python script waits until it receives a 'done' transmission from the arduino, and then sends the most recent set of coordinates for the laser.

It draws its power from the source that normally power the lights that connect to the fan, and can be turned on and off from the light switch. The fan can run while this is installed and operating, although I have noticed a bit of interference in the serial communication while the fan is running (magnetic interference, I assume) It can also be put into manual mode and controlled from any computer on the network.

HikerDave

This is GREAT!  And just what I've been looking for, (but better than the one I had in mind....)  Thanks so much for posting!  This is going on my list of "things I plan to do when I have some time some day"....  :-)

sbright33

Thanks for mentioning my Stepper library!  Can't wait to see how your project turns out.  Will you post a video when it is working?
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

d00m

Hello.

Could you show more photos of your stepper mounts with each other ?
I try to make similar device but wonder how to mount this steppers to kind of pan-tilt system.
Also very interesting how to solve problem with limits rotation shaft ?

I need to rotate shaft from 0 to 180 or may be more but if it not going round and tear my cables.
What kind of limit do you use ?


Go Up