Skip to content

scramjetorg/raspberry-pi-dash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Running STH (Scramjet Transform Hub) on Raspberry Pi

🚀 + ? Why not!

Table of contents

Introduction

Scramjet Sequences don't require high hardware requirements. You can run it also on cheap single-board computers for example Raspberry Pi The following configuration was tested on Raspberry Pi Zero 2 W booted in headless mode with 64-bit image (5.15 kernel). In this example we will capture some internal parameters of RPi in real time.

How to boot rPi? -> official video

Installation 🗜️

First You should install node.js (we recommend 16.x):

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

then install our STH and CLI:

sudo npm i -g @scramjet/sth @scramjet/cli

Verify installation:

node -v
si -v

Start STH 🏁

Create sth_rpi_config.json:

{
    "runtimeAdapter": "process",
    "safeOperationLimit": 128,
    "instanceRequirements": { "freeMem": 64 }
}

or sth_rpi_config.yml:

safeOperationLimit: 128
runtimeAdapter: process
instanceRequirements:
    freeMem: 64

and launch Scramjet Transform Hub

sth --config /path/to/config/sth_rpi_config.json

💡 Note: As default hub reserves 512MB of RAM, if your raspberry has 1GB or more, you can try run sth without custom memory limits

Set up the Sequence

clone this git repository:

git clone git@github.com:scramjetorg/raspberry-pi-dash.git

cd inside sequence directory:

cd seq-internal-rpi

now you have to build dist directory:

npm run build

and deploy the sequence! 🚀 :

si seq deploy dist

now the Instance of your Sequence is running and producing to "pi" topic, you can verify that by launching topic listener 👂 via CLI:

si topic get pi

you should see similar output:

[38.63, 8.35, 0.25]
[39.17, 8.35, 0.24]
[38.63, 8.35, 0.24]
[38.63, 8.35, 0.24]

these values are respectively: chip temperature in Celcius degrees, disk usage and average CPU load.

💡 Note: If you want to dig in, there is full STH documentation

FAQ Troubleshooting 💥

Why my computer doesn't see the Raspberry?

Raspberry Team have removed default user. If you created image with non official imager (eg. balenaEtcher), you need to create userconf.txt (in the boot root directory) and add the following line:

pi:$6$/XOZsG1X0IAbhXB0$wYZHRkvib0SUKQA3KVAxofPR.JsFAbI2NCue2znGvhRsQobVdllFXyQZ7fMSvAoyEj8MfHtkMeSZT7IRIixg01

this step will enable default user (user: pi, password: raspberry).

💡 We recommend using the official imager

I made some changes in my code, how to rebuild the sequence?

There are two ways, you can force rebuild with npm run build --upgrade or manually remove /dist directory and do simple npm run build.

Dictionary 📖

  • STH - Scramjet Transform Hub
  • Sequence - program adapted to run in STH environment
  • Instance - running Sequence
  • Topics - are named buses over which Instances exchange messages
  • si - Scramjet Command Line Interface