Grafana & InfluxDB Integration

Create powerful time-series dashboards for your Modbus data

⏱️ Setup Time: 20-25 minutes | 📚 Prerequisites: InfluxDB 2.0+ installed, Link485 Air/4G device

Learn how to stream LINK485 Modbus data directly to InfluxDB using HTTP POST and visualize it with beautiful Grafana dashboards. Perfect for energy monitoring, environmental tracking, and industrial analytics. No MQTT broker needed!

Architecture Overview

Link485 Air/4G
Modbus Devices
InfluxDB
HTTP POST
Grafana
Dashboards

Link485 devices POST data directly to InfluxDB's write API. No middleware or MQTT broker required!

Prerequisites

  • InfluxDB 2.0+ installed and accessible on your network
  • Grafana 8.0+ installed (can be on same or different server)
  • Link485 Air or 4G device
  • Link485 Mobile App (Android/iOS)

Step 1: Set Up InfluxDB

Create Bucket and API Token

  1. Access InfluxDB UI: http://influxdb-ip:8086
  2. Create Bucket:
    • Go to Load Data → Buckets
    • Click Create Bucket
    • Name: link485
    • Retention: As needed (default: infinite)
  3. Generate API Token:
    • Go to Load Data → API Tokens
    • Click Generate API Token → All Access Token
    • Description: link485-write
    • Copy and save the token - you'll need it in the mobile app
  4. Note Your Organization: Find it in Settings (usually your username or "default")

🔒 Security: For production, create a token with write-only access to the link485 bucket instead of all-access.

Step 2: Prepare InfluxDB Line Protocol Format

InfluxDB accepts data in Line Protocol format. Your Link485 write URL will be:

http://influxdb-ip:8086/api/v2/write?org=YOUR_ORG&bucket=link485&precision=s

URL Parameters:

  • org: Your organization name
  • bucket: Target bucket (link485)
  • precision: Timestamp precision (s=seconds)

Step 3: Configure Link485 via Mobile App

For Link485 Air (WiFi)

  1. Power on your Link485 Air device
  2. Download Link485 App (Android/iOS)
  3. Open App and Add Device: Tap "Add New Device"
  4. Enter WiFi Credentials
  5. Choose Integration Type: Select "InfluxDB" or "HTTP/Custom"
  6. Configure InfluxDB Settings:
    • InfluxDB URL: http://influxdb-ip:8086
    • Organization: Your org name
    • Bucket: link485
    • API Token: Paste the token from Step 1
    • Measurement Name: modbus_data (or custom name)
    • Post Interval: 30 seconds (adjust as needed)
  7. Tap "Connect" - Device will start writing to InfluxDB

For Link485 4G (Cellular)

  1. Power on your Link485 4G device with SIM card
  2. Download Link485 App (same as above)
  3. Optional: Enter WiFi credentials for backup connectivity
  4. Choose Integration Type: Select "InfluxDB"
  5. Configure InfluxDB Settings (same as above)
  6. Tap "Connect" - Device uses 4G for primary connection

💡 Pro Tip: The Link485 app automatically converts JSON data to InfluxDB Line Protocol format. No data transformation needed!

Step 4: Verify Data in InfluxDB

  1. Open InfluxDB UI: http://influxdb-ip:8086
  2. Go to Data Explorer (left sidebar)
  3. Select:
    • Bucket: link485
    • Measurement: modbus_data (or your custom name)
    • Fields: voltage, current, power, etc.
  4. Click "Submit" - You should see data flowing in!

⏱️ Timing: Data should appear within 30 seconds (or your configured interval) after device connects.

Step 5: Connect Grafana to InfluxDB

  1. Open Grafana: http://grafana-ip:3000 (default login: admin/admin)
  2. Add Data Source:
    • Go to Configuration → Data Sources
    • Click Add data source
    • Select InfluxDB
  3. Configure Connection:
    • Query Language: Flux
    • URL: http://influxdb-ip:8086
    • Auth: Disable Basic Auth
    • Organization: Your org name
    • Token: Your API token (same as Step 1)
    • Default Bucket: link485
  4. Click "Save & Test" - Should show "Data source is working"

Step 6: Create Grafana Dashboard

  1. Create New Dashboard: Click + → Dashboard
  2. Add Panel: Click "Add new panel"
  3. Select Data Source: Choose your InfluxDB source
  4. Write Flux Query (see examples below)
  5. Choose Visualization:
    • Time series: For trends over time
    • Gauge: For current values with thresholds
    • Stat: For single value displays
    • Table: For detailed data view
  6. Customize: Add titles, units, thresholds, colors
  7. Save Panel and add more panels as needed
  8. Save Dashboard with a meaningful name

Example Flux Queries

Query 1: Power Consumption Over Time

from(bucket: "link485")
  |> range(start: -1h)
  |> filter(fn: (r) => r._measurement == "modbus_data")
  |> filter(fn: (r) => r._field == "power")
  |> aggregateWindow(every: 1m, fn: mean, createEmpty: false)

Query 2: Current Voltage (Latest Value)

from(bucket: "link485")
  |> range(start: -5m)
  |> filter(fn: (r) => r._measurement == "modbus_data")
  |> filter(fn: (r) => r._field == "voltage")
  |> last()

Query 3: Total Energy (Sum)

from(bucket: "link485")
  |> range(start: -24h)
  |> filter(fn: (r) => r._measurement == "modbus_data")
  |> filter(fn: (r) => r._field == "energy")
  |> difference()
  |> sum()
Get Support More Guides