Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Raspberry Pi

Raspberry Pi Data Pipeline: Collect, Store and Visualize IoT Data

Raspberry Pi Data Pipeline: Collect, Store and Visualize IoT Data

March 11, 2026 /Posted byJayesh Jain / 0

Collecting sensor readings from IoT devices is easy — the real challenge is making sense of them over time. A single temperature reading tells you the room is 28 °C. A week’s worth of readings tells you your HVAC is underperforming every afternoon between 2 PM and 5 PM. That kind of insight requires a proper data pipeline: sensors feed into a time-series database, which feeds into a visualization layer that turns raw numbers into actionable charts and alerts.

In this tutorial we will build exactly that on a Raspberry Pi using InfluxDB (time-series database), Telegraf (metrics collector), and Grafana (visualization). By the end you will have a live dashboard showing sensor data from your IoT devices, with historical queries and configurable alerts — all running locally on your Pi with no cloud subscription required.

Architecture Overview

The stack follows a classic data pipeline pattern:

  1. Sensors/Devices — DHT11 temperature/humidity sensor, BMP280 pressure sensor, or any IoT data source (MQTT, HTTP, CSV files).
  2. Telegraf — A lightweight agent that collects metrics from dozens of sources (GPIO, MQTT brokers, system stats, HTTP APIs) and writes them to InfluxDB.
  3. InfluxDB 2.x — A purpose-built time-series database optimized for high-frequency writes and time-range queries. Far more efficient than MySQL for sensor data.
  4. Grafana — A visualization platform that connects to InfluxDB (and 50+ other data sources) to render beautiful, interactive dashboards.

All three components run as systemd services on your Raspberry Pi. The entire stack consumes roughly 300–400 MB of RAM under load — well within the capacity of even a 2 GB Pi 5.

Recommended: Raspberry Pi 5 Model 4GB RAM — The 4 GB model gives InfluxDB and Grafana comfortable headroom for large datasets and multiple simultaneous dashboard users. Its significantly faster I/O also speeds up InfluxDB ingestion compared to older Pi models.

Hardware: Sensors and Wiring

We will use two sensors commonly available in India to demonstrate the pipeline:

  • DHT11 — Temperature (0–50 °C, ±2 °C) and humidity (20–90 % RH, ±5 %) via single-wire digital protocol.
  • BMP280 — Barometric pressure and temperature via I2C — great for weather stations and altitude tracking.

DHT11 Wiring

DHT11 Pin Raspberry Pi Pin
VCC 3.3 V (Pin 1)
DATA GPIO 4 (Pin 7)
GND GND (Pin 9)

Add a 10 kΩ pull-up resistor between VCC and DATA.

Recommended: DHT11 Digital Relative Humidity and Temperature Sensor Module — The module version includes the pull-up resistor on board, so it wires directly to 3.3 V, DATA, and GND without additional components.

BMP280 Wiring (I2C)

BMP280 Pin Raspberry Pi Pin
VCC 3.3 V (Pin 1)
GND GND (Pin 6)
SDA GPIO 2 (Pin 3)
SCL GPIO 3 (Pin 5)
Recommended: BMP280 Barometric Pressure and Altitude Sensor I2C/SPI Module — Works at 3.3 V and directly connects to the Raspberry Pi’s I2C bus. Ideal for weather station and environmental monitoring pipelines.

Installing InfluxDB 2.x on Raspberry Pi

InfluxDB 2.x has ARM64 packages that install cleanly on Raspberry Pi OS (64-bit, Bookworm recommended):

# Add InfluxDB repo
curl https://repos.influxdata.com/influxdata-archive.key | gpg --dearmor 
  | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive.gpg > /dev/null
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive.gpg] 
  https://repos.influxdata.com/debian stable main' 
  | sudo tee /etc/apt/sources.list.d/influxdata.list

sudo apt update && sudo apt install influxdb2
sudo systemctl enable --now influxdb

Navigate to http://your-pi-ip:8086 in a browser. The setup wizard will guide you through creating an organization, bucket (database), and initial admin user. Note the operator API token shown at the end — you will need it for Telegraf.

Creating Your First Bucket

