Train and test machine learning models for your Arduino Nano 33 BLE Sense in the browser.

Overview

Tiny Motion Trainer

Train and test IMU based TFLite models on the Web

Overview

Since 2009, coders have created thousands of experiments using Chrome, Android, AI, WebVR, AR and more. We showcase these projects and a variety of helpful tools and resources to inspire a diverse community of makers to explore, create, and share what’s possible with these technologies.

Tiny Motion Trainer is a part of the TensorFlow Lite for Microcontrollers Experiments, a collection of open source, interactive projects designed to demonstrate some fun ways to combine Arduino and TensorFlow Lite for Microcontrollers.

These projects were built with the Arduino Sense 33 BLE, TensorFlow Lite for Microcontrollers, standard web technologies ( HTML, CSS & Javascript).


Experiment Description

Tiny Motion Trainer lets you train and test machine learning models for your Arduino Nano 33 BLE Sense in the browser. The webpage then provides a TensorFlow Lite for Microcontrollers model and some sample code to get you started on using the model.

Other experiments to explore:


Tools


Install and Run

Flashing: Using the Arduino Nano Sense 33 BLE

  1. Install the Arduino IDE

  2. Setup Arduino board:

  • Plug in the board

  • Install the board by navigating to Tools > Board > Boards Manager and search for Arduino Mbed OS Nano Boards. Full instructions (including drivers required for Windows) here.

  • FAQ for connection problems can be found here.

  • After the board is installed, select it under to Tools > Board > Arduino Mbed OS Nano Boards > Arduino Nano 33 BLE Arduino board

  • Select the port by navigating to Tools -> Port -> dev/cu... (Arduino Nano 33 BLE) Arduino Port

  1. Install Arduino libraries
  • Navigate to Tools > Manage Libraries
  • Search for and install:
  • Arduino_LSM9DS1
  • ArduinoBLE
  • Arduino_TensorFlowLite Manage libraries TensorFlow Lite Library
  1. Open the sketch and flash
  • Download the latest release here

  • Open the arduino/tf4micro-motion-kit and double click on <tf4micro-motion-kit.ino> file

  • Click the Right arrow in the top left corner to build and upload the sketch.
    Arduino Port

  • Warning: This process may take a few minutes. Also, warnings may populate but the upload should still succeed in spite of them.

  • If the sketch is installed, the LED on the board should flash red and green.

  1. Go to the URL related to the experiment. The URL can be found below and play!

Using the TensorFlow Lite for Microcontrollers Challenge Challenge Kit by SparkFun

The board that comes with the TensorFlow Lite for Microcontrollers Challenge Kit by SparkFun comes preflashed with a sketch that will work with some of the experiments right out of the box. If you are using one of the “TensorFlow Lite for Microcontrollers” kits and you just want to jump right into playing with the experiments then you can simply connect your arduino to a power source (USB or Battery) and connect to one of the following experiment URLs:


FAQ & Common Errors

What exactly is being transferred when I “connect”?
When you’re connecting the board to your computer, a pre-trained TensorFlow Lite machine learning model gets transferred over BLE onto the device. The sketches that are uploaded to the Arduino include a common TensorFlow Lite for Microcontrollers model architecture. The different experiment websites change the behavior of the sketch by changing the model to one specifically made for the experience.

What if I’m having issues connecting via bluetooth?
If you are having issues connecting try the following:

  1. Make sure your browser (Chrome or Edge) supports Bluetooth and it is enabled.
  2. Make sure your device (laptop, phone, etc) supports Bluetooth and that it is working and enabled.
  3. Refresh the web page, unplug the Arduino power cable and then plug it back in to reset, then try connecting again.

NOTE: If you’re using a managed device, like a computer from school or work, your device policy may prevent BLE pairing.

My board isn’t showing up on my computer, even though it’s plugged in. What should I do?
Try unplugging the Arduino power cable and then plug it back in to reset. Make sure you see the RGB LED blink red, green, blue in a sequential order.

The model isn’t getting my movements right. What do I do?
The way you move may be different from the data we used to pre-train the model. Different people move differently. That’s why we created Tiny Motion Trainer, which lets you train a custom model based on the way you move.

Do you have plans to support other boards?
We made these projects to work specifically with the Arduino Nano, and we currently don’t have plans to expand support. However, all of the code is open sourced, so you can remix or modify as needed.

Where should I go from here if I want to make my own model or project?
You can create your own model in several different ways. Check out these links:

"What sensors do the experiments use?"
The IMU is a LSM9DS1. It is a 3-axis accelerometer, 3-axis gyroscope and 3-axis magnetometer. This chip, made by ST Microelectronics, is a standard component supported by our library ArduinoLSM9DS1. Read more here: https://www.arduino.cc/en/Guide/NANO33BLESense

How do you shrink a TensorFlow model to fit on a microcontroller?
Post-training quantization is a conversion technique that can reduce model size while also improving CPU and hardware accelerator latency, with little degradation in model accuracy. You can quantize an already-trained float TensorFlow model when you convert it to TensorFlow Lite format using the TensorFlow Lite Converter. Read more here: https://www.tensorflow.org/lite/performance/post_training_quantization


