The Raspberry Pi 4 as Your Farm Brain — Setup, Power, and What It Actually Runs
A KES 7,500 computer the size of a credit card runs your entire farm IoT setup. Here is what to buy, how to set it up for Kenyan conditions, and what it actu...
The Raspberry Pi 4 as Your Farm Brain — Setup, Power, and What It Actually Runs
The single most useful KES 7,500 you will spend on your farm IoT setup buys you a Raspberry Pi 4. It is the credit-card-sized computer that becomes your farm brain — the one device that ties everything together, runs your dashboards, stores your data, and connects you to the cloud.
This post walks through what to buy, how to set it up properly for Kenyan conditions, and what it actually runs day to day. By the end you should know whether a Pi 4 is right for your farm and what your first weekend with it looks like.
Why a Raspberry Pi and not something else
Three reasons:
- It is a full Linux computer. Anything that runs on a Linux server can run here. There is a huge open-source ecosystem of free dashboards, databases, and integrations to draw from.
- It uses almost no power. 3–5 watts continuous. You can run it for a month on the same energy a 60W bulb uses in two days. It can be solar-powered if needed.
- It is built for permanent operation. No moving parts, no fan, no hard drive. The same Pi runs for years without attention. People sometimes ask if a phone or a small Android tablet could be the brain instead. The answer is no — phones cannot stay reliably on, cannot host the LoRa radio receiver, and cannot run the kind of always-on services your farm needs. The Pi is the right choice for this role.
What to buy — the exact shopping list
| Item | Specification | Where | Cost (KES) |
|---|---|---|---|
| Raspberry Pi 4 board | 4GB RAM version | Nerokas, or Amazon UK | 9,000–11,000 |
| Official Pi 4 PSU | UK Type G plug, 5.1V 3A USB-C | Amazon UK or Nerokas | 1,800–2,500 |
| microSD card | 32GB or 64GB, genuine SanDisk/Samsung | Amazon UK, Nerokas | 1,500–2,500 |
| Pi 4 case with fan | Aluminium passive case ideal | AliExpress | 1,500 |
| UPS (500VA min) | APC, Mercury, or Lyonn | Nairobi Industrial Area | 5,500–8,000 |
| 4G dongle | Safaricom-branded, supports Bands 3/7/20/28 | Safaricom shop | 2,500–4,000 |
| Total | 22,000–30,000 |
A few notes on the choices:
- 4GB is enough, but if the price difference to 8GB is small, take 8GB — future-proof.
- Buy the official PSU. Cheap USB-C chargers cause brownouts that crash the Pi under load. The official Pi 4 PSU is 5.1V (not 5.0V) and 3A, which the Pi specifically needs.
- Buy a genuine microSD card. Half of the SD cards sold on AliExpress are counterfeit and will fail within months. Counterfeit cards are the single biggest cause of "Pi suddenly does not boot" failures.
- A passive aluminium case is enough. The Pi 4 runs warm but rarely throttles in indoor Kenya temperatures. Fans add noise and a failure point. Skip them unless your Pi sits in direct equatorial sun.
First-time setup (one weekend, end to end)
Saturday morning — install the operating system
- Download Raspberry Pi Imager onto your laptop from raspberrypi.com.
- Insert the microSD card into your laptop using a card reader.
- In the Imager, choose "Raspberry Pi OS Lite (64-bit)." Lite, not Desktop — your Pi will be running headless and you do not need the graphical interface.
- Click the gear icon to pre-configure: set a hostname (
farmbrain), a username (farmer), a strong password, your Wi-Fi credentials, and enable SSH. This pre-configuration saves an hour of fiddling later. - Write the image to the card.
Saturday afternoon — first boot
- Insert the microSD card into the Pi, connect the official PSU, and plug into a UPS-protected socket.
- The green LED will blink for about 90 seconds while it boots.
- From your laptop on the same Wi-Fi, open a terminal and run
ssh farmer@farmbrain.local. You should be in. - Run
sudo apt update && sudo apt upgrade -y. This brings the system fully up to date — takes 10–30 minutes depending on internet speed. - Reboot with
sudo reboot.
Sunday morning — install the core services
The exact stack you install depends on your eventual project, but a common starting point is:
- Mosquitto — the messaging broker that field nodes publish readings to
- InfluxDB or SQLite — the database that stores historical readings
- Node-RED — a drag-and-drop tool for connecting sensor data to dashboards, rules, and alerts
- Grafana — the dashboard that visualises your data over time Installation is one-line each (
sudo apt install mosquitto, etc.). The first time you do this, allow 4–6 hours including reading the documentation. The second time it takes 30 minutes.
Sunday afternoon — connect the 4G dongle
The Pi connects to the internet through your Wi-Fi during setup. On the farm, you may not have Wi-Fi, so the 4G dongle takes over.
- Plug the dongle into a USB port.
- Run
lsusbto confirm the system sees it. - Install the Safaricom dongle drivers (
sudo apt install usb-modeswitch wvdial). - Configure the APN (Safaricom uses
safaricomas the APN). - Bring up the connection (
sudo wvdial). Once configured, the Pi automatically falls back to 4G when Wi-Fi is unavailable. This is what lets the farm brain work from anywhere on the farm.
Daily operations — what the Pi actually does
Once running, the Pi works silently. Here is what it does in a typical day:
| Time | Activity |
|---|---|
| Every 5–15 minutes | Receives readings from each field node via LoRa, stores them in the database |
| Every hour | Runs aggregation jobs to compute averages, trends, and alert checks |
| When a rule fires | Sends an alert by WhatsApp/SMS, opens or closes a valve, etc. |
| When you open the dashboard | Renders the current state from the local database (instant, even offline) |
| Once an hour or so | Uploads a small batch of data to the cloud for backup and remote viewing |
| When you ask a question | Reaches out to Claude in the cloud, gets advice, returns it to your phone |
You should rarely need to touch the Pi after setup. A well-configured farm brain runs unattended for months.
Resilience — what makes a Kenyan farm Pi setup reliable
Three pieces matter more than they would in a developed-country setup:
1. UPS
KPLC brownouts in rural Kenya last from seconds to hours. A brownout while the Pi is writing to its microSD card corrupts the card and bricks the system. A 500VA UPS gives you 30–60 minutes of runtime on a clean shutdown.
Wire the UPS to the Pi so that the Pi knows when grid power is lost and can shut itself down gracefully. A USB cable from the UPS to the Pi handles this. Software like apcupsd or nut reads the UPS status.
2. Backups
The microSD card is your single point of failure. Two layers of protection:
- Cloud backup. Once a day, the Pi uploads a compressed copy of its database to cloud storage (Cloudflare R2 or Backblaze B2 — both have free tiers).
- Spare microSD card on hand. Keep a freshly imaged spare card in a drawer. If the active card fails, swap, restore the latest cloud backup, and you are back up in 30 minutes.
3. Heat management
The Pi 4 runs around 50°C when idle, 70°C under heavy load. Kenya's coastal climate or a hot ceiling can push it past 80°C, where it throttles. Keep the Pi:
- Off direct sunlight
- In a well-ventilated room, not a sealed box
- In a metal-cased Pi case for passive heat sinking
- Never above any heat source (fridge compressor, transformer)
Cost over five years
Once you have it set up, the running cost is small. Here is the realistic five-year total cost of ownership:
| Cost item | Year 1 | Years 2–5 |
|---|---|---|
| Hardware (Pi, PSU, case, SD) | KES 14,000 | 0 |
| UPS | KES 7,000 | KES 3,000 (new battery year 3) |
| 4G dongle + SIM | KES 3,000 | 0 |
| Data plan | KES 1,500/mo × 12 = 18,000 | 18,000/yr × 4 = 72,000 |
| microSD card replacement | 0 | 1,500 (year 4, prophylactic) |
| Year subtotal | 42,000 | 76,500 over 4 years |
| Five-year total | ~118,500 |
KES 118,500 over five years, or about KES 24,000 per year. For the entire intelligence layer of your farm.
Common Pi 4 problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Pi keeps rebooting | Brownout, weak PSU | Replace PSU with official 5.1V 3A; check UPS |
| Pi will not boot at all | Corrupted SD card | Reimage SD or use spare card; restore from cloud backup |
| Pi running hot, slow | Inadequate ventilation | Move out of sealed enclosure; clear dust |
| 4G dongle disconnects randomly | Weak signal, poor APN config | Add an external 4G antenna; recheck APN settings |
| Dashboard inaccessible from phone | Pi lost LAN | SSH from local laptop, restart networking |
If you exhaust this list, the next stop is the Raspberry Pi community forums — they are responsive and free.
What to do next
Get the Pi running standalone for a week before you connect a single sensor. Open the dashboard from your phone every day. Get used to logging in. Test the alerts. Confirm the UPS hold-up time. Confirm the 4G dongle reconnects on its own after a power cycle.
Only after the brain is rock-solid do you add the field-node layer.
While you wait, start logging your farm's actual data from your phone at shira.farm. Once your Pi is collecting sensor data too, you will have both — manual records and automatic ones — feeding the same farm history.
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