Table Tennis Bat With Machine Learning AI (Arduino Nano 33 BLE Sense + TensorFlow Micro)

by Samytronix in Circuits > Arduino

9810 Views, 74 Favorites, 0 Comments

Table Tennis Bat With Machine Learning AI (Arduino Nano 33 BLE Sense + TensorFlow Micro)

Here's Why I Made The Smartest Table Tennis Bat with AI
DSC01250.JPG
Screen Shot 2021-07-21 at 1.51.16 am.png
Screen Shot 2021-07-21 at 2.28.37 am.png

Since the pandemic started, me and my housemates bought a Table Tennis table and started playing a lot of Table Tennis. I made this project so that I could monitor and test how well I perform my shots based on what the device is telling me, so that I could improve my game.

I use the Arduino Nano 33 BLE Sense and TensorFlow Micro with the Tiny Motion Trainer "Experiment" developed by Google Creative Labs for this project.

Please watch the YouTube video to watch me build the project and test it in a Table Tennis game!

Supplies

Parts for the project:

Arduino Nano 33 BLE Sense

SparkFun LiPo Charger/Booster - 5V/1A

Battery (LiPo) 3.7V 400mAh

Stranded Wire 26 AWG

TPU Filament

Equipment:

3D printer

Soldering Iron + solder wire

Wire cutter

Mac/Windows/Linux PC

3D Print the .stl Files Using TPU and Glue the Two Parts Together

Screen Shot 2021-07-21 at 2.24.25 am.png
Screen Shot 2021-07-21 at 2.24.11 am.png
Screen Shot 2021-07-21 at 1.36.32 am.png

The 3D model for this build is designed in Fusion 360. This current model only works for the Penhold Grip Table Tennis bat.

Use infill 25% with 6 walls for the print settings.

If the case is too tight or too loose adjust the print size between 97% - 104% depending on how tight or loose.

Mount the Electronic Components

Screen Shot 2021-07-21 at 1.41.30 am.png
Screen Shot 2021-07-21 at 1.36.56 am.png
Screen Shot 2021-07-21 at 1.42.41 am.png
Screen Shot 2021-07-21 at 1.43.04 am.png
Screen Shot 2021-07-21 at 1.43.55 am.png

Apply a double sided tape to the Arduino and Boost Converter and mount it to the case as shown in the picture.

Slide the Lipo Battery to the battery compartment.

Soldering

Screen Shot 2021-07-21 at 1.44.37 am.png
Screen Shot 2021-07-21 at 1.48.05 am.png
Screen Shot 2021-07-21 at 1.49.30 am.png

You can connect the battery to the boost converter with the JST connector or solder it directly to the board. I choose to solder to make the wires shorter and the project more neat.

  1. Cut the battery wires (Please cut it individually!) to 3-4 cm length.
  2. Positive lead from the battery goes to Vinput of the boost converter.
  3. GND lead from the battery goes to GND of the boost converter.
  4. 5V from the boost converter goes to Vin of the Arduino.
  5. GND from the boost converter goes to GND of the Arduino.

If everything is soldered properly, then you should be able to see a blinking LED when you toggle the power-switch on the boost converter.

Plug in the Arduino to Your PC

Screen Shot 2021-07-21 at 1.53.39 am.png

Use a Micro-USB cable to connect your Arduino to your PC and follow the steps in this Github Page:

https://github.com/googlecreativelab/tf4micro-motion-kit

The page will guide you to download the Arduino IDE and install the drivers and libraries necessary for this project.

Use the Tiny Motion Trainer

Screen Shot 2021-07-21 at 1.54.49 am.png
Screen Shot 2021-07-21 at 1.54.27 am.png

After you have uploaded the code to the Arduino:

  1. Launch the Tiny Motion Trainer > Start New Project > Pair your Arduino to your PC via Bluetooth.
  2. Adjust the Capturing Threshold (you want this number high enough not to trigger when you swing back your bat, but also not too high so that you can activate it when performing your shots)
  3. Leave the number of samples as default.
  4. Leave the delay between captures as default.
  5. Go to the "Capture your data" tab on the left.
  6. List all the type of shots you want the device to classify.
  7. Capture 20-100 samples for each type of shots.
  8. Train your model.
  9. Test your model.

Test Your Model and Play Some Table Tennis!

Screen Shot 2021-07-21 at 2.28.37 am.png

Once you are happy with the result of the trained model you can save it so you can open the model anytime you want. Now you can bring your bat to the table and have fun!