In the InfluxDB UI go to Load Data → Buckets → Create Bucket. Name it iot_sensors and set a retention period (e.g., 30 days — InfluxDB auto-deletes older data). For long-term archives increase to 365 days or unlimited.

Installing and Configuring Telegraf

Telegraf is the collection agent that bridges your sensors to InfluxDB. It supports 300+ input plugins.

sudo apt install telegraf

Generate a base config and customize it:

telegraf config > /etc/telegraf/telegraf.conf
sudo nano /etc/telegraf/telegraf.conf

InfluxDB Output Plugin

Find the [[outputs.influxdb_v2]] section and configure it:

[[outputs.influxdb_v2]]
  urls = ["http://localhost:8086"]
  token = "YOUR_INFLUXDB_TOKEN"
  organization = "zbotic"
  bucket = "iot_sensors"

Reading DHT11 Via Exec Plugin

The simplest way to feed DHT11 readings to Telegraf is via a Python script called by the exec plugin. First install the Adafruit DHT library:

pip3 install adafruit-circuitpython-dht

Create /usr/local/bin/read_dht11.py:

#!/usr/bin/env python3
import adafruit_dht, board, time
dht = adafruit_dht.DHT11(board.D4)
try:
    t = dht.temperature
    h = dht.humidity
    print(f'dht11_sensor temperature={t},humidity={h}')
except Exception:
    pass
dht.exit()
sudo chmod +x /usr/local/bin/read_dht11.py

Add to telegraf.conf:

[[inputs.exec]]
  commands = ["/usr/local/bin/read_dht11.py"]
  timeout = "10s"
  data_format = "influx"
  interval = "60s"

Reading BMP280 Via I2C

pip3 install adafruit-circuitpython-bmp280

Create a similar exec script for BMP280 and add another [[inputs.exec]] block. Telegraf will call both scripts on their defined intervals and write measurements to InfluxDB.

Enable and start Telegraf:

sudo systemctl enable --now telegraf
sudo journalctl -u telegraf -f  # watch for errors

Installing Grafana and Building Dashboards

sudo apt install -y adduser libfontconfig1 musl
wget https://dl.grafana.com/oss/release/grafana_10.3.1_arm64.deb
sudo dpkg -i grafana_10.3.1_arm64.deb
sudo systemctl enable --now grafana-server

Access Grafana at http://your-pi-ip:3000 (default login: admin/admin, you will be asked to change it).

Adding InfluxDB as a Data Source

  1. Go to Connections → Data Sources → Add Data Source → InfluxDB.
  2. Set Query Language to Flux.
  3. URL: http://localhost:8086
  4. Enter your organization, token, and default bucket (iot_sensors).
  5. Click Save & Test — you should see a green success message.

Creating Your First Panel

In a new dashboard click Add Visualization. In the query editor use Flux:

from(bucket: "iot_sensors")
  |> range(start: -24h)
  |> filter(fn: (r) => r._measurement == "dht11_sensor")
  |> filter(fn: (r) => r._field == "temperature")

Select a Time Series visualization type and you will see your temperature history as a line chart. Add another panel for humidity, pressure, and system metrics (CPU temp, RAM usage — Telegraf’s [[inputs.cpu]] and [[inputs.mem]] plugins handle these automatically).

Setting Up Alerts and Notifications

Grafana’s alerting engine can send notifications when sensor values breach thresholds — crucial for a real monitoring system:

  1. In your temperature panel click the Alert tab.
  2. Set condition: temperature > 35 FOR 5m
  3. Add a notification channel (Telegram bot, email via SMTP, or Slack webhook).

Alternatively, InfluxDB 2.x has its own built-in alerting with Tasks (scheduled Flux scripts that can write alert states to a separate bucket and notify via webhooks).

Recommended: DHT20 SIP Packaged Temperature and Humidity Sensor — Upgrade from DHT11 to this I2C-based DHT20 for better accuracy (±0.5 °C, ±3 % RH) and easier wiring to the Raspberry Pi I2C bus alongside your BMP280.

Expanding the Pipeline: MQTT, Multiple Nodes, and Remote Sensors

Once the basic pipeline works, the architecture scales beautifully:

