Arduino Nano 33 BLE Sense board with ATSAMD21G18 32-bit Arm Cortex-M4 MCU
Arduino Nano 33 BLE Sense board with ATSAMD21G18 32-bit Arm Cortex-M4 MCU
48 MHz
256 KB
32 KB
LSM6DSOX, LPS22HH, VL53L0X, and ATSAMD21G18 ADC
Bluetooth 5.0 Low Energy (BLE)
Rechargeable battery, USB-C charging port, and power management IC
14 digital I/O pins, 6 analog input pins, I2C, SPI, and UART interfaces
Target Applications
Getting Started
To get started with the Arduino Tiny Machine Learning Kit, follow these steps |
Resources
[www.arduino.cc/en/Maindocumentation](http | //www.arduino.cc/en/Maindocumentation) |
[www.tensorflow.org/lite/micro](http | //www.tensorflow.org/lite/micro) |
[www.utensor.ai](http | //www.utensor.ai) |
CMSIS-NN | [www.keil.com/pack/doc/CMSIS_ NN/html/index.html](http://www.keil.com/pack/doc/CMSIS_NN/html/index.html) |
By leveraging the Arduino Tiny Machine Learning Kit, developers can create innovative IoT projects that integrate machine learning capabilities, enabling a new era of intelligent and autonomous devices.
Arduino Tiny Machine Learning Kit Documentation
Overview
The Arduino Tiny Machine Learning Kit is a compact, low-power, and versatile board designed for machine learning applications. Powered by the TensorFlow Lite Micro framework, this kit enables developers to deploy machine learning models on resource-constrained devices. The kit includes the Arduino Nano 33 BLE Sense board, which features a range of sensors, Wi-Fi, and Bluetooth connectivity.
Hardware Components
Arduino Nano 33 BLE Sense board
Micro-USB cable
JST cables for sensors
Li-Po battery (optional)
Software Components
Arduino IDE (version 1.8 or later)
TensorFlow Lite Micro framework
Arduino Libraries for ML (e.g., `TensorFlowLite_Arduino`, `Arduino_TensorFlowLite`)
Example 1: Simple Image Classification using TensorFlow Lite Micro
This example demonstrates how to use the Arduino Tiny Machine Learning Kit for image classification using the TensorFlow Lite Micro framework.
Hardware Requirements
Arduino Nano 33 BLE Sense board
Camera module (e.g., OV7670)
Software Requirements
Arduino IDE (version 1.8 or later)
TensorFlow Lite Micro framework
`TensorFlowLite_Arduino` library
Code Example
```c
#include <TensorFlowLite_Arduino.h>
// Define the camera module pins
#define CAM_VSYNC 2
#define CAM_HREF 3
#define CAM_PIXEL_CLK 4
#define CAM_SIOD 5
#define CAM_SIOC 6
// Define the model and its labels
const char model = "mobilenet_quant_v1_224.tflite";
const char labels[] = {"cat", "dog", "bird"};
void setup() {
// Initialize the camera module
camera.begin(CAM_VSYNC, CAM_HREF, CAM_PIXEL_CLK, CAM_SIOD, CAM_SIOC);
// Load the machine learning model
tflite::MicroInterpreter interpreter(model);
interpreter.allocateTensors();
}
void loop() {
// Capture an image using the camera module
camera.capture();
// Pre-process the image data
uint8_t imageData[224 224 3];
camera.getImage(imageData);
// Run the machine learning model
TfLiteStatus status = interpreter.invoke();
if (status != kTfLiteOk) {
Serial.println("Error running the model");
return;
}
// Get the output tensor
TfLiteTensor outputTensor = interpreter.outputTensor(0);
// Get the top prediction
int topPrediction = argmax(outputTensor->data.f, 10);
// Print the top prediction
Serial.print("Prediction: ");
Serial.println(labels[topPrediction]);
delay(1000);
}
```
Example 2: Gesture Recognition using Accelerometer Data
This example demonstrates how to use the Arduino Tiny Machine Learning Kit for gesture recognition using the onboard accelerometer data.
Hardware Requirements
Arduino Nano 33 BLE Sense board
Software Requirements
Arduino IDE (version 1.8 or later)
TensorFlow Lite Micro framework
`Arduino_TensorFlowLite` library
Code Example
```c
#include <Arduino_TensorFlowLite.h>
// Define the accelerometer pins
#define ACCEL_X A0
#define ACCEL_Y A1
#define ACCEL_Z A2
// Define the machine learning model
const char model = "gesture_recognition.tflite";
const char labels[] = {"up", "down", "left", "right", "none"};
void setup() {
// Initialize the accelerometer
pinMode(ACCEL_X, INPUT);
pinMode(ACCEL_Y, INPUT);
pinMode(ACCEL_Z, INPUT);
// Load the machine learning model
tflite::MicroInterpreter interpreter(model);
interpreter.allocateTensors();
}
void loop() {
// Read the accelerometer data
int x = analogRead(ACCEL_X);
int y = analogRead(ACCEL_Y);
int z = analogRead(ACCEL_Z);
// Pre-process the accelerometer data
float accelData[3] = {x, y, z};
// Run the machine learning model
TfLiteStatus status = interpreter.invoke();
if (status != kTfLiteOk) {
Serial.println("Error running the model");
return;
}
// Get the output tensor
TfLiteTensor outputTensor = interpreter.outputTensor(0);
// Get the top prediction
int topPrediction = argmax(outputTensor->data.f, 5);
// Print the top prediction
Serial.print("Gesture: ");
Serial.println(labels[topPrediction]);
delay(100);
}
```
Additional Resources
[TensorFlow Lite Micro framework documentation](https://www.tensorflow.org/lite/microcontrollers)
[Arduino Tiny Machine Learning Kit tutorials](https://docs.arduino.cc/tutorials/tiny-ml-kit)
[Arduino ML libraries](https://docs.arduino.cc/libraries/)
Note: The code examples provided are simplified and might require additional modifications to work with your specific setup. Make sure to follow the official documentation and tutorials for more detailed instructions.