Magic Wand!!!

by explorer12 in Circuits > Arduino

2371 Views, 1 Favorites, 0 Comments

Magic Wand!!!

VideoCapture_20210325-161636.jpg

TensorFlow on Microcontrollers

The Arduino is turned into a digital "magic wand" by the user to wave and cast a variety of spells. As the user moves the wand, this complex, multidimensional sensor data that would be inscrutable to a human, is passed as an input to the model, which outputs a simple classification that alerts us if one of several movements has occurred.

However, it's now possible to run machine learning inference on tiny, low-powered hardware, like microcontrollers. By bringing machine learning to tiny microcontrollers, we can boost the intelligence of billions of devices that we use in our lives, without relying on expensive hardware or reliable internet connections.

TensorFlow Lite For Microcontrollers is a software framework, an optimized version of TensorFlow, targeted to run tensorflow models on tiny, low-powered hardware such as microcontrollers. It adheres to constraints required in these embedded environments, i.e, it has a small binary size, it doesn't require operating system support, any standard C or C++ libraries, or dynamic memory allocation, etc.

Arduino Nano 33 BLE (Hardware),

is a microcontroller-based platform: a tiny computer on a single circuit board. It has a processor, memory, and I/O hardware that allows it to send and receive digital signals to other devices. Unlike a computer, a microcontroller is not powerful and doesn't usually run an operating system. Instead, they have small processors, not much memory and the programs you write run directly on the hardware. But because they are designed to be as simple as possible, a microcontroller can use very little energy.

Host : CPU or Raspberry Pi

Setup the Arduino IDE

1. Download the Arduino IDE

2. Setup the Board Manager
From the Arduino menu, select Tools -> Board: "Arduino .." —> Boards ManagerSearch for "Arduino Nano 33 BLE" and install the Arduino nRF528x Boards (Mbed OS). This will ensure that our Arduino Nano 33 BLE Microcontroller is supported by the Arduino IDE

From the Arduino menu, select Tools -> Board: "Arduino .." -> "Arduino Nano 33 BLE"

Finally, verify that your selected board is "Arduino Nano 33 BLE" at the bottom right of the IDE.

3. Setup the Port

From the Arduino menu, select Tools -> Port: "/.../" -> /dev/... (Arduino Nano 33 BLE).

Install Libraries

1. TensorFlow Arduino Library

This library contains all the TensorFlow Lite for Microcontroller examples, which includes the magic wand source code required.

Download the TensorFlow Arduino Library From the Arduino menu,

select Sketch -> Include Library -> Add .ZIP Library...Add the TensorFlow Arduino Library .zip you downloaded.

2. LSM9DS1 Arduino Library This library allows you to read the accelerometer, magnetometer and gyroscope values from the LSM9DS1 IMU on your Arduino Nano 33 BLE Sense.

From the Arduino menu, select Sketch -> Include -> Manage Libraries...Search and Install "Arduino_LSM9DS1".

Load and Build the Example

1. Load the magic wand source code

From the Arduino menu, select File -> Examples -> Arduino_TensorFlowLite -> magic_wand to load the sample code.

This will load the magic wand source code.

Make the required changes.

2. Build the example Click the Upload button in the sketch window.

Demo

Magic Wand!!!