We will introduce you to an application that displays the results on the basketball court. Based on the interaction between the ball and the rim, the backboard, and the net, you can see made shots versus missed shots on your application screen. The realization of this project idea is performed as part of the subject Internet of Things (IoT). The main purpose of this project is to develop a simple idea into a real product using machine learning on an Arduino Nano 33 BLE Sense and create an application to observe the results. Our project was carried out in several stages:
- Data acquisition
- Training the model with the collected data
- Testing the model
- Exporting the model onto the Arduino device
- Designing and application
- Bluetooth connectivity
The first step in our project was to collect the necessary data, which will enable us to use it as an input to our model. The data was collected using a mobile phone. A total of 137 examples were collected. Furthermore, the data was transferred to the Edge Impulse platform in a simple way, by only connecting the phone directly to the Edge Impulse to build the dataset. The samples taken were then cropped from 20 seconds to 2 seconds. The second step performed on the Edge Impulse platform was creating an impulse, which uses raw data and signal processing to extract features and a learning block to classify new data. As an output, we have three output features: missed, nothing, and score. This classification can be observed on the Feature explorer:
After signal processing and classifying the data, the training of the model was carried out. The training of the model has given us an accuracy of 91.2%:
Model testing on the Edge Impulse resulted in an accuracy of 84.67%:
Following the model training and testing, our next step was to create a library and upload it to the Arduino board.
With the mobile application LightBlue, we test the Bluetooth connectivity. Under Battery Level we select Subscribe to keep track of the displayed values.
Part of the code added to indicate the connection, add service UUID, add battery service and battery level characteristic is shown below:
In the final step, we designed an application using the MIT App Invertor platform, which offers a wide variety of options to display on the screen. One of the crucial parts of creating the application was setting up some buttons in order to connect our Arduino device via Bluetooth. App Inventor is a fast, practical, and visually very well-organized platform where you can observe the changes on the screen at the same time when they are made and easily switch from Designer mode to Blocks Editor View. On the screen, we also added Start and Stop buttons and a field displaying Missed Shots, Made Shots and Total Number of Shots.
The application detects and counts the shots that are scored. However, the missed shots are detected with difficulty as the parentage of detected shots that do not end up with a point is very low. This part may be subject to future improvements.Conclusion
If you are a sports enthusiast and a basketball lover, you can simply download the necessary apps, use an Arduino device, connect to the device using Bluetooth, and test your skills. Using the mobile application, you have your results on the screen so you can further improve them.