# simple way to measure wheel spinning speed with Adroid phone + magnet (and maybe Reed Switch)

I'm trying to create the simplest/easyest/cheapest possible way to measure the speed at which a wheel is turning (like a bicycle speedometer) with a smartphone. On the phone the information will be further processed and used as the display of an open-rower-erg project.

This is an open-source project. Although I can program a bit, I need opinions/answers from electrical engineers on the following options I'm considering for this measurement:

1) The simplest I could think of was attaching a small magnet to the wheel and placing the phone close enough to the wheel that the phone's magnetometer could record the magnet passing. Then the phone would process the signal to extract angular velocity. Is this idea feasible (the fact that no other tread mentions this makes me a little skeptical)? Could that magnet, systematically moving on the same direction, damage the phone or drain the battery? How precise can I be with the magnetometer? how fast could I sample it?

2) Another alternative would be to use Reed Switch, probably scraped from a cheap bicycle speedometer, and try to send the signal though the phone directly, either through the micro-usb or the headphone jack. Other treads(tread2, tread3, tread4) suggest using the headphone jack would be better then the micro-usb slot. Is this really an alternative? How could I do that?

3) Others at the open-erg-tread1 suggested an Arduino, with the USB output. What would be the cost of that? This other tread5 suggests a similar idea to my point 1, above, sending information from Arduino to Android via magnetic field and the phones magnetometer.

Any suggestions are welcome, I'm having a difficult time finding good references on google. Thanks in advance

EDIT: adding estimates for the max rotation speed (very rough, coming from imagining an erg, not actually measuring, please correct my numbers if you know better):

x) dive lenght: 1.90m (~6"3')

y) cog circunference: 91mm (= 29mm cog diameter * PI)

z) turns per drive: x/y = 20.8

t) drive time: 0.6s - 0.9s (when rowing fast)

finally:

w) max RPS during drive: from 33.3rps (20.8/0.6) to 25rps (20.8/0.8)

• I think your least platform-dependent bet is going to be something that produces an audible signal keyed to rotation, and detecting that in software. There's been a question here already on circuitry to inject audio into a typical phone's headset connector. – Chris Stratton Oct 31 '14 at 19:35
• Did you mean this question? In another forum someone sugests "You'd have to hack together a little circuit to make a "pip" each revolution and then detect it in your app. I'd make a little oscillator, and have its output triggered by the mag switch, plumbed into a jack. Total cost <\$5". I haven't found a circuit schema or tutorial though. – LucasMation Nov 2 '14 at 22:53
• @LucasMation this is a fantastic question. I came here looking for a way to read RPM's which I think could be translated to other metrics like MPH KPH etc. I remember my Dad using a device on a car engine that flashed in order to read engine cycles. Perhaps you could figure out how to read the camera flash on the phone in the same way. This would be a huge accomplishment. Did you ever find a way to read the speed from a spinning item? – Ben Racicot Oct 27 '16 at 15:13
• Sort of. Assuming the wheel is solid, with holes on the exterior, the easiest may be would to connect LEDs to the headphone "out" wires and place them in one side of the wheel. Then connect a photo sensor to the in-mic. And then use software to analize the signal comming from the MIC. I haven't done it though. The is no external power source, but it would be nice to have someone who knows their electronics evaluate if you risk frying the phone. – LucasMation Oct 29 '16 at 3:55
• Also, my idea of using LEDs + photocell could be simplified by using the phones flash as the light source. Tks for your suggestion that led to that. – LucasMation Oct 29 '16 at 4:31

OK, I am brainstorming a little bit here. I believe the easiest way to get rotational rate is to put something battery powered and blue tooth enabled on the wheel (preferably near the hub) with a 3-axis accelerometer. One or two of the axes will have a nice sinusoidal wave as the wheel rotates. This is an unmistakable signal. You can count time between max or min, or count zero crossings to easily calculate RPM's.

You will have to know the wheel rolling diameter to calculate speed over ground.

The smart sensor on the wheel will transmit data to the smart phone via blue-tooth. Could either transmit raw sensor data, or it could be processed into RPM's and only the end result could be passed to the smart phone.

You can also test it out with two smart phones. Have one act like the sensor, and the other like the display.

Microcontroller measuring a hall effect sensor, a magnet, and a bluetooth module.

Hall effect sensors measure magnetic forces, and are solid state devices. Unlike mechanical relays, they have very high trigger rates. And frankly, this is how professional speed sensing is done. You can figure speed based on Wheel Size and how many times the sensor is triggered in a predefined period of time.

From http://movableparts.org/category/arduino/, which has multiple posts on a similar project.

• tks. I estimate max rpm at 33.3 (edited original post). Do you think that I could connect the hall effect sensor (which is the same thing as a Reed Switch, right?) to the headphone jack and process the signal with the phone? – LucasMation Oct 31 '14 at 17:26
• ops, my mistake the rotation speed it 33.3rps (33.3 in one second). And I realise now a reed switch is 'binary', on off, while hall effect giver a continuous reading of magnetic field changes – LucasMation Nov 1 '14 at 10:46

The magnet and magnetometer idea is very simple and cheap. It might not be fast enough though.

Look at this wireless anemometer for an example of a project that uses it already.

My phone samples its magnetometer at about 10Hz, I'm not sure how much faster you can read it. Worth an experiment.

Don't worry about damaging the phone with a magnet nearby. I wouldn't stick a strong magnet directly to the sensor, but at a few cm distance there will be no effect on anything apart from the sensor.