TinyML ushers in Machine Learning by embedding Artificial Intelligence (AI) into previously unavailable little hardware components. To construct a TinyML project, you should be familiar with machine learning and embedded software development. Having proficiency in both of these skills is extremely rare. Since you probably don’t know much about machine learning or embedded software development, we’ve decided to provide a series of TinyML tutorials to help you learn the ropes. We’ll demonstrate some real-world applications of machine learning on embedded devices, such as basic voice recognition, motion detection with a motion sensor, and people detection with a camera sensor.
Introduction to TinyML
Dedicated integrated circuits, algorithms, and software are all part of tiny machine learning, a rapidly expanding area of machine learning that enables a wide variety of always-on use-cases and targets battery-powered devices by performing on-device sensor (camera / color vision, audio, IMU, biomedical) data analytics at extremely low power, typically in the mW range and below.TinyML investigates the kinds of models that can be executed on small, low-power devices like microcontrollers, and it is a subfield of machine learning and embedded systems research. It provides model inference at the edge with low latency, low power, and minimal bandwidth requirements. In comparison to the 65–85 watts used by a typical consumer central processing unit (CPU) and the 200–500 watts used by a typical consumer graphics processing unit (GPU), the power requirements of a microcontroller are relatively small. This amounts to a reduction in energy use by a factor of 1,000. TinyML devices can execute machine learning applications for weeks, months, or even years on a single battery charge.
Why we need TinyML?
There is a lot of buzz these days about artificial intelligence (AI) cameras, AI washing machines, and AI electronics. Machine learning is utilized in these gadgets to decipher imperfect sensor readings. However, most embedded devices are quite small, and therefore require batteries to function. Machine Learning models require a lot of computing resources, hence it shouldn’t be used to make models for devices that run on batteries. The TinyML is useful for this purpose. TinyML’s neural network models can run on any board with an energy consumption of less than 1mW. It implies that a coin battery-powered device can function for a whole calendar year. Therefore, the device is compact enough to be used anywhere and can function autonomously for a considerable length of time.
TinyML allows machine learning models to be executed on low-power microcontrollers. We’ve tried numerous gadgets, including Raspberry PI and ESP32.Even the smallest Raspberry Pi uses hundreds of milliwatts of power, which is about the same as the primary CPU in a modern smartphone. Keeping one operational for even a few days requires a battery comparable to that of a smartphone, making it difficult to design truly untethered experiences. When looking for hardware platforms, we must enter the world of embedded devices because TinyML is defined as having an energy consumption of less than 1 mW. TinyML will take advantage of low-power devices capable of running ML algorithms.
Hardware for TinyML
Now that you know the fundamentals of TinyML, let’s talk about the computers that can run the models it creates. To put your code to the test, you’ll need a battery and an embedded development board outfitted with sensors like a microphone, accelerometers, or a camera. Ideally, the board would be small enough to incorporate into a usable prototype. Therefore, the Arduino Nano 33 BLE Sense embedded board will be used throughout this series. To learn more about the new features and how to get started with the Arduino Nano 33 BLE Sense, check out our previous article!to get a foothold in the world of Arduino Nano 33 BLE.
Arduino Nano 33 BLE Sense Board
The tiny 45mm by 18mm board can perform AI tasks. The nRF52840 from Nordic Semiconductors is a 32-bit ARM CortexTM-M4 CPU running at 64 MHz, making this a very capable upgrade from the standard Arduino Nano. It will let you develop more complex programs and use many more variables than the Arduino Uno can handle due to its 1MB of program memory. (the RAM is 128 times bigger). Bluetooth pairing through NFC and extremely low power consumption modes are two more impressive capabilities of the main CPU. Built-in sensors include:
- 9 axis inertial sensor: what makes this board ideal for wearable devices
- humidity, and temperature sensor: to get highly accurate measurements of the environmental conditions
- barometric sensor: you could make a simple weather station
- microphone: to capture and analyze sound in real time
- gesture, proximity, light color and light intensity sensor: estimate the room’s luminosity, but also whether someone is moving close to the board
In addition to its impressive array of sensors, this board’s standout feature is its capacity to host Edge Computing applications (AI) using TinyML.Machine learning models can be created in TensorFlow Lite and then uploaded to your board using the Arduino Integrated Development Environment.
Software for TinyML
The TinyML tutorials will use the TensorFlow Lite for Microcontrollers framework for all of their examples. To accommodate embedded devices with only a few tens of kilobytes of memory, this version of the TensorFlow Lite framework has been adapted.
TensorFlow Lite is a lightweight version of TensorFlow designed for use with mobile and embedded devices. To perform classification, regression, and other activities without making a round trip to a server, it enables the execution of machine-learned models on mobile devices with minimal latency. The following describes how TensorFlow Lite diverges from TensorFlow Mobile: The newest mobile version of TensorFlow. In most cases, the performance of TensorFlow Lite apps will be superior to that of TensorFlow mobile apps, and the binary file sizes will be less.
Advantage of Tiny ML
- One of TinyML’s key benefits is its low power consumption. Here, low-power microcontrollers will be used. (less than 1mW). That way, gadgets can keep going for days without needing a recharge.
- It requires very less bandwidth for TinyML project because data does not need to be transferred to the server on a regular basis, less internet bandwidth is consumed.
- TinyML enables the creation of several intelligent sensors and devices. TinyML will find widespread application across many sectors. Some of the sectors that will feel the effects are retail, healthcare, transportation, wellness, agriculture, fitness, and manufacturing. Our phones have the potential to become the edge device that gathers data if we enable data collecting and carefully select the sensors, such as the accelerometer sensor to sample the phone’s movements. This allows it to run sophisticated learning models based on ANN, which can read data from and take samples from low-power microcontrollers and tiny sensors.
Microcontrollers are ubiquitous, and the data they collect from the sensors they’re connected to is staggering. Combining TinyML with these microcontrollers will unleash a plethora of use cases in Internet of Things (IoT) gadgets like televisions, automobiles, coffee makers, watches, and more, giving them the kind of intelligence formerly reserved for personal computers and mobile devices.
This tutorial served as a primer. In the upcoming installments of this series of tutorials, we will create a wide variety of TinyML projects, such as a wake-word detector, a person detector, a magic wand, and many others.Please use the comment section or our forum to ask questions or start a debate about this.