Monday on the farm — Jumatatu ya kupanga: Plan your week and check your numbers. Learn more ↗
Back to blog
· 8 min read

The Three-Layer Farm IoT System — How Sensors, Brain, and Phone Talk to Each Other

Every working farm IoT setup in Kenya is built the same way — field nodes, a farm brain, and your phone. Here is what each layer does and how they connect.

Share:

The Three-Layer Farm IoT System — How Sensors, Brain, and Phone Talk to Each Other

Whether your farm IoT setup costs KES 80,000 or KES 800,000, it has the same three layers. The hardware in each layer can change. The roles cannot. Understanding the three layers is the single most useful piece of knowledge before you spend any money — because every shopping decision, every wiring choice, and every failure-mode you will hit later maps back to one of them.

This post is the architectural foundation for the rest of this series. It is the one to come back to when something is not working and you are trying to figure out where the problem sits.

Layer 1 — Field nodes (the sensors out there)

A field node is a small, battery-powered, weather-resistant box. It sits in your soil, on a cow, on a water tank, or inside a feed silo. Its only job is to take measurements and send them.

What it contains:

  • A small computer the size of a matchbox — usually an ESP32 microcontroller
  • The sensor itself (soil probe, temperature sensor, accelerometer, etc.)
  • A small radio module to transmit the readings
  • A rechargeable lithium battery (an 18650 cell)
  • A small solar panel to keep the battery charged

What it does:

  • Wakes up every 10–60 minutes
  • Takes a reading from the sensor
  • Sends that reading over the radio
  • Goes back to sleep to save power

What it does NOT do:

  • It does not have a SIM card
  • It does not connect directly to the internet
  • It does not store more than a few hours of history
  • It does not make decisions

That last point is crucial. Field nodes are deliberately stupid. They measure and transmit. Nothing more. This is what makes them so cheap (KES 1,500–4,000 each) and so reliable. A field node can run on solar power for years with no maintenance.

How big is the radio range? The radio used in most farm setups is called LoRa — "Long Range." It can transmit a few bytes of data several kilometres with very little power. On a flat farm with good antenna placement, 5 km is realistic. With trees, hills, or buildings in the way, 1–2 km is more honest. That is enough for almost any single Kenyan farm.

Layer 2 — The farm brain (one Raspberry Pi at the homestead)

The farm brain is the only piece that stays plugged in. Everything else in your setup is battery-powered and remote. The brain sits in your house, your shed, or your barn — wherever you have a reliable plug and a roof.

What it is:

  • A Raspberry Pi 4 — a credit-card-sized Linux computer
  • Connected to mains power via a UPS so brownouts cannot kill it
  • Connected to the internet via a Safaricom 4G dongle (or Wi-Fi, if you have it)
  • Connected to your field nodes by a LoRa radio that receives all their transmissions

What it does:

  • Collects every reading from every field node
  • Stores them in a small local database, so years of history fit on a microSD card
  • Runs the rules (open valve when moisture is low; raise alert when cow temperature is high)
  • Connects to the internet only when needed — to send you alerts and to ask Claude for advice
  • Hosts the dashboard you view from your phone

What makes it the brain: The Pi is where intelligence lives. Rules like "open Zone 1 irrigation if soil moisture is below 25% AND there is no rain forecast in 48 hours" run here. The Pi can run those rules even if your internet goes down — your farm keeps working.

When something more complex is needed — interpret a photo of a sick leaf, draft a response to a Swahili voice message, predict tomorrow's milk yield from this week's pattern — the Pi reaches out to an AI in the cloud (we use Claude). The Pi sends a small summary up, gets an answer back, and then keeps running locally.

Why a Raspberry Pi and not a phone or a PC?

  • A phone cannot stay on permanently and cannot host the LoRa receiver
  • A normal PC uses 50–80W constantly — your power bill alone would be KES 1,500/month
  • A Pi uses 3–5W continuously — KES 100/month, runs on solar if needed
  • A Pi has no moving parts, no fan, no spinning hard drive — nothing to break

Layer 3 — Your access (phone, laptop, WhatsApp)

This is the layer you interact with. It is not "on" the farm — it is anywhere you are.

