Pi4 with Raspbian Bookworm: Difference between revisions

From Global Meteor Network
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 30: Line 30:


== Connect a Camera ==
== Connect a Camera ==
Out-of-the box, Bookworm can connect to any camera attached to your network. So, for testing you should be able to plug the camera into your router and supply power to it. If you prefer to connect the camera directly to the Pi, jump ahead to [#Connecting_a_Camera this] section.
Out-of-the box, Bookworm can connect to any camera attached to your network. So, for testing you should be able to plug the camera into your router and supply power to it. If you prefer to connect the camera directly to the Pi, jump ahead to [https://globalmeteornetwork.org/wiki/index.php?title=Pi4_with_Raspbian_Bookworm#Direct_Camera_connection this] section.


== Install RMS ==
== Install RMS ==

Revision as of 07:29, 14 May 2024


Burn an SD Card

  • Download the Raspberry Pi Imager from https://www.raspberrypi.com/software/
  • Run the tool, select your model of Pi, then select Bookworm 64-bit.
  • Select your SD card and click Next and then Edit Settings. Make the following changes:
    • If you know your station ID set the Hostname to match it but in lower case. For example if your station is UK1234 set the hostname to uk1234
    • otherwise set the hostname to be something you'll remember
    • Set the username to rms and enter a password of your choice. Remember this!
    • Add your Wifi network details
    • Set the locale to UTC and the keyboard layout to match your keyboard.
    • save settings, and on the next screen click Yes and then Yes again
  • Once the image has been burned, insert the SD card into your Pi power it on. The Pi will reboot a few times as it sets things up.

Configure the Operating System

  • Login as the rms user you created above and run the following commands to install the system libraries required by RMS.
sudo apt-get install -y cmake git mplayer python3 python3-dev python3-tk python3-pip libblas-dev libatlas-base-dev liblapack-dev at-spi2-core libopencv-dev libffi-dev libssl-dev socat ntp libxml2-dev libxslt-dev imagemagick ffmpeg qt5-qmake python3-pyqt5 libqt5gstreamer-1.0-0 python3-pyqt5.qtmultimedia qtgstreamer-plugins-qt5 libqt5gstreamer-dev libqt5gstreamerui-1.0-0 libqt5gstreamerutils-1.0-0 python3-opencv libcairo2-dev
sudo apt-get install -y gobject-introspection libgirepository1.0-dev
sudo apt-get install -y gstreamer1.0-libav gstreamer1.0-plugins-bad
  • now create a python environment for RMS and ensure its always active:
python -m venv ~/vRMS
echo source ~/vRMS/bin/activate >> ~/.bashrc
echo cd ~/source/RMS >> ~/.bashrc

We recommend at this point you reboot the pi to pick up all the changes you've just made.

sudo reboot

Connect a Camera

Out-of-the box, Bookworm can connect to any camera attached to your network. So, for testing you should be able to plug the camera into your router and supply power to it. If you prefer to connect the camera directly to the Pi, jump ahead to this section.

Install RMS

  • Login to the Pi again and download the code:
mkdir ~/source
cd ~/source
git clone https://github.com/CroatianMeteorNetwork/RMS.git
  • Activate the python environment, if not already active. The prompt will change to (vRMS) rms@yourhostname: if its active.
source ~/vRMS/bin/activate


  • Now, set up Python in the environment we just created:
cd ~/source/RMS
pip install -U pip setuptools
pip install -r requirements.txt
  • Configure git so that the script can stash changes in the repo and update the code:
git config --global user.email "rms@gmn.uwo.ca"
git config --global user.name "RMS"
  • Ready the RMS software for use. This may take some time as the app is built and installed.
cd ~/source/RMS
python setup.py install
./Scripts/GenerateDesktopLinks.sh

Configure RMS

  • Fnd your coordinates on the globe. Your location needs to be known very accurately to 5 decimal places for Meteor Science. Use GPS for this or an accurate map. Put this information in the .config file in the RMS directory. If you already have a stationID you can add this to the config file too.
nano ~/source/RMS/.config
  • Now run RMS for the first time. You will be asked to confirm a number of system settings. You don't need to expand the filesystem so you can skip over that step.
 ./Scripts/RMS_FirstRun.sh

NB: If you have no station-ID yet, request one with the instructions shown on screen and then abort the script by pressing the Ctrl-C key combination. Once you have your station ID, add it into the .config file and rerun this step.

  • Once you've finished the configuration steps, RMS will run an automated update and installation step. Eventually, you'll see a message that RMS is starting up. Let it start up to ensure there are no problems, then once its either waiting for night, or already capturing images, stop it by pressing Ctrl-C and letting the script run its tidy-up steps.

Direct Camera connection

The simplest approach is to connect the camera to your router. However, ff you have no wired network available you could connect the camera to the Raspberry directly and then connect the Raspberry Pi to your network over Wifi. If you want to do this, proceed as follows:

1. First, install the DHCP server:

 sudo apt-get install -y isc-dhcp-server

2. Edit the DHCP configuration file:

 sudo nano /etc/dhcp/dhcpd.conf

We need to add a fixed address for the camera, so append this at the end of the file:

 subnet 192.168.42.0 netmask 255.255.255.0 {
   authoritative;
   pool {
 	  range 192.168.42.10 192.168.42.10;
   }
   option broadcast-address 192.168.42.255;
   default-lease-time 600;
   max-lease-time 7200;
   option domain-name "local";
 }

This will assign a fixed IP address 192.168.42.10 to the camera.

3. Edit the DCHP server configuration so it will only listen to the ethernet interface. Open the file:

 sudo nano /etc/default/isc-dhcp-server

and edit the line with INTERFACESv4 by adding "eth0":

 INTERFACESv4="eth0"

4. Next, we need to give the ethernet interface the proper subnet. Open:

 sudo nano /etc/dhcpcd.conf

and add this at the end of the file:

 interface eth0
 static ip_address=192.168.42.1/24

This will give the ethernet interface a static IP address.

5. Finally, the DHCP server will try to run before the ethernet interface is up, which will produce an error. We can tell it to try again, until it is successful. Run the following commands:

 sudo cp /run/systemd/generator.late/isc-dhcp-server.service /etc/systemd/system
 sudo nano /etc/systemd/system/isc-dhcp-server.service

Edit the [Service] section:

  • set Restart=on-failure
  • add RestartSec=5 to instruct systemd to wait 5 seconds before restarting a failed service.

Add the [Install] section which is missing, and add the follow line to it:

 WantedBy=multi-user.target

Run the commands:

 sudo systemctl daemon-reload
 sudo systemctl disable isc-dhcp-server
 sudo systemctl enable isc-dhcp-server

6. Reboot so to test the configuration:

 sudo reboot

Make sure the camera is connected to the Pi’s ethernet interface, and that a fixed IP address of 192.168.42.10 is set on the camera.

7. Now, if you run arp -a, you will be able to see the IP camera: ? (192.168.42.10) at 00:12:16:b6:79:db [ether] on eth0 If not, check the status of the DHCP server service:

 sudo service isc-dhcp-server status

The service should be active.


(more to come)