Best approach to make a rotation sensor

Miscellaneous Forums/General Discussion/Best approach to make a rotation sensor

I'm thinking of making a game that uses an stationary bike as the controller. Or at lest use the rotation of the bike's wheel to control the forward motion of the bike in the game on the screen.

I need to make a costom input device for this. I thought about just butchering an old mouse (the ones with the ball), and extracting one of the rotation sensors from that. If I keep the wiring intact, I should be able to just use it as if it's a mouse. That way I could use Blitz 3D's mouse commands to grab the data, and use a game pad to control the rest of the features in the game.

Anyone have any ideas for a better approach to this?

I reckon it might work... depending how fast the wheel is rotating though, you might have problems. I'd wager that a mouse has never been tested at 30mph before. :)

Actually I thought of that. I figured I would use some lego gears to ratio the speed down for more accurate data.

Depending how much you know about electronics, you could get a better result by using an I/R sensor - one part attached to the bike wheel, the other attached to the bike frame. Each time both parts are lined up, it registers a 'click'. By recording the time between the clicks, and knowing the wheel radius, you can accurately calculate the speed that way.

Maybe you could get hold of a cheap speedometer for a mountain bike or something, since they work pretty much as above, only they're normally magnetic rather than I/R.

How you'd get the results into a PC tho - dunno!

How you'd get the results into a PC tho - dunno!

i do, but its expensive.
you could build your own device using a micro-controller + infra-red, and read the data on a serial port or USB.
the hardware would cost arround $100 (that is due to the micro controller)
the advantage is that it could be re-used anytime to preform other tasks. (like adding function buttons to the bike)
also you can for another $10 add motion detection which outputs Z/X/Y acceleration.
i've studied robotics for a few weeks :-P

This is the kind of thing I had in mind.

I suggest you go with the BasicATOM 24 module of BasicMicro. (in case you want it)
http://www.basicmicro.com/Product.aspx?productID=18&CategoryID=1
You will need a simple board to.
Additional components can be bought a www.robotshop.ca

this one works great, but its pricy:
http://www.robotshop.ca/home/products/robot-parts/sensors/encoder-disks/wheel-encoder-disks.html

Most bike sensors are just a reed-switch and a magnet. Those components are generally really cheap. Making sure the magnet is strong enough/close enough to trigger the switch is probably the only pain you'd have.

You could overcome the directional problem (ie. are they peddaling backwards) if it matters to you by using two reed-switches. It'd be a pretty cheap and simple project to knock together if you can use one of those old style DSUB 15 gameports rather than a USB port. I'm not entirely sure how up to it the gameport is in terms of how many samples per second you could get.

actualy, why dont you just mount a mouse with scrollwheel on the bottom of the bike wheel?

It'd probably be destroyed in about half an hour.

Mechanical contact probably wouldn't work very well in this instance. I doubt it'd be very accurate or reliable, and then it'd die because scroll wheels are meant to be used by gentle, soft fingers, not big wheels rolling at 30mph.

lol, i guess. we never tested tough.

How about mounting an optical mouse so the bottom is facing and very near, but not touching, the surface of the wheel?

The only issue here might be that the wheel might be turning too fast for you to get an accurate or reliable reading.

If that is the case then you could perhaps mount the mouse pointing at the side of the wheel, and put some kind of cardboard disk on it with contrasting lines with whatever spacing makes the rotation appear slow enough for the mouse to work properly.


I think gearing the wheel down is also a good idea, but if the above works, it would be much simpler to construct. And you don't neccesarily have to destroy a moust to test it.

Oldskool mice often use an LED shining through a slotted disc. It may be possible to rip it apart and create a slotted disc on the bike wheel with card. Not sure how well it would work, but its worth a try if you have a cheap old mouse gathering dust.

actualy, im not sure how an optical mouse works, but you may want to try that laser-thigy on the wheel.

http://www.ar.com.au/~softmark/page46.html