What it includes:

  • The dashboard on your phone web browser (no app to install)
  • Push notifications or WhatsApp alerts when something needs attention
  • SMS as a backup channel when 4G coverage is patchy
  • Voice replies (call a number, ask a question in Swahili, get a spoken answer)

What you should be able to do from this layer:

  • Look at any sensor reading from anywhere in the world
  • See trends over the past day, week, month, season
  • Override any automated rule (manually open a valve, silence an alert)
  • Add new rules or change thresholds
  • Ask a question in plain language ("how much water did Zone 2 get this week?")

One important rule: every action you can take from your phone must also be takeable from the field. If a valve needs to open and your phone is dead, there must be a physical button somewhere on the controller box. IoT should add convenience, not remove fallback.

How the layers talk — the four communication links

There are four communication paths in the system. Each one has different requirements and different failure modes.

LinkFrom → ToTechnologyRangeWhat breaks it
Field nodes → Farm brainSensor in soil/cow → Pi at homesteadLoRa radio (EU868 band)1–5 kmTrees, hills, weather, dead battery
Farm brain → InternetPi → cloud (Claude, dashboard)4G via Safaricom dongle, or Wi-FiNationalKPLC outage, network outage
Internet → Your phoneCloud → your WhatsApp / webStandard internetAnywherePhone offline, data run out
Field button → Field nodePhysical overrideWiresDirectWiring damage, water ingress

When something fails, the question to ask is always "which link is down?" If you stop getting readings from Sensor 3 only — the LoRa link is suspect. If you stop getting alerts but the dashboard still shows fresh data — the alerting service is down, not your farm.

Why this architecture works in Kenya specifically

Three things about the Kenyan context shape this design:

  • Power is unreliable. KPLC brownouts mean only the farm brain can be reliably mains-powered, and even it needs a UPS. Every other component must be battery + solar.
  • Internet is patchy in rural areas. The farm brain must function offline for hours or days. Rules must run on the Pi, not in the cloud. Cloud is for advice and reporting, not for keeping the farm alive.
  • Mobile data costs matter. Sending every raw sensor reading to the cloud would cost KES 10,000+ per month. Sending one summary per hour costs KES 50 per month. The Pi compresses and batches everything. This is why farmers who try to copy a US or European farm IoT setup directly in Kenya fail — those designs assume always-on power and unmetered fibre internet. The three-layer architecture is built for the Kenyan reality: solar where needed, mainly offline operation, cloud only when the data is worth the airtime.

Common mistakes to avoid

  • Putting the brain in the field. People sometimes put the Pi in a barn far from the house "near the sensors." The Pi needs steady mains power, a UPS, and reliable cellular signal. Keep it at the homestead.
  • Skipping the UPS. A 1-minute KPLC interruption corrupts the Pi's microSD card. A KES 6,000 UPS prevents this and protects everything else.
  • Picking the wrong LoRa frequency. Buy EU868 hardware only. US915 hardware is illegal on Kenyan frequencies and your sensors will not reach the brain.
  • Trying to do everything in the cloud. If you need internet to open a valve, you have built the wrong system. Rules belong on the Pi.
  • Forgetting the field override button. Every automated actuator (valve, fan, motor) needs a physical override that works without any IoT.

What to do next

If you are about to start building, here is the order:

  • Set up the farm brain first. Get the Raspberry Pi running, with a UPS, with a 4G dongle, with the dashboard open on your phone. Get this stable for a week before you wire any sensors.
  • Build one field node on a workbench at the house. Test the LoRa link end-to-end indoors. Confirm the brain receives readings reliably.
  • Only then put the field node outdoors, at its real installation site.
  • Add field nodes one at a time. Confirm each works before adding the next. This sequence saves weeks of debugging. The most painful failures happen when you wire everything at once and then cannot tell which layer is broken.

If you want to begin collecting the kind of data that IoT eventually automates — milk yield, feed consumption, animal health, cash flow — start now from your phone at shira.farm. When the sensors arrive, the dashboard already has a year of context to compare against.

See it in action

Tap this exact setup on our interactive visual guide — photorealistic farm scenes with clickable explainers showing what every device does, what it costs, and which Shira tier unlocks it.

Open the IoT Showcase