Note

This is not an official Google product, but a collection of experiments that were developed at the Google Creative Lab. This is not a library or code repository that intends to evolve. Instead, it is a snapshot alluding to what’s possible at this moment in time.

We encourage open sourcing projects as a way of learning from each other. Please respect our and other creators’ rights, including copyright and trademark rights when present, when sharing these works and creating derivative work. If you want more info on Google's policy, you can find that here.


You might also like...

Run Keras models in the browser, with GPU support using WebGL

Run Keras models in the browser, with GPU support using WebGL

**This project is no longer active. Please check out TensorFlow.js.** The Keras.js demos still work but is no longer updated. Run Keras models in the

Dec 29, 2022

A WebGL accelerated JavaScript library for training and deploying ML models.

TensorFlow.js TensorFlow.js is an open-source hardware-accelerated JavaScript library for training and deploying machine learning models. ⚠️ We recent

Jan 4, 2023

Fork, customize and deploy your Candy Machine v2 super quickly

Fork, customize and deploy your Candy Machine v2 super quickly

Candy Machine V2 Frontend This is a barebones implementation of Candy Machine V2 frontend, intended for users who want to quickly get started selling

Oct 24, 2022

Support Vector Machine (SVM) library for nodejs

Support Vector Machine (SVM) library for nodejs

node-svm Support Vector Machine (SVM) library for nodejs. Support Vector Machines Wikipedia : Support vector machines are supervised learning models t

Nov 6, 2022

K-nearest neighbors algorithm for supervised learning implemented in javascript

kNear Install npm install knear --save About kNear is a javascript implementation of the k-nearest neighbors algorithm. It is a supervised machine lea

Mar 7, 2022

🤖chat discord bot powered by Deep learning algorithm🧠

✨ Akaya ✨ ❗ Discord integration functionality not implemented yet! Only the deep-learning module working. Install git clone https://github.com/LyeZinh

Jun 23, 2022

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js

face-api.js JavaScript face recognition API for the browser and nodejs implemented on top of tensorflow.js core (tensorflow/tfjs-core) Click me for Li

Jan 2, 2023

architecture-free neural network library for node.js and the browser

architecture-free neural network library for node.js and the browser

Synaptic Important: Synaptic 2.x is in stage of discussion now! Feel free to participate Synaptic is a javascript neural network library for node.js a

Dec 27, 2022

Bayesian bandit implementation for Node and the browser.

#bayesian-bandit.js This is an adaptation of the Bayesian Bandit code from Probabilistic Programming and Bayesian Methods for Hackers, specifically d3

Aug 19, 2022
Comments
  • Current state in topic

    Current state in topic

    Hello, this project is a good starting point for motion trainers. Is there any publication or report you have done for that project? Can you share the current concerns and results for that project please?

    opened by ilhangrn 0
Deep Learning in Javascript. Train Convolutional Neural Networks (or ordinary ones) in your browser.

ConvNetJS ConvNetJS is a Javascript implementation of Neural networks, together with nice browser-based demos. It currently supports: Common Neural Ne

Andrej 10.4k Dec 31, 2022
Unsupervised machine learning with multivariate Gaussian mixture model which supports both offline data and real-time data stream.

Gaussian Mixture Model Unsupervised machine learning with multivariate Gaussian mixture model which supports both offline data and real-time data stre

Luka 26 Oct 7, 2022
Machine learning tools in JavaScript

ml.js - Machine learning tools in JavaScript Introduction This library is a compilation of the tools developed in the mljs organization. It is mainly

ml.js 2.3k Jan 1, 2023
Machine-learning for Node.js

Limdu.js Limdu is a machine-learning framework for Node.js. It supports multi-label classification, online learning, and real-time classification. The

Erel Segal-Halevi 1k Dec 16, 2022
JavaScript Machine Learning Toolkit

The JavaScript Machine Learning Toolkit, or JSMLT, is an open source JavaScript library for education in machine learning.

JSMLT 25 Nov 23, 2022
Friendly machine learning for the web! 🤖

Read our ml5.js Code of Conduct and software licence here! This project is currently in development. Friendly machine learning for the web! ml5.js aim

ml5 5.9k Jan 2, 2023
Machine Learning library for node.js

shaman Machine Learning library for node.js Linear Regression shaman supports both simple linear regression and multiple linear regression. It support

Luc Castera 108 Feb 26, 2021
machinelearn.js is a Machine Learning library written in Typescript

machinelearn.js is a Machine Learning library written in Typescript. It solves Machine Learning problems and teaches users how Machine Learning algorithms work.

machinelearn.js 522 Jan 2, 2023
Automated machine learning for analytics & production

auto_ml Automated machine learning for production and analytics Installation pip install auto_ml Getting started from auto_ml import Predictor from au

Preston Parry 1.6k Dec 26, 2022
A JavaScript deep learning and reinforcement learning library.

neurojs is a JavaScript framework for deep learning in the browser. It mainly focuses on reinforcement learning, but can be used for any neural networ

Jan 4.4k Jan 4, 2023