Expert setup changes and main README changes

This commit is contained in:
Romain Bazile 2020-09-28 12:15:21 +02:00
parent 5f84196f1b
commit d7712f87a2
2 changed files with 74 additions and 272 deletions

View file

@ -1,6 +1,5 @@
# Expert Setup
## Install and setup Raspbian on your Raspberry Pi
### Computer setup
@ -435,51 +434,6 @@ sudo pip3 install Adafruit-SSD1306
More information can be found on Yahboom website, on the page [Installing RGB Cooling HAT](https://www.yahboom.net/study/RGB_Cooling_HAT).
### Install Node-RED
#### Download and installation
To install Node.js, npm and Node-RED onto a Raspberry Pi, you just need to run the following command. You can review the content of this script [here](https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered).
```sh
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
```
Type `y` at both prompts to accept the installation and its settings.
#### Enable start on boot and launch Node-RED
To run Node-RED when the Pi is turned on or restarted, you need to enable the systemd service by running this command:
```sh
sudo systemctl enable nodered.service
```
You can now start Node-RED by running the following:
```sh
sudo systemctl start nodered.service
```
#### Check the installation
Make sure Node-RED is correctly installed by reaching the following page from the browser of your pi http://localhost:1880 or http://planktoscope.local:1880 from another computer on the same network.
#### Install the necessary nodes
These nodes will be used by the PlanktoScop software and needs to be installed:
```sh
cd ~/.node-red/
npm install node-red-dashboard node-red-contrib-python3-function node-red-contrib-camerapi node-red-contrib-gpsd node-red-contrib-web-worldmap node-red-contrib-interval
sudo systemctl restart nodered.service
```
#### Import the last GUI
From Node-RED gui in your browser, choose the Hamburger menu top right, and then Import. You can paste the code directly from the lastest version of the GUI available [here](https://raw.githubusercontent.com/PlanktonPlanet/PlanktonScope/blob/master/flows/main.json).
You can also download it directly:
```sh
wget -N -O ~/.node-red/flows_planktoscope.json https://raw.githubusercontent.com/PlanktonPlanet/PlanktonScope/master/flows/main.json
sudo systemctl restart nodered.service
```
#### More information
[Installing Node-RED on Raspberry Pi](https://nodered.org/docs/getting-started/raspberrypi)
### Install Mosquitto MQTT
In order to send and receive data from Node-RED, you need to install this. Run the following:
@ -548,6 +502,66 @@ Type "help", "copyright", "credits" or "license" for more information.
The MorphoCut documentation can be found [on this page](https://morphocut.readthedocs.io/en/stable/index.html).
### Install Node-RED
#### Download and installation
To install Node.js, npm and Node-RED onto a Raspberry Pi, you just need to run the following command. You can review the content of this script [here](https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered).
```sh
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
```
Type `y` at both prompts to accept the installation and its settings.
#### Enable start on boot and launch Node-RED
To run Node-RED when the Pi is turned on or restarted, you need to enable the systemd service by running this command:
```sh
sudo systemctl enable nodered.service
```
You can now start Node-RED by running the following:
```sh
sudo systemctl start nodered.service
```
#### Check the installation
Make sure Node-RED is correctly installed by reaching the following page from the browser of your pi http://localhost:1880 or http://planktoscope.local:1880 from another computer on the same network.
#### Install the necessary nodes
These nodes will be used by the PlanktoScop software and needs to be installed:
```sh
cd ~/.node-red/
npm install node-red-dashboard node-red-contrib-python3-function node-red-contrib-camerapi node-red-contrib-gpsd node-red-contrib-web-worldmap node-red-contrib-interval
```
We are also going to activate the Projects feature of Node-Red as this will help us manage and track changes to the flows. Open the file `settings.js` with an editor (for example with `nano settings.js`) so we can change the following lines:
```
Line 68: uncomment the line (remove the //) that ends with flowFilePretty: true,
Line 296: set enabled to true
```
Save you changes.
The final step before restarting node-red is to link the projects directory from within node-red folder to our main home directory. To do so, just open a terminal and type the following:
```bash
ln -s /home/pi/.node-red/projects/PlanktonScope /home/pi/PlanktonScope
```
You can now restart the nodered service:
```
sudo systemctl restart nodered.service
```
#### Import the last GUI
If you now open the Node-Red GUI in your browser, it will ask you to setup the project, an email and a username (so if you make changes to the flow and want to share them we can know who made them).
You can now choose to clone an existing repository. Choose a name that makes sense for you, and in the `Git repository URL` field put the main Planktonscope repository: `https://www.github.com/PlanktonPlanet/PlanktonScope.git`.
The latest flow version will be imported immediately.
#### More information
[Installing Node-RED on Raspberry Pi](https://nodered.org/docs/getting-started/raspberrypi)
## Finishing the install
Make sure to update your Pi
@ -574,12 +588,9 @@ git pull
This will pull and merge all the changes made since your last update.
### Update node-RED interface
To update the interface and make sure you run the latest version, you need to copy the json config file from the cloned repository to the Node-RED library:
```sh
cp ~/PlanktonScope/flows/main.json ~/.node-red/flows_planktoscope.json
```
### Share WiFi via Ethernet
At this link : https://www.instructables.com/id/Share-WiFi-With-Ethernet-Port-on-a-Raspberry-Pi/

View file

@ -1,235 +1,26 @@
==========================
PlanktonScope Installation
==========================
# PlanktonScope Simple Setup Guide
*************************************
Install Raspbian on your Raspberry Pi
*************************************
## Download the image
Download the image
==================
For ease of setup, a preconfigured image is provided. You can download it from [here](http://planktonscope.su.domains/Images_raspberry/Raspbian_Buster_Morphocut_WiFi.img).
Download the .zip file of Raspbian Buster with desktop from the Raspberry Pi website Downloads page.
## Writing the image to the SD card
Writing an image to the SD card
Download the latest version of balenaEtcher and install it.
Download the latest version of [balenaEtcher](https://www.balena.io/etcher/) and install it.
Connect an SD card reader with the micro SD card inside.
Open balenaEtcher and select from your hard drive the Raspberry Pi .zip file you wish to write to the SD card.
Open balenaEtcher and select from your hard drive the previously downloaded img file file you wish to write to the SD card.
Select the SD card you wish to write your image to.
Review your selections and click 'Flash!' to begin writing data to the SD card.
Prepare your Raspberry Pi
-------------------------
`Getting Started with your Raspberry Pi <https://projects.raspberrypi.org/en/projects/raspberry-pi-getting-started/>`_
## Inserting the SD card
Once flashing is over, you can unmount the SD card from the computer (usually done by right clicking on the card icon in the taskbar).
Plug the SD Card in your Raspberry Pi
Insert now the card in the Raspberry installed in your PlanktonScope.
Connect your Pi to a screen, mouse, keyboard and power
Finish the setup
Make sure you have access to internet and update/upgrade your fresh raspbian
Update your Pi first
::
sudo apt-get update -y
sudo apt-get upgrade -y
Reboot your Pi safely
::
sudo reboot now
***************************
Raspberry Pi configurations
***************************
Enable Camera/SSH/I2C in raspi-config
Open up the configuration page and select Interfacing Options by typing this command:
::
sudo raspi-config
Select **Serial**
Select **NO**
Keep the **Serial Port Hardware enabled**
Reboot your Pi safely
::
sudo reboot now
**************************************************
Install the needed libraries for the PlanktonScope
**************************************************
Install CircuitPython
=====================
`Installing CircuitPython on Raspberry Pi <https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi>`_
Run the following command to install adafruit_blinka
::
pip3 install adafruit-blinka
sudo pip3 install adafruit-circuitpython-motorkit
Install RPi Cam Web Interface
=============================
`RPi Cam Web Interface <https://elinux.org/RPi-Cam-Web-Interface>`_
Clone the code from github and enable and run the install script with the following commands
::
git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git
cd RPi_Cam_Web_Interface
./install.sh
Press Enter to allow default setting of the installation
Press Enter to start RPi Cam Web Interface now
Found what is the IP of your Raspberry Pi
::
sudo ip addr show | grep 'inet 1'
Reach the url on a local browser : http://127.0.0.1/html/
Install Ultimate GPS HAT
========================
`Installing Adafruit GPS HAT <https://learn.adafruit.com/adafruit-ultimate-gps-hat-for-raspberry-pi/pi-setup>`_
`Use Python Thread with GPS HAT <http://www.danmandle.com/blog/getting-gpsd-to-work-with-python/>`_
::
sudo apt-get install python gpsd gpsd-clients
Install RGB Cooling HAT
=======================
`Installing RGB Cooling HAT <https://www.yahboom.net/study/RGB_Cooling_HAT>`_
Type these command to install:
::
git clone https://github.com/WiringPi/WiringPi.git
cd WiringPi
sudo ./build
sudo apt-get install gcc
Install Node-RED
==================
`Installing Node-RED on Raspberry Pi <https://nodered.org/docs/getting-started/raspberrypi>`_
Prerequisites
-------------
Ensure npm is able to build any binary modules it needs to install.
::
sudo apt-get install build-essential
Download and installation
-------------------------
To install Node.js, npm and Node-RED onto a Raspberry Pi, run the following command will that download and install them:
::
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Due to the limited memory of the Raspberry Pi, you will need to start Node-RED with an additional argument to tell the underlying Node.js process to free up unused memory sooner than it would otherwise.
::
node-red-pi --max-old-space-size=256
Autostart on boot
-----------------
Run Node-RED when the Pi is turned on, or re-booted, enable the service to autostart by running the command:
::
sudo systemctl enable nodered.service
Check the installation
----------------------
Make sure NodeRed is correctly installed by reaching the following page from the broswer of your pi :
::
http://localhost:1880.
Install few nodes
-----------------
These nodes will be used in Node-RED:
::
cd .node-red/
npm install node-red-dashboard
npm install node-red-contrib-python3-function
npm install node-red-contrib-camerapi
npm install node-red-contrib-gpsd
npm install node-red-contrib-web-worldmap
Import the last GUI
-------------------
Import the `lastest version of the GUI <https://raw.githubusercontent.com/tpollina/PlanktonScope/master/scripts/flows_planktonscope.json>`_
Install Mosquitto MQTT
======================
In order to send and receive from Node-RED:
::
sudo apt-get install mosquitto mosquitto-clients
Install mqtt-paho
=================
In order to send and receive from python:
::
pip3 install paho-mqtt
Install OpenCV
=================
Use the quick version without virtual env
https://www.pyimagesearch.com/2019/09/16/install-opencv-4-on-raspberry-pi-4-and-raspbian-buster/
Install MorphoCut
=================
`Installing MorphoCut <https://morphocut.readthedocs.io/en/stable/installation.html>`_
MorphoCut is packaged on PyPI and can be installed with pip:
::
sudo apt-get install python3-scipy
pip3 install -U git+https://github.com/morphocut/morphocut.git@pyrocystis
Finishing the install
=====================
Make sure to update your Pi
::
sudo apt-get update -y
sudo apt-get full-upgrade -y
Reboot your Pi safely
::
sudo reboot now
*******************
Usefull later maybe
*******************
Download the GitHub repo
========================
At this link : https://github.com/tpollina/PlanktonScope/archive/master.zip
Unzip to a specific location:
::
unzip /home/pi/Downloads/PlanktonScope-master.zip -d /home/pi/
mv /home/pi/PlanktonScope-master /home/pi/PlanktonScope
Update node-RED interface
=========================
To update the interface, you can just download the lastest .json file:
::
wget -P $HOME/.node-red https://raw.githubusercontent.com/tpollina/PlanktonScope/master/scripts/flows_planktonscope.json
Share WiFi via Ethernet
=======================
At this link : https://www.instructables.com/id/Share-WiFi-With-Ethernet-Port-on-a-Raspberry-Pi/
## Start playing!
Start up your PlanktonScope and connect to its WiFi network. You can now access the webpage at http://planktonscope.local:1880/ui to start using your machine!