Just a suggestion, this would allow you to use the USB port to interface to a digital source, all you should need is a power supply (actually this board can supply 5V at 100mA, you don't need an extra power supply) and personally, I would just put a spot of good flat white paint on the wheel and use a red led and infrared phototransistor.

Should cost less then $50.00 and work pretty well.

Sigmason

Oldskool mice often use an LED shining through a slotted disc.

I pulled apart an old Amiga mouse once and used the LED/sensor pairs as a lap counter for my Scalextric set - When the beam is broken, it's like the mouse is moving.
(of course, the lap-counting app was programmed in Blitz Basic II :-)

Use a Hall effect sensor they were designed for this type of use.

This just sounds like one giant comedy accident waiting to happen!!!

I'm with John on this one, Hall effect switch and magnet.
You could experiment with a reed switch, you might need to debounce the switch in hardware or software.

FOR FUN:

I was thinking you could get a cloths pin, playing cards, tape, alum foil and fabricate a switch that makes and break as the wheel turns, plus you'll get that cool engine sound!

I'd tap the 5 volt supply off one of the power supply plugs, and connect 10k resister to the 5 volts and the other end to pin 10 (ack) on your parallel port. Finally your switch would connect to pin 10, and when it switches it would need to drive pin 10 to ground.

Finally use some code from the archives:
ontrol your I/O ports with B3d.
Inpout32.dll for WIN 98/NT/2000/XP

1. get the dll
2. put the dll into your windows system directory
3. create the InpOut32.decls in your userlibs
4. test the sample b3d code shown below
5. party

-enjoy

Parallel Port I/O made easy.

Inpout32.dll for WIN 98/NT/2000/XP
Get binary, source, and other info here:

http://www.logix4u.net/inpout32.htm

-----------------------------------------------
InpOut32.decls:
-----------------------------------------------
.lib "inpout32.dll"

Inp32%( port% )
Out32 ( port%, value% )

-----------------------------------------------
B3d code:

; B3D Parallel Port I/O

Global Lpt1= $378

Graphics 800,600,16,2
SetBuffer BackBuffer()

; Output data
Out32(Lpt1,1)

; Read port status
DebugLog Bin$(Inp32(Lpt1))

While Not KeyHit(1)
Wend

End

Eddy rulez!

What you really need to do this properly is a spinner, like those used in arcade machines. You have several options,... the easiest (and most expensive) is to simply purchase one. You can get something brand new and ready to go for less than $100. These simply plug into a USB or PS2 port and work in addition to a mouse on whichever axis you wish to use.

Here are two companies that sell spinners and interfaces.
www.groovygamegear.com
www.ultimarc.com

The other option is cheaper, but a lot more work. You can hack a mouse to use the sensors from it. (Google "Mouse hack"), but you will still need the wheels and optics from a spinner or trackball, and have to figure out how to mount things. (The mouse replaces the interface in this case)

Beyond those options, I think Sswift had a good idea, but I think that the speed of the wheel would become a problem at some point. (optical mice don't do too well at high speeds.) It should be pretty easy to set that up as a test though.

Hmm, I would have to think that the same technology for an input device would be technology similar to a Wiimote, don't get me wrong. However, having a stationary bike with a motion sensor built in somewhere... Just hack the Wiimote, look over the schematics, and see if you can build that into the bike wheel, and/or pedals. It might be worth the shot. I'd probably build some of that i/r technology into the pedals, as opposed to the wheel, obviously...

EDIT: A brilliant plan, just take the Wiimote, or two, and attach them to the pedals using the wriststraps, then tape them onto the pedals, or hook them, whatever, then program around the Wiimotes, and there you have it.

Well, a friend of mine a while back advocated hall effect blah so I suppose he's with John C.

@WedgeBob, I Love your sig, but obviously just sounds so condescending... maybe? I wish I'd your funding - yeah, modify some Wii remotes in ten years time maybe when you can get them for peanuts (;-(

Personally, I went for the reed switch route on a mobile bike about 5 years ago, the whole thing was quite involved, the software was written in Blitz Basic 2 (On a Amiga 1200). The results were good, once I made up for missing pulses in software.

Anyways, a reedswitch worked for me. I keep meaning to document the hardware/software I built.... one day.

Good luck, go for a reedswitch affair which is interfaced to the (modified) circuitry for the mouseclick. In essence, don't use the wheel, use the click - but short the click out with the reed switch. Good luck.