Wiimote Controlled Coil Gun

iocoil1

[thecapacity] sent us his iobridge project where he controls a coil gun with a Wiimote. To make the coil gun, he took apart an office golf putter that had a ball return.  The mechanism to return the ball is a metal cylinder that is moved magnetically. He simply replaced the cylinder with a smaller diameter piece of metal to create the gun.   His computer monitors the Wiimote axis changes and sends them to the ioBridge. The unit could be located anywhere, but without a camera on it, he’ll have a hard time aiming. There’s a video of it working after the break.

[youtube=http://www.youtube.com/watch?v=aBKoaXtHyfs]

24 thoughts on “Wiimote Controlled Coil Gun

  1. Thanks guys, mess_maker you’re right, it’s polling about every 1/2 a second and there’s a bit of a “race” b/t the Javascript querying for new data and the python creating it.

    @harvie there’s some latency simply because I “truncate” the position information somewhat to create a more finite granularity, i.e. I don’t move the servo unless the wiimote’s moved > 40 units.

    @blizzardemon — haha my mother in law asked if there was a reason it looked phallic! My platform is two “mustard scoops” (I think that’s what they are) that we had in the kitchen from some Bed Bath and Beyond shimpments!

    @sean I didn’t show it in the page but I have the wiimote’s trigger initiate an iobridge event also. I’ve ordered a relay board to isolate the firing sequence from my board’s electrical system. But for now that’s straight wall current powering it so I thought it was better to be safe then sorry! Don’t want fry my favorite new hardware platform!

    Thanks for the feedback!

  2. the iobridge is a nice thing, but wouldn’t something with a simpler low latency serial link work better? since you don’t have a webcam hooked up you’ll always be in the same room as this thing anyway :)

    in fact with an arduino type thing and a bluetooth module you could replicate this whole setup with tiny latency and no need for a laptop or iobridge.

  3. Hey Dan,
    Some good points, there’s actually not much network latency (the lag is actually from my math converting the vectors) but you’re right it would still be there.

    With an arduino and a bluetooth you’d be limited to the range of the bluetooth between both devices, but with an iobridge I can span the entire world and only need an internet connection between the components.

    I’d seen the nunchuck hacks for the arduino and knew I couldn’t do that much electrical work since software’s more my bad, and of course with an arduino solution it would have to do all the processing (interrupts *shiver*).

    So using my laptop would allow me to do “gesture recognition” (assuming I can figure out the 3D vector math) and let an embedded device like an arduino do what it does best, control.

    There’s definitely a time and a place for both solutions, mentally I see embedded boards as playing more of a “delegation” role, i.e. “Go do this and let me know when your’e done” so you don’t have to worry about the realtime & threading issues.

    I’ve got a old webcam laying around so I’ll see about hooking that up, then my friends will really be afraid!

  4. @thecapacity – what you say is very true; your way of doing things has a lot more potential for future cool stuff, which after reading your webpage is obviously something you have thought about! i also have no idea what kind of output the wiimote provides over bluetooth; sounds like it needs more processing than i had assumed.

    i’ve actually been mucking around with building a small gun turret type thing myself; so far I have a heap of servos twitching on my desk and no actual firing mechanism. i hadn’t thought about using any remote control method more exciting than the keys on a keyboard, but i have a nokia phone with an accelerometer which i think somebody has written python libraries for, so i may have a go at hooking something up using the output of that in lieu of a wiimote.

    there’s definitely something intriguing about allowing computers to shoot at things. eventually i’d like to have some kind of automatic aiming/firing – through work I have access to some pretty decent real-time face detection and recognition software, and i don’t think it’d really take too much effort to knock something together using that to shoot at unknown faces :)

    will definitely check back to see how your project is doing, hopefully mine will get off the ground (well, desk) at some point too.

    dan

  5. @Dan, good luck with the control system! As you can tell I didn’t really spend much time w/ my mechanical (it’s not my strong suite) so just focus on what you can do best and hedge the rest for another time.

    The wiimote output is crazy! The WiiMote daemon I used spits out the data constantly, and I learned (from watching the data) that accelerometers aren’t all that “perfect”!

    You’ll get a value say 124 and it’ll ficker b/t 119, 128 and maybe a few others (and these are all floating points too!).

    Also it makes sense once I saw it but if you move the wiimote, say left, you’ll see a spike in #’s but hold steady for a second and it’ll look like it never moved! (This is because accelerometers can only track inertia and that’s why there’s an IR sensor too).

    I have a new found respect for all the math behind it all! If your program blinks for a second you could have missed a movement! And I have no clue how to extrapolate 3 axes into something simple like a “gesture” for now!

    Anyway, it sounds like maybe you’ve got enough to try more of a mechanical system and if you’ve got some good servos maybe use them to wind a trebuchet, crossbow / windlass or something!

    Or if you can gear it up how ’bout one of those centripetal acceleration cranes like they use for pumpkin’chunk’n!

    I think I saw an image recognition hack on here maybe a year ago where a guy could shoot his buddy w/ a paintball gun!

    Good luck w/ the nokia, but if it’s too tough a wiimote’s pretty cheap for all that it does (think about all those buttons! ;> ) and let me know if you want some ideas (as you said from my site, I’m full of ’em ;> )

  6. @memals I don’t think they come in other colors though I’m sure you could spray ’em blue if you wanted :D They’re from some strange “free addin” that Bed Bath and Beyond dump in when someone buys you something *shrug*.

    @kevin Proximity detector’s a good idea but I think I’m going to go for a webcam. Once I get my relay board for the trigger I’ll put the two together and see if that works!

  7. @thecapacity I see from your blog that you are reading only one axis from the Wii. I did a project a few months back using an accelerometer and magneto-inductive sensor to determine 3D orientation, and believe that you can get much better reading from reading 2 axis and calculating the angle of the gravity vector to determine the controller’s roll. If you’re only reading one axis, it tends to be over-sensitive around the midpoint.

    Another idea you may want to consider, is to mount the Wiimote on the coilgun. You could then paint the target with a IR laser, and use the Wiimote’s IR sensor to track the target. This way, you don’t need to be at the computer to aim it using a webcam.

  8. @cort
    Wow, two fantastic ideas! With the ioBridge I’ve kind of actually removed the need to be in the same room (once I get a webcam) as the target (other then for filming) so I don’t know about using the controlling wiimote to track the target but a 2nd one would make it way more accurate!

    I’m really intrigued by your 1st idea too. I did feel like I should be able to extrapolate from more then a single axis and was considering adding an “up / down” output as well.

    However, the vector math was a bit daunting for me, and suggestions?

  9. @thecapacity I took a look at your source code, and it seems that I was mistaken. I had thought that you are reading only one of the accelerometer’s x/y/z axis, and was suggesting that you read two and calculate the roll from there. Didn’t know that Motedaemon already does this and provide both roll and pitch directly.

    With this, it should be easy to add an up/down control by using the wiimote’s pitch. The only rotational motion missing is yaw, but the wiimote doesn’t have the hardware to handle that.

  10. Hey cort!

    Thanks for taking a look at it!
    I hadn’t realized that pitch and roll were generated by motedaemon (and not directly supplied by the wiimote). It makes sense now that you mention it!

    I’m going to try a bit more powerful weapon (airsoft handgun) thoough it’s too heavy for horizontal & vertical motion.

    I only have the two servos but once I get something a bit more threatening (and a remote trigger) I’ll try to do X & Y trackig w/ maybe a laser pointer or something!

Leave a Reply to mike cCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.