Bicycle Turbo Trainer

Hello. I'm currently creating some cycling rollers (very similar to a turbo trainer), and would like some guidance for the project.

I'm using an IR sensor, OLED screen, and an arduino uno, but also experimenting with the arduino micro. However, I can source more components.

The circuit measures the RPM, taken from a shaft the wheel sits on, and displays this on the screen (code at bottom of post). However, I want to adapt the circuit and code, as well as components to take this measurement of RPM and broadcast it over bluetooth to use with softwares like Zwift, that can interpret it externally; to calculate speed, distance, etc.

How can I accomplish this? What componets will I need? What modification should I make or do you have any suggestions! I would also consider changing the way it measures RPM as it can be quite inaccurate.


#include <Arduino.h>
#include <U8x8lib.h>
#include <SPI.h>
#include <Wire.h>
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);
unsigned long rpmtime;
float rpmfloat;
unsigned int rpm;
bool tooslow = 1;

void setup() {
  TCCR1A = 0;
  TCCR1B = 0;
  TCCR1B |= (1 << CS12); //Prescaler 256
  TIMSK1 |= (1 << TOIE1); //enable timer overflow
  pinMode(2, INPUT);
  attachInterrupt(0, RPM, FALLING);

ISR(TIMER1_OVF_vect) {
  tooslow = 1;

void loop() {
  if (tooslow == 1) {
    u8x8.drawString(1, 0, "SLOW!");
  else {
    rpmfloat = 120 / (rpmtime/ 31250.00);
    rpm = round(rpmfloat);

void RPM () {
  rpmtime = TCNT1;
  TCNT1 = 0;
  tooslow = 0;

Your post was MOVED to its current location as it is more suitable.

How inaccurate is it? Does the inaccuracy vary? How did you measure the accuracy? How accurate do you want it to be?

Can't you just mount a cycle computer on the rear wheel?

No that won't work. I'm creating static rollers/turbo trainer.

The IR sensor measures ok for RPM, but now it will have to measure a spinning tube and it won't be it up that well. Do you have any ideas? And how I can integrate bluetooth to distribute the measured number?

Thank you.

You need to separate the two issues. They are independent.

Your first task is to get reliable rpm readings.
What have you tried to get the IR sensor to work with the spinning tube? What issues do you see?
If the IR sensor can not be made to work with a spinning tube, perhaps you can mount a small magnet and use a hall sensor.

You will need to do some research on the bluetooth side of things to determine the protocol used by Zwift or an alternative.
Be aware, that you may need to use BLE (Bluetooth Low Energy).

Using an Arduino to measure and then transmit rpm data is a common project. The specifics of the measurement and the bluetooth need to be better defined.

If you don't answer my questions, someone else will have to help you.