element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino Projects
  • Products
  • Arduino
  • Arduino Projects
  • More
  • Cancel
Arduino Projects
Blog Predicting the F1 Champion with TinyML.Collecting and analyzing data to predict which F1 car will finish the race first.
  • Blog
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Leonardo113
  • Date Created: 29 May 2022 9:26 PM Date Created
  • Views 1553 views
  • Likes 4 likes
  • Comments 1 comment
  • project
  • arduino_projects
  • machine learning
  • automotive
  • arduino
Related
Recommended

Predicting the F1 Champion with TinyML.Collecting and analyzing data to predict which F1 car will finish the race first.

Leonardo113
Leonardo113
29 May 2022

I've always been fascinated by Formula One and how fast cars race around the track. Since my other big interest is experimenting with machine learning, I came up with an idea to combine these two passions and create a project dedicated to vehicle speed prediction.

Of course, I don't have the opportunity to conduct such experiments on a real track and with real racing cars, so I decided to predict which F1 car is faster based on accelerometer and gyroscope sensors fixed on a miniature F1 car!

This is a simplified example of what tiny machine learning can do in motorsport. But since F1 utilizes innovative technologies, I believe the approach described in this article can be scaled to make predictions and help real teams in the world championships.

Procedures

My experiment includes the following three steps:

  • Collecting the data for a dataset
  • Training a TinyML model
  • Deploying the model on a microcontroller

Next, I will describe all three stages of the experiment in more detail so that you have the opportunity to repeat them.

Collecting the data

To create a good dataset, I perform measurements by placing an MCU on a car and moving it at a different speed. The firmware makes readings on the accelerometer and gyroscope sensors to collect the data. It reads 2 seconds of data and calculates the statistics of those readings values. After that, it prints the statistics in CSV format to upload to the Neuton platform.

As the first step, you need to upload the firmware to Arduino Nano 33 BLE Sense. It comes with a series of embedded sensors:

  • 9 axis inertial sensor (I used it to detect the car movement behavior)
  • humidity and temperature sensor
  • barometric sensor
  • microphone
  • gesture, proximity, light color, and light intensity sensor

Find the repository with the complete code here: https://github.com/leoribg/neuton-f1-data-collect.

Secondly, you need to make the movements for each target you want to identify.

My targets:

0: Car Idle (Car is stopped)

1: Ferrari F1 Car (Speedy)

2: HAAS F1 Car (Kinda fast)

3: Williams F1 Car (Slow)

image. 

Training the model

Upon the dataset collection, you are ready to train your model. For that purpose, I used the Neuton platform, as it’s free.

Upload your dataset in a CSV format and click OK.

image

Select the target variable and click "Next".

image

This project detects one of four possible targets, so it is a multiclassification problem. Neuton can automatically detect a task type based on the target variable values. You need to select the best metric to represent the model quality, for this type of problem, I selected “Accuracy” and also enabled the TinyML mode.

Click “Start Training” and relax until the model training is complete.

image

One more cool thing about Neuton is that the platform makes it possible to evaluate the quality of the trained models. You can check the meaning of each metric here: https://lab.neuton.ai/#/support_library/metrics/.

Here is the model that I got:


image

I got 100% model accuracy, but I was curious about whether I got the smallest size of the model. To check this, I decided to build the model on TensorFlow Light. Actually, I asked a friend to help me, as it requires special coding skills and time, but after a day of work, I realized that my first model, which was automatically created with Neuton, was 4 times smaller. I decided not to embed the TFL model, but I am sharing with you the comparison of metrics.

image

Deploying on a microcontroller

Neuton automatically generates the C library after clicking on the “Download” button.

image

Once the library is downloaded, It’s time to run the inference on a microcontroller.

You need to set the input for your model with the same format you have trained it.


All the code necessary to run this model is available here: https://github.com/leoribg/neuton-f1-model.

Testing your model

Connect your board to a PC with a USB cable and connect it to serial monitor software, like Putty, Docklight, or TeraTerm, to check the inference results.

Formula One is a competition among the best drivers in the world, but also is a battle between the engineers. During a Grand Prix, every car is equipped with hundreds of sensors generating massive quantities of real-time data. This data can be combined with historical data to train machine learning models to help the teams make the best decisions and predictions.

As this sport embraces new technologies, I’m convinced that machine learning has great potential for use by F1 engineering teams, giving them new insights into racing and car development. Plus, implementing such solutions is really quick and easy (I proved it in my project!). I hope my tutorial will inspire you to repeat this experiment or create your own TinyML projects!





  • Sign in to reply
  • Leonardo113
    Leonardo113 over 3 years ago

    Hey everyone!
    I hope you’ll enjoy the experiment anyway.
    Link for the full project: www.hackster.io/.../predicting-the-f1-champion-with-tinyml-c51b99

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube