Go Down

Topic: Rotary Encoder to measure excercise bike pedal direction and speed (Read 137 times) previous topic - next topic


I have a custom hobby project that I want to implement in Virtual Reality using an old excercise bike.

I will be using something like ArdUnity plugin to communicate Arduino and Unity Game Engine software and basically I just want to retrieve 2 values in realtime.

I am looking for a simple and ideal solution to measure the rotational speed and direction of the bike pedals such that I can obtain two variables, those being speed and direction of rotation.

Having looked into Hall effects sensors etc I feel that a rotary encoder might be my simplest option considering direction reads. By attaching a small thumb wheel to the shaft of the encoder which in turn rubs against the center drum of the pedals this gives me data back from the encoder.

My key problem is the code to enumerate the speed and direction and be able to simply get these 2 values as outputs from the Arduino. i.e speed = 10, Direction = +ve or speed = 2 Direction = -ve. The actual value range is irrelevant but ideally something like 1 - 50. These readings can then serve as a variable in my Virtual Reality app with which to use as required in my C# code i.e. Make the bike go faster, or slower.

Does anyone know of a VERY SIMPLE code block that would provide me with the values as required. I do believe this is a very simple challenge to an Arduino tech savvy person. I'm basically a creative artist with many years of IT and engineering skills, so I grasp much of the concept but I'm not a professional in Arduino code and electronics.

The Youtube link is a short vid about a motion controller I made for £40 out of scrap parts and some Arduino components. It was a hobby type challenge ..so it might give you some insight to what I can do for msyelf. I just really need the output code and recommendation for an incremental encoder or whatever others might suggest. PLEASE dont bombard me with a million ideas Im a pragmatic engineer ;-)


Any help really appreciated !!



OK then. I won't bombard you with ideas.

The "Gigs and Collaborations" section is that way ->
"The problem is in the code you didn't post."


A brushed DC motor used as a generator will give both direction and speed with one measurement (voltage and sign).


In the PLC world encoders are commonly driven into specialized modules (high speed counters) to take this burden off of the processor. Above a certain speed the processor will spend so much time servicing the encoder that other functions will suffer.

Just sayin' it's something you might want to consider.


What is the diameter and width of your pedal drum? Can you post a picture or drawing? What maximum RPM of drum?

Go Up