Making an interactive game with a bicycle


I’m planning to do a project for kids where they can do a game with lights and a bicycle

The idea is simple, there is a bicycle and a vertical truss with 18 light bulbs on it.
The faster you go on the bicycle, the more lights will turn on.

So at a low speed the first light will turn on, if you go faster the next etcetera etcetera.

I'm a bit in doubt how I'll manage to achieve this.
For now my plan is to use an encoder which is connected to a roller where the bicycle sits on.

However, is the arduino capable to measure such quick pulses?
I'm also not 100% sure about the programming.
How can I achieve this?

For the lights I'm thinking to use or a DMX shield and use Pixelbulbs or else I need to use a relay board to switch on each light if conditions met.

I would be really happy to have some tips if the encoder is a good choice and some guidance on the programming how to make something really cool which also works correctly

What is the estimated frequency of the pulses ? Have you considered a different type of sensor, such as Hall effect, and detecting each rotation of the wheel rather than multiple pulses per rotation ?

Well for the frequency I was thinking to use a low as possible, since the wheel is spinning really fast and I don't need that much 'data'. So for my first test-encoder it would be 8 pulses per rotation.

I did considered a 'normal' speed sensor for bicycles, which is a reed contact.
I still am considering this, so if you think that would be better.

I did considered this since it's also really easy for installation.

The encoder will output a fixed number of pulses per 360 degree revolution of the wheel unless you gear it down so saying "8 pulses per second" is meaningless. What is the expected RPM range of the wheel and how many pulses per revolution does the encoder output ?

Yeah sorry, I've edited it already, mistyped it. it's 8 pulses per rotation of course. Sorry!

What about the expected rpm range of the wheel ?

It seems to me that using an encoder is overkill and that a sensor that provides a once per rotation pulse would be plenty good enough

rpm not sure, I would say a maximum of 2000RPM?
(and that's the scroller under the actual bicycle wheel)

But okay understandable, I can do a test with that of course.
I did first thought about an encoder cause of the accuracy and measuring-speed.
But I can make the test with a reedsensor or I also have this Photo Electronic-sensor which are really good.

So for the programming, what is the best approach? Do you have advice?
I was thinking to put a timer after each pulse. If the new pulse is within time then turn on the next light.
The timer get's smaller to make it harder to reach the final light.

I was also thinking to put a delay after a light is turned on to make it even a bit harder (if you sit on the bike and you go directly 30KM/hr would be a bit easy perhaps)

I'm yet not sure how to program this, but first I want to make the plan

If you measure the time for one rotation of the wheel then you can calculate the speed of the perimeter of the wheel. You can use the map() function to derive a number between 0 and 17 from the speed and use that as the index to an array of output pins, each of which controls an LED, and hence control which LEDs are on based on rotational speed of the wheel.

You actually don't need to know the speed and could map() the time per rotation to the array index but speed may be a value that is easy to deal with

Which Arduino board are you intending to use ?

These are a bit spendy, but don't need DMX:

You could also use regular LEDs and make bulb diffusers out of ping pong balls.

Or NeoPixels smart LEDs.


1 Like

I think the Mega.
Was looking into the speedometers to do something like that, to calculate speed