This is the new Node-RED project for the PlanktoScope.
-
Prepare the SD Card
-
Download the latest development PlanktoScope OS.
-
Flash the
.img.xz
file to an SD card using Raspberry Pi Imager.- Open Raspberry Pi Imager.
- Select "Choose OS" and locate the PlanktoScope image.
- Select "Choose Storage" and pick your SD card.
- Click "Write" to flash the image.
-
Insert the SD card into the PlanktoScope.
-
-
Connect to the Local Network
- Use an Ethernet cable to connect the PlanktoScope to your local router.
- Power on the PlanktoScope.
-
Connect the PlanktoScope to Wi-Fi
- Once the PlanktoScope’s Wi-Fi becomes visible, use your computer or mobile device to connect it to your local router’s Wi-Fi network.
-
Switch to the Node-RED dashboard project
- Go to Node-RED admin
- In the main menu, select
Projects
→Open
and select "dashboard"
- Update the dashboard project
- In the right sidebar, open the
history
tab →Commit History
→ hit the refresh button - If there are remote changes hit the
pull
button
/ps/node-red-v2/dashboard/ to access the dashboard /admin/ps/node-red-v2/ to access the Node-RED editor
Before making contributions you will need to setup authentication, there are 2 methods available
Simple (Node-RED and token)
- Go to https://github.com/settings/personal-access-tokens
Generate new token
Token name
: "PlanktoScope dashboard"Resource owner
: "PlanktoScope"Repository access
→Only select repositories
selectPlanktoScope/dashboard
Permissions
→Repository permissions
→Contents
selectRead and Write
- Hit
Generate token
Copy the token somehwere safe.
When using the Node-RED GUI to push changes, you will be prompted for git username and password.
Use your GitHub username and the generated token as password.
Advanced (CLI and SSH)
See Development Environment then:
cd PlanktoScope/node-red/projects/dashboard
git remote set-url origin [email protected]:PlanktoScope/dashboard.git
git fetch origin
git checkout main
git pull
# use Git CLI instead of Node-RED history tab
If you pull changes on the dashboard project, Node-RED may complain about missing nodes.
In that case you will need to type the following commands in the PlanktoScope
cd /home/pi/PlanktoScope
git pull
sudo systemctl restart nodered
You can use SSH or the Cockpit terminal.
Data is stored in a file located at: /home/pi/PlanktoScope/node-red/context/global/global.json
.
To retrieve a value stored in this file, use the following script in a Function Node:
// Retrieve the global variable
msg.variable = global.get("variable")
return msg
<template>
<v-text-field
label="My variable"
variant="outlined"
v-model="msg.variable"
@update:model-value="send({ variable: msg.variable })"
></v-text-field>
</template>
To set a value in the file, use the following script in a Function Node:
// Set a value in the global context
global.set("variable", msg.variable)
return msg