-
Notifications
You must be signed in to change notification settings - Fork 49
RaspPi: Connecting the computer Pi and camera Pi
To support a two Pi setup, with one Pi located in the computer box and the other Pi located in the camera box, we need to connect the two via an ad-hoc wireless connection. To do this you will need keyboard/monitor access to each Pi first so that you can get things properly set up.
This document assumes you have followed the guide on how to setup the Pi for POCS.
Note that this will also prevent you from using the regular wireless access. The assumption is that the computer box Pi (pi-comp-box
) will have a wired ethernet connection.
Throughout this document we refer to the Pi in the computer box as pi-comp-box
and the Pi in the camera box as pi-cam-box
.
We will be using the answer found on the following guide, which describes how to change your /etc/network/interfaces
file. You must use sudo
to edit these files.
On each Pi, edit the file using sudo nano /etc/network/interfaces
and make it look like the following. Note that the only difference between the two boxes is the address 192.168.1.x
, where the x
changes between the two.
pi-comp-box
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
# PANOPTES Setup
# Dynamic wired connection
auto eth0
iface eth0 inet dhcp
auto lo
iface lo inet loopback
# Ad-hoc wireless
auto wlan0
iface wlan0 inet static
address 192.168.1.4
netmask 255.255.255.0
wireless-channel 1
wireless-essid panoptes-net
wireless-mode ad-hoc
pi-cam-box
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
# PANOPTES Setup
# Dynamic wired connection
auto eth0
iface eth0 inet dhcp
auto lo
iface lo inet loopback
# Ad-hoc wireless
auto wlan0
iface wlan0 inet static
address 192.168.1.5
netmask 255.255.255.0
wireless-channel 1
wireless-essid panoptes-net
wireless-mode ad-hoc
We want the Pis to be able to refer to each other by an easy to remember name rather than the IP address we assigned in the previous step. To do this we add a hosts
entry on each box that refers to the other box.
pi-comp-box
echo "192.168.1.5 pi-cam-box " | sudo tee -a /etc/hosts
pi-cam-box
echo "192.168.1.4 pi-comp-box " | sudo tee -a /etc/hosts
We want to be able to log into the pi-cam-box
from pi-comp-box
without bothering with passwords. To do this we will generate an SSH key on pi-comp-box
and copy that to pi-cam-box
. Generating the key will prompt you for a passphrase, which you should leave blank (by pressing Enter
).
pi-comp-box
# Generate SSH key
ssh-keygen
# Copy to pi-cam-box - you will be asked to enter password
ssh-copy-id pi-cam-box
After you have copied the key you should test the ssh connection:
pi-comp-box
ssh pi-cam-box
This should log you in and you will see your shell change to reflect that you are now logged on to the camera Pi box. You can type exit
to leave and go back to the computer Pi box.