Introduction: Smart Training Room for Cyclists

About: student MCT at Howest (Kortrijk Belgium)

As a cyclist I know how frustrating it can be to train inside on
your rollers. It often gets too hot inside and it's pretty boring.

So, I wanted to make a room that gives my indoor training a better experience.

There were a few things I really wanted for this room:

  • Good security (for the room and my bike) with RFID or password
  • Automatic cooling system
  • Speed monitoring
  • Heartrate monitoring

With these things my training experience will be less boring and less hot.

*The code for this project is in English but the documentation is in Dutch!


For this project you definitely will need a Raspberry PI, Arduino and breadboard.

Step 1: Get the Supplies

First of all you will need a lot of equiment to start. You can find all items in this Excel file!

Here you can see some pictures of the components I have used!

Step 2: Soldering the Components

Soldering the components at the start will prevent you from struggeling in the future. If all cables are long enough from the start you won't have problems with placing the circuit in it's housing.

Maken sure that the cables are long enough for these components (approximately 20cm for each cable):

  • Temperature sensor
  • Lights
  • DC motor
  • Buzzer
  • RFID scanner
  • LCD display

Some tips to do the soldering fast and good:

  • Make sure your soldering iron is hot enough
  • Dismantle the cables sufficiently
  • Use the right solder for your type of cable
  • Finish with heat shrink tubing

Step 3: Make the Circuit

Here is the fritzing scheme of my circuit, I also included the electric scheme with some more details.

Make sure you use the same pins as on the breadboard scheme, otherwise you will have to adapt the code!

As you can see, I used an extra source (batteries), this is not necessarily necessary as long you can provide approximately 5 volts. I used this source because there can be some issues with the LCD display.

Step 4: Download the Code From Github

You can download all my code (front and backend) from my Github. Feel free to adapt the code to your preferences.

Link to my Github:

You can place the backend code where you want on your Raspberry Pi but make sure the html folder is placed on this path /var/www/.

Download packages

You will have to install some packages to make the code work.

1. Go to the folder "project1"

2. Execute the following commands:

  • pip3 install mysql-connector-python
  • pip3 install flask-socketio
  • pip3 install flask-cors
  • pip3 install gevent
  • pip3 install gevent-websocket

Heartrate sensor

The code for the Arduino (used for the heartrate sensor) is placed below the backend folder! I used a library for this and adapted it to my own needs, you don't need to change or download anything. Just upload it to your Arduino. Library:

RFID library

For the RFID scanner I have used a library. This link will help you to install the library: (I used GPIO pin 12 instead of GPIO pin 25 for the RST pin, don't forget to edit this in the MFRC522 file. SEE PICTURE).

One wire bus

I also recommend to activate the one wire bus in raspi-config! Otherwise the temperature can't be measured. (

Step 5: Create the Database

You will need this MySQL database on your Raspberry Pi, I used Maria DB as database management system on my Raspberry Pi (

I created my database scheme with MySQL Workbench ( This software is easy to use on your pc and you can work remote over a SSH connection with it. I also included my MySQL script with database structure and test data so you can test the code.

This link can help you:

Step 6: Test the Circuit With the Code From Github

This is a really important step in the process. Now you will connect the hardware to the software. Make sure all power supplies are plugged in!

To start the program you will need to run on your Raspberry Pi with python 3, this is the file that connects the front- and backend. You can reach the site in your browser via the IP adress displayed on your LCD display.

Login with ID 1 and password "test", these are test values! Make sure you use other credentials for a better security. You can do this in MySQL workbench in the table 'users'.

After this you can set the file as a service so the code starts after every boot. This is a link that will show you how:

Step 7: Saw the Parts for the Housing

When hardware and software are connected and work with eachother you can start making the housing.

The main material I used for this is OSB wood. I included the design of my own construction with all the dimensions. To saw the OSB plates you can go to a sawmill or do it your own, a sawing machine can help you a lot.

Step 8: Paint the Housing

You can paint the housing how you want. If you do, do it before you place the circuit into your housing! This will make it a lot easier to paint! (I did the painting afterwards and that was not really handy).

I used water-based paint, this is perfect for this type of wood and it dries quickly.

Step 9: Connect the Parts of the Housing

I recommend to drill the holes for the components before you connect the parts. Also before you connect the parts, place the electronic magnet and light switch on the right place, this makes it easier at the end.

Don't use too wide or long screws otherwise the wood will split!

Step 10: Place the Circuit in It's Housing

With the soldered cables this will be an easy job. Make sure you are safe with the circuit!

After placing the circuit in it's housing check the circuit, loose cabels can and will cause problems!

I recommend to connect the components to the housing, this will make it safer and stable.

Step 11: Enjoy Your Own Training Room and Platform!

Now you can make indoor rides without getting overheated and it will be less boring!