T ThinkEdge Learn

Edge AI: Decisions Made on the Device

Edge AI means the decision happens where the sensor is, not on a server across the internet. That changes the latency, the privacy and the failure behaviour, and it is much easier than the marketing makes it sound.

edge ai edge ai devices edge computing ai on device ai
AI and Electronics · The split between what stays local and what does not

Cloud or edge: the trade you are actually making

Every time a device asks a server for an answer it pays for the round trip. A request to a cloud model typically takes a few hundred milliseconds of network time before the first word comes back, and that time is not yours to control, because it depends on someone else's load and the route your data takes. Move the same decision onto the device and the answer arrives in the time it takes your loop to run, which on a 16 MHz Arduino is well under a millisecond.

The other two reasons are privacy and continuity. An edge decision never leaves the room, so nothing has to be stored on someone else's server. And it keeps working when the network does not, which matters in a school where the wifi drops every afternoon at 3 pm. That single failure mode is worth more than the latency saving in most classroom projects.

What actually fits on a microcontroller

An Arduino Uno has 32 KB of flash for the program and 2 KB of RAM for variables, and runs at 16 MHz. That will not hold a language model. It will comfortably hold a threshold, a lookup table, a small decision tree, or a nearest-neighbour classifier with a few dozen reference readings, because all of those are just numbers in an array.

A three-layer network with 16, 8 and 1 inputs has 177 weights, which at one byte each is 177 bytes of flash, so the interesting question is never whether the weights fit. It is whether you can collect good training data, and that is a sensor and a logging problem rather than a computing problem. Put the fast reaction on the board and the slow classification wherever it fits, then decide the split with a number rather than a preference.

Step by step

  1. Measure your loop before you optimise anything

    Print millis() around the loop and know how long a decision takes today. If your loop already runs in under 1 ms, latency is not your problem and moving the model will not fix it.

  2. Write down what must stay local

    Any decision that depends on a sensor reading and a motor command belongs on the device. Anything that turns a few hundred samples into a summary can go to a bigger machine.

  3. Replace a threshold with a tiny classifier

    Log 50 labelled readings, then classify by nearest neighbour instead of a fixed threshold. It costs about 50 times 4 bytes of RAM and handles a two-axis sensor properly.

  4. Add a confidence check

    If the nearest reference is too far away, treat the reading as unknown and fall back to the safe default. This one line is what stops a small model from doing something silly on data it has never seen.

  5. Log the decisions, not just the data

    Print the reading, the label and the confidence over serial so you can find the failures. Most disappointing classifier results turn out to be bad labels rather than bad maths.

  6. Unplug the network and test

    If the project still behaves correctly with the wifi off, the edge split is real. If it needs the network, the decision has not actually moved.

What you'll need

ItemQtyWhy
Arduino Uno R3132 KB of flash, 2 KB of RAM and a 16 MHz clock: the honest limits of an edge device, and a good place to learn them.
ESP32 development board1Dual core at 240 MHz with wifi and Bluetooth built in, so you can keep the cloud option open while you test the local one.
HC-SR04 ultrasonic sensor1A two-axis observation, distance and rate of change, enough to separate an approaching object from one that is passing.
DHT11 temperature and humidity sensor1A slow variable, which makes it the right sensor for comparing a local decision with a cloud one.
LED bar graph module1Shows which class the classifier chose, so the mapping from label to output is visible.
USB cable and jumper wires1 setFor logging training data to a laptop, which is the part of the work students usually underestimate.

Practise it before you build it

Every step above has a matching circuit in the ThinkEdge Learn simulator. The simulator runs a real Arduino sketch against a modified-nodal-analysis solver, so digitalWrite actually drives the LED on screen and the readings change when you change the wiring — no hardware, no burnt components.

Common questions

What is the difference between edge AI and IoT?

IoT describes the connection: a device that talks to the internet. Edge AI describes where the decision is made. A temperature logger that uploads readings every minute is IoT with no AI on it. The same logger that decides on the device to switch on the fan, and reports only the decision, is doing edge AI. One is about the network, the other is about where the thinking happens.

Can an Arduino run AI?

It can run a small classifier, which is AI in the same sense that a thermostat is a controller. An Uno has 32 KB of flash and 2 KB of RAM, so you can store a few hundred reference readings or a few hundred weights, but not a language model. An ESP32 at 240 MHz with 520 KB of SRAM gives you more room and still costs about $12.

Does edge AI actually save money?

Sometimes, and the calculation is worth doing before you argue about it. A Raspberry Pi 5 running continuously at about 8 W uses roughly 5.8 kWh a month, which is under $1 at $0.15 per kWh. A cloud model bills per request instead, and that cost depends entirely on how often your device asks. For a classroom with 30 boards logging every 10 seconds, the difference between asking and not asking is the whole bill.

Related guides

Local LLM: Your Own Model, Your Own MachineRun a language model on your own hardware: the RAM maths for a Raspberry Pi, the real token speeds, and how an Arduino can act on what the model says. What an AI Agent Actually IsAn AI agent is a loop of model calls, tools and memory. Learn how that loop maps onto the sense, decide, act cycle of a robot you can build this term. Physical AI: Intelligence That Has to ActPhysical AI is intelligence that drives a motor, not a cursor. Here is how models, controllers and feedback split up, and how to build the loop safely. ESP32 IoT Projects: From a Single Sensor to a Live DashboardFive ESP32 IoT projects that teach sensors, MQTT publishing, deep sleep and reconnection, each staged so the logic runs in a browser simulator first. Raspberry Pi 5: What Changed Inside and How to Teach With ItThe Raspberry Pi 5 has a faster CPU, a new RP1 I/O chip and a 5 V power supply. What changed, what it costs, and how to use it in a classroom.

Try the full simulator with your class

103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. NCERT Science mapping on 47 projects, with Arabic and English copy in the regional builds.