Farmers IoT Toolkit
A phone held up in the field showing the farm dashboard — two soil cards reading 27.2% and 25.5%, and the master valve showing CLOSED — with the pineapple rows behind.

4 Module 4 · Beginner · 1–2 hours

Mobile WiFi Base Station

An old Android phone becomes the brain: it makes the WiFi network your sensors join, runs Node-RED to collect the readings, and uses its own 4G to get them to you anywhere.

An Android phone running Termux, Node.js and Node-RED: it makes the farm's network, receives live readings from every field node, and pushes them out over 4G to a small cloud service you control.

Parts
$19
Build time
1–2 hours
Steps
6
Board
Android phone

Why you would want this

  • Gives every sensor a network to talk to, even with no router for miles
  • All your readings in one place, on a dashboard
  • Uses a phone you probably already own — close to free
  • No computer needed to see your data

How it goes together

An Android phone running a Termux terminal session, captioned: receives all ESP8266 data via WiFi hotspot and sends it to the internet via 4G.
There is no wiring in this module beyond a USB cable — the connections are network ones. The phone's hotspot is the farm's network, Termux gives it a Linux shell, and Node-RED is what turns arriving JSON into a dashboard and an irrigation decision.

What you will need

Bill of materials for Mobile WiFi Base Station
PicturePartWhat it doesNZ$Link
Android phone, v7 or newer Android phone, v7 or newer

An old phone you already own is the intended answer. Ours is an OPPO A3 4G (CPH2669).

Runs the WiFi hotspot and Node-RED — the brain $0Zero because the intended answer is a phone you already own. A new OPPO A40 4G is about $249.
SIM with a data plan Backhaul to the internet ~$8.50
USB cable Powers the ESP8266 and loads code onto it $10Bought as a lot of ten for $100.
Approximate total $18.50

Prices are NZD, read off the linked listing on 2026-08-08. A figure marked ~ is an estimate — we have no listing for that part yet, so treat it as a placeholder rather than a quote. Prices move, and shipping to a small island is its own line item. Links are not affiliate links and we get nothing if you use them.

Wiring

What the phone answers

There is no wiring here beyond a USB cable — the interesting connections are network ones. These are the endpoints Node-RED serves once you import the bundled flow.

MethodPathPayload
uplink POST /water {node, ok, raw, depth_mm, valve, valve_open_s, rssi, uptime_s}
uplink POST /soil {node, ok, moisture_pct, temp_c, ec, rssi, uptime_s}
downlink GET (poll, 1 s) /valve "1" / "0"
page GET /page live readings, one card per node
page POST /valve/set sets flow.valveCmd

Powering it in the field

On mains, plug it in and forget it. On solar it is the opposite: a plugged-in phone can never enter Android's Doze, so it runs at its awake floor forever and can outrun a 20 W panel on its own. Switch the charger, not the phone — and charging must be the default state, because if the phone is flat and the charger is off, nothing is left to turn it back on.

Build it, step by step

  1. Turn on the WiFi hotspot

    Settings → Network → Hotspot. Give it a name (ours is FarmIoT) and a password, and write the password down — your sensor nodes need it.

  2. Install Termux — from F-Droid, not the Play Store

    Termux is a Linux terminal that runs on Android, and it is how Node-RED runs on a phone. Install F-Droid, then search it for Termux.

  3. Install Node.js and Node-RED inside Termux

    Type these one at a time. The first two take a few minutes each.

    pkg update && pkg upgrade -y
    pkg install -y nodejs
    npm install -g --unsafe-perm node-red
    node-red
  4. Import the ready-made flow and test it with curl

    In the Node-RED editor: ☰ → Import, paste flows/water-level-flow.json, Import, Deploy. You now have an endpoint at /water. Test it before any hardware is involved — open the debug sidebar and watch the message arrive.

    curl -X POST http://<phone-ip>:1880/water \
      -H 'Content-Type: application/json' \
      -d '{"node":"test","ok":true,"depth_mm":500}'
  5. Point a sensor at it

    In the node's config.h you only need three things — and an IP address is not one of them.

    #define BENCH_MODE 0                    // was 1 for bring-up
    #define WIFI_SSID  "FarmIoT"
    #define WIFI_PASSWORD "your-hotspot-password"
  6. See your farm from anywhere — push out, don't expose in

    The phone has 4G, so it can reach the internet — but the internet cannot reach it. Carriers put phones behind CGNAT: your phone shares one public address with thousands of others, so there is no port to forward and no address to type. Everything you read about port-forwarding assumes a home broadband line and does not apply here.

    So the phone dials out. Node-RED buffers every reading and POSTs it in batches to a small service you control (server/, ours runs at farm.sunriselabs.io). Nothing on the farm is ever exposed, it works on any carrier with zero configuration, and it survives dropouts because the phone keeps a backlog and re-sends. On a metered SIM it costs about 60 requests a day.

    The same channel carries commands back: because the phone is already POSTing, the server answers each batch with the desired valve state — so you can open and shut Module 2's valve from a dashboard without anything on your farm being reachable from the internet.

Supporting files

Everything in the repository worth having on your own disk before you start — the sketch you flash, the flow you import, the datasheet you check a pinout against. Download saves the file; the path opens it on GitHub if you would rather read it first.

Or take the lot: download the whole repository as a zip, or git clone https://github.com/sunrise-labs/farmers-iot-toolkit.git. Each sketch needs its config.example.h copied to config.h and edited — the real config.h is never committed, because it holds your WiFi password.

When it doesn't work

Ordered roughly by how often it has actually been the answer.

SymptomAlmost alwaysWhat to do
Node can't find the WiFi network Hotspot off, or name mismatch Check the hotspot is on and the SSID matches config.h exactly.
Can't open Node-RED in the browser Node-RED isn't running Open Termux and start it again — and check the wake-lock.
Dashboard shows no data Node posting to the wrong address Leave POST_HOST empty and let the node derive it from the gateway.
Flow looks healthy but nothing is scheduled Android froze the timer Make it event-driven; hold a wake-lock; set Termux to Unrestricted.
Phone battery drains fast Hotspot + Node-RED never sleep Keep it charged — and on solar, duty-cycle the charger, not the phone.
Mobile data disappearing quickly Sending too often Batch readings, or send summaries rather than every sample.

How this fits with the others

The source