Update docs: reorganize resources.md, add template for setup.md (#27)

Signed-off-by: Satu Koskinen <satu.a.koskinen@gmail.com>
This commit is contained in:
Satu Koskinen 2023-09-12 15:11:06 +02:00 committed by GitHub
parent f2fc58c2ba
commit 32c96fb031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 104 deletions

View File

@ -1,27 +1,37 @@
# Links # Useful resources
# Raspberry Pi GPIO pins pinout ## Raspberry Pi
### Raspberry Pi GPIO pins pinout
https://pinout.xyz/pinout/i2c https://pinout.xyz/pinout/i2c
# Setting up an additional i2c bus with the GPIO pins ### Setting up an additional i2c bus with the GPIO pins
https://raspberrypi.stackexchange.com/questions/101951/using-normal-gpio-pins-as-i2c-required https://raspberrypi.stackexchange.com/questions/101951/using-normal-gpio-pins-as-i2c-required
# Raspberry Pi water pressure sensor ## Other components
### Depth sensor
#### Example Raspberry Pi water pressure sensor schematic
https://www.circuito.io/app?components=9443,200000,267055 https://www.circuito.io/app?components=9443,200000,267055
# Setting up Jack on Raspberry Pi ### RTC
https://wiki.linuxaudio.org/wiki/raspberrypi #### DS3231 module pinout
https://github.com/supercollider/supercollider/blob/develop/README_RASPBERRY_PI.md
https://madskjeldgaard.dk/posts/raspi4-notes/
# Setting up the RTC https://electropeak.com/learn/interfacing-ds3231-real-time-clock-rtc-module-with-arduino/
#### Setting up the RTC
https://pimylifeup.com/raspberry-pi-rtc/ https://pimylifeup.com/raspberry-pi-rtc/
## DS3231 module pinout ## NixOS on Raspberry Pi
https://electropeak.com/learn/interfacing-ds3231-real-time-clock-rtc-module-with-arduino/ ### Resources that helped with building the current setup
https://myme.no/posts/2022-12-01-nixos-on-raspberrypi.html
https://github.com/lucernae/nixos-pi

View File

@ -2,10 +2,11 @@
## Components ## Components
- Raspberry Pi (tested on 4B) - Raspberry Pi 4B
- MicroSD card + adapter - One of the following, depending on whether an SD card or an SSD is used:
- Card reader to access the sd card on the computer - 1) MicroSD card + adapter & card reader to access the sd card on the computer
- Audio card connected via USB and a microphone/hydrophone attached to the audio card - 2) USB SSD drive OR Argon One M.2 case + compatible M.2 SATA SSD (Key B or Key B&M), we used Intenso M.2 SSD TOP SATA III 1TB
- Audio card connected via USB and microphone/hydrophone(s) attached to the audio card
- USB GPS receiver - USB GPS receiver
- Depth recording components: - Depth recording components:
- Pressure sensor - Pressure sensor
@ -14,60 +15,27 @@
- RTC module (DS3231) - RTC module (DS3231)
## Raspberry OS basic setup ## First time setup
### 1. Install the operating system and set up user, Wi-Fi, ssh access TODO
#### 1.1 With Raspberry Pi Imager ### 1. Host environment
The easiest way to install the operating system (Raspberry Pi OS, a Linux Debian-based OS) is to use the official Raspberry Pi Imager utility which works on macOS, Ubuntu and Windows. TODO
Install from here: https://www.raspberrypi.com/software/ ### 2. Define custom configuration
After installing, plug the SD card to the computer and launch Raspberry Pi Imager. TODO
Then the following steps: ### 3. Build first SD image
1. Select operating system: click Raspberry Pi OS (other) and then, depending on the Pi, either a 32-bit or 64-bit Raspberry Pi OS Lite TODO
2. Select storage: the sd card should be listed
3. Click the cog icon to set some configurations:
- Enable SSH (use password authentication)
- Set username and password
- Configure wireless LAN: input the name and password of the wi-fi network, select Wireless LAN country
- Set locale settings: select options correct for you
4. Click Write (all existing data on the SD card will be erased and the OS installed)
#### 1.2 With some other utility ### 4. Flash the image to the SD card or SSD
If you do not use the Raspberry Pi Imager to set up the SD card, the following steps are required: ### 5. Connect to the Pi over SSH
1. Download the 32-bit / 64-bit Rasbperry Pi OS Lite from here: https://www.raspberrypi.com/software/operating-systems/ #### Plug the SD card in and connect to the Raspberry Pi over SSH
2. Flash the image to the SD card with the utility of your choice (options here for Mac, Linux, Windows?)
3. Fill in required details in the configuration files in `hydrophonitor/pi-config` folder and copy them to the `boot` folder on the SD card (this is the folder that should open when you open the SD card volume on your computer):
- ssh.txt: this enables ssh on the Raspberry Pi, no need to edit the file (it's empty, the existence of the file in the boot folder is enough)
- userconf.txt: creates a user
- replace <username> with the username of choice (e.g. pi)
- replace <encrypted password> with an encrypted version of your password which can be created with the openssl command line tool:
- open Terminal, write `openssl passwd` and press Enter
- input your password and press enter (asked twice)
- as output, you will get the encrypted version of the password
- wpa_supplicant.conf: set up Wi-Fi
- replace <Insert 2 letter ISO 3166-1 country code here> with your country code (e.g. FI)
- replace "<Name of your wireless LAN>" with the name of your Wi-Fi network, e.g. "explorersden"
- replace "<Password for your wireless LAN>" with the Wi-Fi password, e.g. "password"
### 2. Setting up the recording programs on the Raspberry Pi
After flashing the operating system to the SD card, it should show up as volume called `boot`.
To install all the needed components and to configure the Raspberry Pi to start the recordings when it is turned on, four steps are needed: copying the needed files to the SD card, putting the SD card in the Raspberry Pi and connecting to it on the command line over SSH, running an installer script on the command line, and finally letting it restart and verify that everything works as intended.
#### 2.1 Copy files to the SD card, set configuration values
First, set the configuration values in the file `hydrophonitor/hydrophonitor-config.txt`. Then, copy the entire `hydrophonitor` folder to the SD card (simple Ctrl+C and Ctrl+V works).
#### 2.2 Plug the SD card in and connect to the Raspberry Pi over SSH
Plug the SD card in the Raspberry Pi. Connect the audio card and the GPS receiver over USB to the Raspberry Pi, and plug the power cable. It will take some time for the Raspberry Pi to be ready to accept SSH connections. Plug the SD card in the Raspberry Pi. Connect the audio card and the GPS receiver over USB to the Raspberry Pi, and plug the power cable. It will take some time for the Raspberry Pi to be ready to accept SSH connections.
@ -111,62 +79,28 @@ MAC Address: E4:5F:01:B3:65:DE (Raspberry Pi Trading)
The Raspberry Pi should show up with its IP address (here, 192.168.1.108), MAC address and a name after the MAC address that should help identifying it (here, it's Raspberry Pi Trading). The Raspberry Pi should show up with its IP address (here, 192.168.1.108), MAC address and a name after the MAC address that should help identifying it (here, it's Raspberry Pi Trading).
Now, this IP address can be used to connect to the Raspberry Pi over SSH on the command line. Connect by running the command `ssh <user>@<IP address>`, which with a user called `pi` and an IP address of 192.168.1.108 would be Now, this IP address can be used to connect to the Raspberry Pi over SSH on the command line. Connect by running the command `ssh <user>@<IP address>`, which with a user called `kaskelotti` and an IP address of 192.168.1.108 would be
``` ```
ssh pi@192.168.1.108 ssh kaskelotti@192.168.1.108
``` ```
When asked `Are you sure you want to continue connecting (yes/no/[fingerprint])?`, type `yes` and press Enter. Then, write the Raspberry Pi user's password when asked and press Enter. When asked `Are you sure you want to continue connecting (yes/no/[fingerprint])?`, type `yes` and press Enter. Then, write the Raspberry Pi user's password when asked and press Enter.
After successfully connecting, your prompt should change to `<user>@raspberrypi:~` or something similar. After successfully connecting, your prompt should change to `<user>@<hostname>:~` or something similar.
#### 2.3 Run the installer script ### 6. Verifying that services are running as expected
After establishing the SSH connection to the Raspberry Pi, change the current directory to the location of the installer script and run it: TODO
``` ## Updates & deployments after first time setup
cd /boot/hydrophonitor/scripts
./setup-raspberry-pi.sh
```
At the end of successful configuration, the script should print "### Setup ready, run 'sudo reboot' to apply all changes". Run the command and input the Raspberry Pi user's password if requested: TODO
``` ### Making changes
sudo reboot
```
This will restart the Raspberry Pi and apply the changes made in the setup. On startup, it should now start recording audio, GPS and depth data. TODO
### 3. Set up the real time clock module ### Deploying changes to the Raspberry Pi
There are two scripts that configure the Raspberry Pi to read its system time from the RTC module. TODO
The first part enables the i2c interface (bus 3 with SDA at GPIO pin 23 and SCL at GPIO pin 24) and loads the needed hardware modules at boot. After that, a reboot is needed to enable the hardware interface. The second part updates the hardware clock module time and configures the Raspberry Pi to set the hardware clock time as the system time on startup.
Connect to the Raspberry Pi over ssh, navigate to the home directory, and run the script with following commands:
```
ssh <username>@<IP>
cd $HOME
./hydrophonitor/scripts/setup-rtc-1.sh
sudo reboot
```
```
ssh <username>@<IP>
cd $HOME
./hydrophonitor/scripts/setup-rtc-2.sh
```
### 4. Configuration options
todo
### 5. Mount SSD
todo
## Test & run
todo