Raspberry Pi Guide
Push sensor data from a Raspberry Pi
Raspberry Pi runs full Linux with Python — the simplest possible EasyBoard integration. If you can pip install requests, you can push data to a live dashboard in a few minutes.
Step 1 — Store your credentials
Create a .env file in your project folder and add it to .gitignore. Your write token never goes in your Python files.
# .env ← add to .gitignore
EASYBOARD_DASHBOARD_ID=abc123xyz456
EASYBOARD_WRITE_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxAdd .env to .gitignore first
Run echo ".env" >> .gitignore before creating the file.
Step 2 — Install libraries
pip install requests python-dotenvStep 3 — The update helper
Save this as easyboard.py in your project. Call update_tile() from anywhere in your code.
import os
import requests
from dotenv import load_dotenv
load_dotenv() # reads .env in the current directory
DASHBOARD_ID = os.environ["EASYBOARD_DASHBOARD_ID"]
WRITE_TOKEN = os.environ["EASYBOARD_WRITE_TOKEN"]
BASE_URL = f"https://easyboard.live/api/d/{DASHBOARD_ID}/tiles"
def update_tile(tile_id: str, value) -> None:
"""Push a new value to an EasyBoard tile."""
try:
resp = requests.patch(
f"{BASE_URL}/{tile_id}",
headers={"Authorization": f"Bearer {WRITE_TOKEN}"},
json={"value": str(value)},
timeout=10,
)
if resp.status_code == 429:
print("Rate limit reached — slow down updates or upgrade your plan")
elif resp.status_code != 200:
print(f"Update failed: HTTP {resp.status_code}")
except requests.exceptions.RequestException as e:
print(f"Network error: {e}")Step 4 — Read sensors and push
import time
import random # replace with your actual sensor library
from easyboard import update_tile # assuming you saved the helper above
TEMP_TILE_ID = "your-temperature-tile-id"
STATUS_TILE_ID = "your-status-tile-id"
while True:
# Replace with actual sensor reads, e.g.:
# from gpiozero import MCP3008
# sensor = MCP3008(channel=0)
temp = round(random.uniform(20.0, 25.0), 1)
update_tile(TEMP_TILE_ID, temp) # "23.4"
update_tile(STATUS_TILE_ID, "Online") # any text
time.sleep(60) # update every minuteRunning automatically
Two options for keeping your script running after a reboot:
Cron (simple, for periodic scripts)
# Run your script every 5 minutes — add to crontab with: crontab -e
*/5 * * * * /usr/bin/python3 /home/pi/my_project/sensor.py >> /home/pi/sensor.log 2>&1systemd (recommended for continuous scripts)
# /etc/systemd/system/easyboard-sensor.service
[Unit]
Description=EasyBoard sensor pusher
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/my_project
EnvironmentFile=/home/pi/my_project/.env
ExecStart=/usr/bin/python3 sensor.py
Restart=on-failure
RestartSec=30s
[Install]
WantedBy=multi-user.targetsudo systemctl enable easyboard-sensor && sudo systemctl start easyboard-sensorEnvironmentFile in systemd
The EnvironmentFile= line in the service file loads your .env variables automatically — the same ones your Python script reads with load_dotenv(). No need to hardcode anything in the service file.