-
Notifications
You must be signed in to change notification settings - Fork 2
Getting started
This project is based around the Raspberry Pi platform. The setup that was/is used to develop this software is a Raspberry Pi 3 Hub connected to multiple Raspberry Pi Zeros via USB in ethernet emulation mode. all Raspberry Pis have Camera Modules connected (I mean how else do you actually take pictures....)
The hub is the computer that will store all images from the cameras, it is responsible for letting the cameras know when to take images and will respond to external application requests (such as transferring images, deleting projects, getting the scanner status, etc.).
The camera is really just the name for an external device that is responsible for taking images and sending them to the hub.
If you want to set this up using non Raspberry hardware you will need to keep in mind that this project uses C# so if you are using linux mono compatibility is a must and will require each camera to be networked to the hub via a static IP. The hub will also need to be able to connect to an external computer if you want to make use of the remote capabilities, this can take the form of WiFi or ethernet (or something else as long as you can ping it it should be fine).
I will assume that you are using a Raspberry Pi 3 as the hub and the Pi zero as cameras.
- A Raspberry Pi 3 (or any other pi that has the capability of connecting to multiple devices)
- Between 1 to 4 Raspberry Pi Zeros (limited by the amount of USB ports of the Pi 3)
- 2 USB micro cables per Pi Zero (One for power and one for data)
- SD cards for all Pis. Preferably with the SD card for the Hub being larger (as it has to store the images).
- A Camera module for every Pi
First you will need to install raspbian on the SD cards and enable SSH for all of them (Especially the Pi zeros as USB devices won't work ).
On the SD cards for the Pi Zeros you will need to enable USB ethernet, Here is a good guide on how to do this.. Once this is done boot them up and connect to the Pi Zeros using an SSH tool like Putty. You should be able to connect via the raspberrypi.local
.
Once you are connected you need to setup a static IP address so that the Hub will be able to talk to the camera. Do this by editing the dhcp config file using this command sudo nano /etc/dhcpcd.conf
, This will open the file in a basic text editor. You then need to add the static IP to the bottom of the file like this:
interface usb0
static ip_address=192.168.0.5
This tells linux that the usb port should always have the IP address of 192.168.0.5
. You will have to repeat this for each Pi Zero. However you should use a different IP address each time. something like 192.168.0.6
or 192.168.0.7
, etc. As long as they don't collide it will work fine.
The hub will need to access every camera that it is connected too. To do this we will have to setup the network connections. Connect to the Pi 3 via an SSH connection and check what is currently connected using this command ifconfig
This will list all of the interfaces with some network information like ip address. This should show you 3 interfaces; eth0 (ethernet), lo, wlan0 (Wifi). Connect one of the Pi Zeros to the Pi 3's USB ports (make sure that you plug in the micro USB port into the USB port on the Pi Zero not the PWR IN port.). It might take a second for the new Pi to boot and become recognised as an ethernet adapter so wait 30 seconds or so and run the ifconfig
command again. You should see a new device called usb0 (if not just wait a little longer and retry).
Now the Pi Zero is connected but it is not ready to use yet! Since it is connected directly we need to tell the Pi 3 to also use a static IP to talk to each camera. To do this we go to the dhcp config file like before using sudo nano /etc/dhcpcd.conf
and add some more configurations to the bottom (this is very similar to what we did for the Pi Zeros)
interface usb0
static ip_address=192.168.0.1
You will need to add this for each of the Pi Zeros except that the usb number will increase, so the second camera will get the network interface usb1
and so on, Just for good practice assign each one a different static IP just make sure that it is not the same as any of the camera IPs as that will cause a conflict!
After you have done this for every camera and plugged all of them in you should be able to ping them using ping 192.168.0.x
depending on the ip address that the Pi zeros are set too. Make sure that you can ping every camera you intend to use as it will save you a lot of trouble shooting later!
Up till now all of the setup has really been about getting the Pis to talk to each other. Now we need to configure the actual software that will be running to take the pictures.
First we need to download the Multi Capture softwarefrom github here download the zip file of the latest release as this will include everything that is needed to run this.
Now extract the contents of the Zip file. It should contain a folder called Hub and a folder called Camera. Each contains all the files for the respective systems. You need to transfer the Camera folder to each of the Pi Zeros (my prefered tool for this is WinSCP), Since you now have the Pi Zero configured to use a static IP you may have to change the settings on the computer so that you can communicate fully. Here is a guide for setting up static IP on windows (and mac if you scroll up a bit).
Once you have connected to the Pi using WinSCP open an SSH connection (like you have done before) and create a new folder in the root of the Pi sudo mkdir /camera
this will create a new folder called camera in the root of the pi. Now you need to give the pi user permission to use this folder so run this command sudo chown pi:pi /camera
. In the WinSCP window go to the new camera folder by clicking the "/" icon in the toolbar on the right you should see a bunch of folders including the camera folder. Copy the contents of the Multi Capture Camera folder into this folder by dragging and dropping it in.
todo update raspbian, install mono todo launch camera exe, configure camera port, add to startup todo copy hub exe to hub and launch todo configure hub config and add to startup