From scale box to app
Allow about an hour. All services are free for running a hive scale. First choose how your scale box should transmit – the guide then shows only the steps you need.
Not sure whether LoRaWAN reaches your apiary? Check first with tracker mode or on the ttnmapper.org map.
ThingSpeak: create a channel all paths
ThingSpeak stores the measurements; the app reads them from there.
- Create a free account at thingspeak.mathworks.com.
- Channels → New Channel: one channel per scale box. Enable and name fields 1–7:
The GPS position automatically goes into the channel's location fields.Field Content field1 / field2 Weight scale 1 / 2 (kg) field3 Temperature (°C) field4 Humidity (%) field5 Battery voltage (V) field6 / field7 Weight scale 3 / 4 (4 scales only) - Under API Keys note two values: the Write API Key (for the scale box or the Cloudflare Worker) and the Read API Key (for the app).
The Things Network: register the device LoRaWAN
- Create an account at thethingsnetwork.org and open the Console (cluster Europe 1).
- Applications → + Create application, e.g.
beescales. - + Register end device → Enter end device specifics manually:
- Frequency plan: Europe 863–870 MHz (SF9 for RX2 – recommended)
- LoRaWAN version: LoRaWAN Specification 1.1.0, activation OTAA
- Let the console generate JoinEUI, DevEUI and AppKey/NwkKey
- In the device settings under Join settings enable “Resets join nonces” – otherwise TTN rejects the join after a factory reset of the scale box.
- Copy the four keys in MSB format (switch the console display to “msb”) – they go into the scale box in step 5.
- Payload formatters → Uplink: choose Custom Javascript formatter and paste the BienenWaagenManager formatter:
Cloudflare Worker: connect TTN to ThingSpeak LoRaWAN
The worker is a small program in the cloud: it receives every message from TTN and writes the values into the right ThingSpeak channel. The free plan is far more than enough (100,000 requests per day).
- Create an account at cloudflare.com.
- Workers & Pages → Create → Worker (“Hello World”), give it a name, e.g.
beescales, Deploy. - Edit code: replace the entire content with the template:
- At the top, in
API_KEYS, enter the Write API Key from step 1 for each scale box. The number on the left is the scale box's Node ID (step 5). - Recommended: set your own password in
WEBHOOK_SECRET– then the worker only accepts messages from your TTN. - Deploy and note the worker address, e.g.
https://beescales.YOUR-NAME.workers.dev.
Set up the TTN webhook to the worker LoRaWAN
- In the TTN application: Integrations → Webhooks → + Add webhook → Custom webhook.
- Webhook ID e.g.
thingspeak, webhook format JSON, base URL = worker address from step 3. - If you set a
WEBHOOK_SECRET: add the headerX-Webhook-Secretwith the same value under Additional headers. - Under Enabled event types tick only Uplink message and save.
Set up the scale box in the web UI all paths
- Briefly press the button on the scale box – it starts maintenance mode. The display shows the hotspot name, password and address.
- Connect your phone or laptop to this Wi-Fi and open
192.168.4.1in the browser. See what the web UI looks like (demo) ↗ - Configuration → Operating Mode: set the Node Identification – 1 for the first scale box, 2 for the second, and so on.
- Configuration → Keys & Connection: enter DevEUI, JoinEUI, AppKey and NwkKey from step 2 and save each.
- Configuration → Uplink: uplink mode LoRa (TTN→ThingSpeak), save.
- Configuration → Keys & Connection: enter Wi-Fi name and password and the ThingSpeak Write API Key from step 1. For 4G also the APN of your SIM card.
- Configuration → Uplink: uplink mode WiFi (WLAN→ThingSpeak) or 4G/LTE, save.
- Configuration → Schedule: choose a transmission profile – Regular (every 10 minutes during the day) is a good start.
- Calibration → Scale Calibration: calibrate each scale with a known weight – the wizard guides you through the two measuring points.
Test all paths
- In maintenance mode the scale box automatically sends a test message (can be switched off under Uplink → Uplink test).
- In the TTN Console under Live data you see “Join accept” and the test message. It is marked as a test and deliberately carries no measurement fields, so it cannot distort your charts.
- In the Cloudflare dashboard under Worker → Logs it says “Testpaket, nicht an ThingSpeak” (test packet, not sent to ThingSpeak) – the chain up to the worker works.
- An entry with the current measurements appears in the ThingSpeak channel.
- Press the button or wait until maintenance mode ends: the scale box measures right away and transmits. This entry appears in the ThingSpeak channel, in the worker log as “Waagenbox 1 → ThingSpeak Entry: …”.
Connect the app all paths
- Install the app.
- Settings → Import: enter your ThingSpeak User API Key (Account → My Profile) – the app lists all channels of the account and adds them with one tap. The user key is not stored.
- Alternatively one by one: Add channel with channel ID and Read API Key.
- Name your colonies, done. Tip: stick NFC tags on your hives and assign them under Settings → NFC.
Troubleshooting
TTN shows no “Join accept”
Keys swapped or entered in LSB format? Check all four keys in MSB format. Is a gateway in range (ttnmapper.org)? After a factory reset enable “Resets join nonces”.
TTN receives, but ThingSpeak stays empty
Payload formatter pasted? NODE_ID and field1 … must be visible in “Live data”. Does the scale box's node ID match the entry in API_KEYS in the worker? The worker log shows the cause.
ThingSpeak reports “Entry: 0”
Wrong write key or two entries within 15 seconds. When testing, just wait a little.
Wi-Fi uplink fails
The scale box supports 2.4 GHz Wi-Fi only. With weak reception a repeater helps – or LoRaWAN, if available.
Weight is negative or missing
Negative values are deliberately not sent – the scale is then not connected or not yet calibrated.
All settings are described in detail in the manual and in the web UI help (?).