MQTT Integration

Install Mosquitto as an MQTT broker on the Pi. Configure ESP32/ESP8266 sensors to publish readings to MQTT topics. Add [[inputs.mqtt_consumer]] to Telegraf — it subscribes to your topics and auto-writes to InfluxDB. You can now monitor dozens of wireless sensors from a single dashboard.

Multiple Raspberry Pi Nodes

Install only Telegraf on remote Pi devices (no InfluxDB). Configure their Telegraf outputs to point at the central Pi’s InfluxDB IP. All nodes report to one database and appear as tagged measurements (use the tags section in telegraf.conf to tag by location: kitchen, bedroom, outdoor).

Downsampling for Long-Term Storage

Raw 60-second readings accumulate fast. Use InfluxDB Tasks to downsample to hourly averages after 7 days and daily averages after 30 days. This keeps the database small while preserving long-term trends.

Frequently Asked Questions

How much storage does InfluxDB need for typical IoT sensor data?

It depends on write frequency and number of sensors. A rough estimate: 1 sensor writing 4 fields every 60 seconds generates about 25 MB per month of raw data (before compression). InfluxDB’s TSM storage engine compresses time-series data by 10–20x, so 25 MB of raw data becomes roughly 1–2 MB on disk. A 32 GB microSD card handles thousands of sensors for years, and an NVMe SSD on Pi 5 gives practically unlimited capacity.

Can I run InfluxDB and Grafana on a Raspberry Pi 3 or 4?

InfluxDB 2.x requires a 64-bit OS (ARM64). The Pi 3B+ and Pi 4 can run 64-bit Raspberry Pi OS. However, InfluxDB 2.x has a minimum recommendation of 1 GB RAM — the Pi 4/4 GB is comfortable, Pi 3/1 GB will be tight. Consider InfluxDB 1.x (32-bit compatible, lower RAM footprint) for older hardware.

What is the difference between InfluxDB and Prometheus for IoT?

Both are time-series databases but with different philosophies. Prometheus uses a pull model (it scrapes metrics from endpoints at intervals) while InfluxDB uses a push model (agents write data in). InfluxDB also supports higher write throughput and native SQL-like queries via its Flux language, making it better suited for IoT sensor pipelines. Prometheus + Grafana is more popular in Kubernetes/cloud infrastructure monitoring.

Is this setup secure if I expose Grafana to the internet?

By default, no — Grafana and InfluxDB have no HTTPS. For internet exposure: put Nginx in front of Grafana with a Let’s Encrypt SSL certificate, enable Grafana authentication (OAuth or built-in), restrict InfluxDB to localhost only, and use fail2ban to block brute-force login attempts. For home use on your LAN, the default setup is fine.

Can I import pre-built Grafana dashboards for Raspberry Pi monitoring?

Yes. Grafana’s dashboard repository at grafana.com has hundreds of community-built dashboards. Dashboard ID 10578 (“Raspberry Pi Monitoring”) and ID 15765 (“InfluxDB 2.0 System Metrics”) are popular starting points. Import via Grafana UI → Dashboards → Import → paste the ID.

Build your IoT data pipeline today with sensors and Raspberry Pi boards from Zbotic.in — India’s go-to store for electronics components with expert support and fast nationwide shipping.

Tags: data pipeline, Grafana, home automation, InfluxDB, iot, Raspberry Pi, Sensors
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
OctoPrint on Raspberry Pi: Con...
blog octoprint on raspberry pi control your 3d printer remotely 595121
blog raspberry pi vs jetson nano which ai compute board wins 595131
Raspberry Pi vs Jetson Nano: W...

Related posts

Svg%3E
Read more

Raspberry Pi Benchmarks: Performance Testing All Models

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi PoE: Power Over Ethernet Setup Guide

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi GSM HAT: SMS and Cellular IoT

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi RS485: Industrial Sensor Network

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading
Svg%3E
Read more

Raspberry Pi CAN Bus: Vehicle OBD2 Data Reader

April 1, 2026 0
Table of Contents Introduction and Use Cases Hardware Requirements Software Installation Configuration and Setup Testing and Validation Advanced Features Troubleshooting... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now