Internet of Things Project 1
Internet of Things Project 1
Internet of Things Project 1
Session-1
Background and Motivation
IoT architecture
Simply, IoT is connecting devices to the internet so their data can be
seen from anywhere in the world. These devices can also be controlled
from anywhere through the internet.
Solving IoT challenges
By running ML models on the embedded devices we can get benefits
such as:
TinyML, What is it?
TinyML is a branch of machine learning and embedded systems
research that looks into the types of models that can be run on small,
low-power devices like microcontrollers.
So tiny, how?
TF Lite for Microcontrollers is a modified version of the TensorFlow Lite
framework that is meant to run on embedded devices with only a few
tens of kilobytes of memory.
It supports Android, IOS, Arduino etc..
Not only Python you can use C, C++ and JAVA Pretrained models
Seed Studio XIAO ESP32S3
Pinout Diagram
Seed Studio XIAO ESP32S3
Camera Module
Seed Studio XIAO ESP32S3
Front View
Seed Studio XIAO ESP32S3
Back View
TinyML Project flow
AIRGLIDE - Gesture-driven
drone simulator
Project - 1
Problem Statement
GND
3.3v
SDA
SCL
Software Setup
• Arduino IDE setup
• Setting up a drone simulation environment
• Visual Studio Code (Latest version)
• Edge Impulse platform setup
Arduino IDE setup
Drivers
➢ Silicon Labs CP210x USB to UART Bridge driver
Software
➢ Arduino IDE – Version (latest)
➢ MPU 6050 by Seeed Studio
➢ Websockets
➢ Esp32 by expressif
Silicon Labs CP210x USB to UART Bridge VCP Drivers
• You need to install drivers for the USB-to-Serial chip on your ESP32 board.
https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads
• Extract the folder
• Open Device Manager and Go to -> Ports
• Connect your esp32 to laptop using micro-USB cable
• It shows a new port, right click on it and select Update Driver
• Browse the driver for extracted folder and click next
3
• After uploading it shows
ESP32 BOARD SUPPORT TO ARDUINO IDE
• Open Arduino IDE.
• Go to File -> Preferences.
• In the "Additional Boards
Manager URLs" field, add this
URL: https://dl.espressif.com/dl/packa
ge_esp32_index.json
Void setup ()
{
pinMode (pin , mode);
}
• Pin- pin number on the Arduino board
• Mode- INPUT/OUTPUT
Arduino Function Libraries
• digitalWrite() : Writes a HIGH or LOW value to a digital pin
• analogRead() : Reads from the analog input pin i.e., voltage applied
across the pin
➢ Edge impulse
○ Nodejs-latest version
○ edge impulse cli
Software Installation Commands (Windows)
• Python - Version 3.7.0 (Install)
• Dronekit - Version 2.9.2
▪ py -3.7 -m pip install dronekit==2.9.2
• Dronekit Sitl - Version 3.3.0 `
▪ py -3.7 -m pip install dronekit-sitl==3.3.0
• Pymavlink - Version 2.4.8
▪ py -3.7 -m pip install pymavlink==2.4.8
• Websocket-client – Version 1.6.1
▪ py -3.7 -m pip install websocket-client==1.6.1
• Mavproxy - Version 1.8.69 (Install)
Simulation Environment setup
● Run dronekit-sitl in command prompt using
○ py -3.7 -m dronekit-sitl copter
(Or)
○ dronekit-sitl copter `
● Open another terminal and run mavproxy map
○ mavproxy.exe --master tcp:127.0.0.1:5760 --out
127.0.0.1:14550 --out 127.0.0.1:14551 --map
MPU6050 Sensor
Calibrating MPU 6050 Sensor
● The MPU6050 can be calibrated using the sketch:
mpu6050-calibration.ino
● Run the code. The following will be displayed on the Serial
Monitor:
● Send any character (in the serial monitor), and the calibration
should start.
● In the end, you will receive the offset values to be used on all
your sketches:
● Write down your offsets so you can set them in your projects.
Training the model
• For training the model, we use Edge Impulse platform.
• Edge Impulse trains machine learning models to be deployed to
your microcontroller or other small, low-powered device. You
then perform inference on those small devices without the
need for an internet connection.
• Create an Edge Impulse account.
• Create new project.
• To connect to XIAO ESP32S3, we need to install
Edge Impulse CLI.
Installation of Edge Impulse CLI
• Install Node.js v18 on
your host computer.
• For Windows users, install
the Additional necessary
Node.js tools when
prompted.
• Install the CLI tools via:
npm install -g edge-impulse-cli --force
• Run the edge impulse data forwarder via:
Edge-impulse-data-forwarder
The data forwarder will ask you for the server you want to
connect to, prompt you to log in, and then configure the device.
● Start the data collection and it collects the data from your
device to train the model.
● Assign labels to the data while data acquisition.
● Create an impulse design.
● Set the timing and frequency for training your model in
the impulse design tab.
● Go through the
parameters in the other
tabs of impulse design
and build features to the
model.
● Start training the model.
● After the model is trained,
Start deployment.
● Go to Deployment and search for Arduino library to select
it.