Teaching an Arduino Uno to guess room occupancy – can it learn on its own or do I need my data out first?
Facility manager at a 90-room hotel, I’m not a programmer but I’ve been tinkering. We have small boards in 12 rooms (Arduino Uno + an ESP-01 for Wi-Fi, SCD40 CO2 sensor, a PIR) sending CO2, temperature and motion to Hermetry every 2 minutes.
A vendor pitched us “AI on the edge that learns when rooms are occupied” for a lot of money. I thought, could I just train a small neural network on the Uno itself so it learns by itself? Housekeeping would love to know which rooms are really empty. Is this crazy? Where would I even start?
Training on an Uno: crazy, yes. 2 KB of RAM. Running a tiny model that was trained somewhere else: very doable.
Why is training so much worse than running it? Isn’t it the same maths?
Training needs every weight, its gradient and a pile of example data in memory at once, many passes. Inference is one pass, multiply and add, and the weights can sit in flash.
So the real first step is a dataset. You already have weeks of readings in Hermetry, you just need labels: housekeeping’s check-in/check-out times would do.
Megan’s right. What I’d do:
1. Keep sending co2, temperature and motion as numbers (motion as 0/1, not true/false, so it has a history).
2. Pull the raw data out with the history API, one day per call is comfortable:
curl -s -H "Authorization: Bearer $KEY" "https://$HOST/tenant/$TENANT/api/telemetry/series?kind=iot_device&entityId=$ROOM&keys=co2,temperature,motion&from=$FROM&to=$TO&bucket=raw"
If a key comes back with 10,000 points, ask again from the last ts + 1.
3. Join it with the front desk export on a laptop, train a logistic regression or a 3-input, 8-neuron net in Python. That is plenty for CO2 slope + motion count.
4. Quantise the weights to int8, paste them as a const int8_t w[] PROGMEM array, and the Uno only runs the forward pass. Send the result as occupied_p (0-100) alongside the other keys.
Honestly, for occupancy the CO2 rise over 20 minutes plus “any motion in the last 30 min” gets you most of the way before any neural net. Start with that as a baseline so you know if the model is worth it. API side is here: The history API.
If you script that export, give the API key the Read-only preset and restrict it to your laptop’s network. Seen too many full-admin keys in Python notebooks.
Update after two weeks: my nephew helped with the Python part. The simple rule (CO2 rising + motion in last 30 min) was right 87% of the time against the front desk log, the tiny model 91%. It runs on the Uno, 24 weights. We’re not buying the vendor thing. And yes, I made a Read-only key like Brian said, my first one was an admin key…
- You must be logged in to reply to this topic.
Join the conversation
Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

