Published using Google Docs
AusOcean Underwater Camera Assembly Guide: Pi Edition
Updated automatically every 5 minutes

 

AusOcean Underwater Camera Assembly Guide:
Pi Edition

Revised: 18th March 2020

Author(s):

Alan Noble <alan@ausocean.org>

Saxon Nelson-Milton <saxon@ausocean.org>

Scott Barnard <scott@ausocean.org>

Trek Hopton <trek@ausocean.org>

Underwater camera electronics


Copyright

Copyright © The Australian Ocean Laboratory Limited (AusOcean) 2020.

The information contained herein is licensed under a Creative Commons Attribution 3.0 Australia License.

Notice

AusOcean is not liable for any losses, damages, costs and/or other consequences resulting directly or indirectly from using or relying on the information in this document.


Table of contents

1.0 Introduction        4

1.1 Related documents        4

2.0 Parts        5

3.0 Assembly        7

3.1 Pi Setup        7

Materials        7

Instructions        7

On the raspberry pi zero:        8

3.2 Viewing window        9

Materials        9

Instructions        9

3.3 Cable connection        10

Materials        10

Instructions        10

3.4 Camera electronics        12

Materials        12

Instructions        12

3.5 Final Assembly        13

Materials        13

Instructions        14

4.0 Usage & Testing        14


1.0 Introduction

The AusOcean Underwater Camera is a low-cost Internet Protocol (IP) digital video camera designed for continuous immersion up to depths of 20m (65’). Unlike most consumer video cameras it is designed for continuous streaming of video data. It can be configured to stream to YouTube for viewing or to VideoGrinder (on App Engine) for storage and analysis.

The underwater camera is based on the Raspberry Pi Zero and the Raspberry Pi Camera and can be built for A$60 (US$40) in electronic parts and A$10 in PVC and acrylic parts.

1.1 Related documents


2.0 Parts

Item

Picture

Purchase info

Raspberry Pi Zero (and sd card)

Core electronics item

Raspberry Pi Camera Board V2

Core electronics item

2-pin JST header

AusOcean, DigiKey

Raspberry Pi Zero Camera Ribbon Cable

Core electronics item

DC-DC step-down voltage regulator

JayCar item

Micro USB Ethernet adapter

eBay

Small rectangular acrylic sheet 62mm x 100mm x 5mm

Plastics store or ebay

M3 screws, nuts, bolts

Jaycar

150mm length of 65mm-diameter stormwater PVC pipe.

Hardware store

65mm-diameter PVC end caps x 2

Hardware store

C5 connection parts

See C5 Guide

Acrylic[1] viewing window

AusOcean or plastics store.


3.0 Assembly

Here we consider the assembly process for 4 “sub-assemblies”; the software setup required by the camera, the viewing window, the cable connection and finally the electronics. Then we look at how to bring these components together to get a finished product.

3.1 Pi Setup

The following section looks at the software setup for the Pi Zero. The Pi Zero will operate using an image of the linux OS design for raspberry pis, Raspbian. On this we run AusOcean’s RV software that will handle recording, packetisation and forwarding of video to a server.

Materials

  1. SD card (16GB at least)
  2. Raspberry Pi Zero
  3. Micro USB Ethernet Adapter
  4. Micro USB to USB Adapter
  5. Mini HDMI to HDMI Adapter
  6. Computer

Instructions

  1. Download the Raspberry Pi Imager for your OS. Insert the SD into your computer and use the Raspberry Pi Imager to flash Raspbian lite onto the SD card.
  2. Connect the pi to a keyboard with a micro USB to USB adapter, and to a monitor with a mini HDMI to HDMI adapter.
  3. Connect the pi to power to turn it on and log in with username: pi and password: raspberry.
  4. Use the following command to enter the raspi configuration UI:

$ sudo raspi-config

  1. Go to “localisation options”->”keyboard layout” and select your keyboard type. If your keyboard is not there, select a generic model. You will then need to select a region. Select Other -> English (US). For the next two options, keep the defaults.
  2. Now select “Change User Password”. Set username and password to something of your choosing. NOTE THIS DOWN!
  3. Go to “interfacing options”->”camera” and follow prompts to enable camera.
  4. Again go to “interfacing options”->”SSH” and follow prompts to enable SSH. SSH is useful for debugging the Pi in future, or to do remaining steps.
  5. Reboot the Pi.
  6. Use the following command to open the network configuration file:

$ sudo nano /etc/dhcpcd.conf

  1. Go down to the bottom of the file and uncomment all the lines in the last two sections except the first line of each section. It should look something like this:

# It is possible to fall back to static IP if DHCP fails

define static profile

profile static_eth0

static ip_address=192.168.1.23/24

static routers=192.168.1.1

static domain_name_servers=192.168.1.1

#fallback to static profile on eth0

interface eth0

fallback static_eth0

  1. Set the subnet (number in bold above) to something other than the subnet that your wifi is using, otherwise there will be network conflicts.
  2. Save the changes to file by pressing ctrl+x then y then Enter.
  3. For the next steps your pi will need to be connected to the internet and you will need to log in via ssh on your computer. 
  4. Find your pi’s IP address using the command:

$ ifconfig

You should see a section that looks something like this:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.120  netmask 255.255.255.0  broadcast 192.168.1.255

        inet6 fe80::7179:a11e:8efe:daac  prefixlen 64  scopeid 0x20<link>

        ether 00:e0:4c:53:44:58  txqueuelen 1000  (Ethernet)

        RX packets 79  bytes 5922 (5.7 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 74  bytes 9068 (8.8 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The IP address here is 192.168.1.120. Write yours down.

  1. Remove the keyboard and plug in the micro USB ethernet adapter. Open a terminal window and ssh into the pi with this command (replace your_IP_address with your ip address):

$ ssh pi@your_IP_address

Log in with the password you set earlier.

  1. Now we’ll perform some steps to install golang. Firstly perform the following:

$ sudo apt-get update

$ sudo apt-get -y upgrade

  1. Now get the golang zip:

$ wget https://dl.google.com/go/go1.13.5.linux-armv6l.tar.gz

  1. Unzip the package using:

$ tar -xvf go1.13.5.linux-armv6l.tar.gz

  1. Move to the right location:

$ sudo mv go /usr/local

  1. Open .profile file using:

$ sudo nano ~/.profile

  1. And add the following lines to the end of the file:

export GOROOT=/usr/local/go

export GOPATH=$HOME/go

export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

Save changes by pressing ctrl+x then y then Enter.

  1. Update session using:

$ source ~/.profile

  1. Check go installed using:

$ go version

  1. Install git:

$ sudo apt install git

Verify that it is installed by typing:

$ git --version

  1. Create directory structure:

$ cd ~

$ mkdir -p go/src/bitbucket.org/ausocean

  1. Enter the created directory:

$ cd go/src/bitbucket.org/ausocean

  1. Clone the AusOcean av repository:

$ git clone https://bitbucket.org/ausocean/av

  1. Install ffmpeg:

$ sudo apt install ffmpeg

Verify the install using:

$ ffmpeg -version

  1. NOTE THIS STEP DOES NOT NEED TO BE DONE IF MOTION DETECTION WILL NOT BE USED WITH THIS CAMERA Install gocv using the following guide. Note: This is very time consuming and can take many hours.

On the raspberry pi 3:

$ nohup make install_raspi &

On the raspberry pi zero:

$ nohup make install_raspi_zero &

Note: $ <some command> & is used for running the process in the background. This is needed because the installation is very time consuming, and we don’t want the process stopped when closing the ssh connection.

Note: To view the standard out using

$ less nohup.out or

$ tail -f nohup.out

If you make a mistake, remove opencv using

$ sudo rm -rf /tmp/opencv

  1. Build rv, the software that will record and handle video:

$ cd ~/go/src/bitbucket.org/ausocean/av/init

$ sudo make install_hard

  1. Build rv:

$ cd ~/go/src/bitbucket.org/ausocean/av/cmd/rv

$ go build --tags circleci

  1. Find your MAC address using:

$ ifconfig

Then create the netsender config file using:

$ sudo touch /etc/netsender.conf and

$ sudo nano /etc/netsender.conf

Then paste in the following data:

ma <mac address>

dk 0

wi

ip V0

op

mp 3

ap 0

tg

hw

sh vidgrind.appspot.com

3.2 Viewing window

The viewing window will allow the Raspberry Pi Camera to see out of the underwater housing. It is made by gluing an acrylic disk to a PVC cap that has a hole on its surface. This is arguably the most important process in determining the housing waterproofness; if the fabrication method is not followed correctly, the viewing window bond will leak.

Materials

  1. 50mm diameter acrylic disk
  2. Weld-on 16 solvent
  3. 65mm PVC cap
  4. Sandpaper (multiple grades)

Instructions

  1. Cut a 20mm-diameter hole into the center of the cap.
  2. Sand the outside of the cap, firstly with a low grit sandpaper to remove the protruding label, and then smooth out with a high grit sandpaper.
  3. Apply tape to the centre of the acrylic disk to ensure we do not scratch or glue the area where the camera must see out of.
  4. Sand at least 10mm of the outer edge of the acrylic disk with a medium grit paper, avoiding scratching the centre.
  5. Glue the 50mm acrylic disk on the outside of the cap using a generous amount of glue. Apply ample pressure to the viewing window for 24 hours. AusOcean found the weight of a 12V car battery to be adequate.

5

3.3 Cable connection

Materials

  1. 65mm PVC cap
  2. Materials for C5 connection
  3. C-6 waterproof cable

Instructions

  1. Make a C5 connection on a cap, feeding at least 10cm of cable through. Gently sand the cable where it passes through the cylinder.
  2. Remove about 10 cm of the insulation surrounding the wire using a wire stripper. This can also be done carefully with a knife or scissors.
  3. Separate the orange and green wires from the blue and brown wires.
  4. On the inside, gently arrange the wires as shown in the photo. Ensure the bends in the wires are not too tight, this will cause breakage. Crimp the orange/green data connectors with an RJ-45 plug. The diagram below shows the pin order as viewed from the side of the plug with the spring. Only pins 1, 2, 3 and 6 are crimped into the RJ-45 plug. The blue/brown PoE wires should be left as is, as they will be later connected to the voltage regulator.

1

2

3

4


3.4 Camera electronics

Materials

  1. Raspberry Pi Zero (with SD card)
  2. DC-DC Step Down Voltage Regulator
  3. Raspberry Pi Camera Board V2
  4. Raspberry Pi Zero Camera Ribbon Cable
  5. Micro USB Ethernet Adapter
  6. Epoxy putty

Instructions

  1. Cut a small piece of clear acrylic sheet into a 62mm x 100mm rectangle.
  2. Orient the acrylic rectangle in a landscape fashion.
  3. Predrill two 2mm holes for the Pi Camera in the center of the right side of the rectangle.
  4. Predrill a 3mm hole for the Pi Zero 27mm from the bottom and 33mm from the left side of the rectangle
  5. Predrill a 3mm hole for the DC step down regulator 10mm from the left and 8mm from the top.
  6. Cut an 8mm hole in the rectangle 42mm from the right and 10mm from the top, directly opposite to where the micro USB port used by the ethernet adapter will be when screwed into place. Then cut from the edge to the hole to create an opening for the USB cable to pass through to the underside of the board.
  7. Solder a 2-pin JST male socket to the Pi Zero power pins.
  8. Make up a power cable that connects the output of the DC step down regulator to the JST header and solder wires to the inputs.
  9. Set the step down voltage to 5.0V. This is done by connecting a 24V power supply to the input and a multimeter to the output. Turn the potentiometer (small screw on blue component) until 5V is shown on the multimeter.
  10. Connect the Pi Camera to the Pi Zero using the Pi Camera ribbon cable. Make sure the connections are well in place, and test the camera using raspistill.
  11. Secure the ribbon cable connections with the epoxy putty.[2] The epoxy need only cover some of the ribbon cable and connector. Let this cure until hard to touch. NOTE: do not use a low viscosity glue; it can cover the ribbon cable contacts and cause hardware interfacing issues.
  12. Plug the micro USB ethernet adapter into the pi zero.
  13. Plug the DC step down regulator’s output into the JST header on the pi.
  14. Now is a good time to test the pi to make sure everything is working. Using an ethernet cable, connect the micro USB adapter to a router which is connected to the internet. Power on the pi by supplying 24V to the input of the DC step down regulator. You should see a red light flashing in the ethernet adapter. This indicates that data is being transferred. Revid should start to run and you should be able to observe the stream at the configured destination.
  15. Secure the Pi Zero onto the rectangle using a 12mm bolt and nut through the hole drilled for the Pi Zero.
  16. Secure the micro USB ethernet adapter into the socket on the pi with epoxy putty to ensure that it stays in place with a solid connection.
  17. Screw the Pi Camera into the right side with 10mm screws.
  18. Screw the DC step down regulator into its position with a 12mm bolt and nut.
  19. Use two 3-pin gel connectors to connect the input power wires on the regulator to the power wires from the ethernet cable, red to blue/blue-white, and black to brown/brown-white.
  20. Plug in the RJ-45 ethernet plug to the USB-ethernet adapter ensuring that you hear it click into place.

1 - 6

7

8

10 - 12

     

11 and 16

19 - 20

3.5 Final Assembly

Important: Do not glue together the camera until the SD card has been inserted and the camera has been tested.

Materials

  1. Cap with C5 connection
  2. Cap with viewing window
  3. 150mm of 65mm PVC pipe
  4. Electronics board
  5. PVC cement

Instructions

  1. Glue the viewing window end cap onto the tube. Be generous with the PVC cement, such that a little bit oozes out of the connection when compressed. Be careful not to get PVC cement on the viewing window. Leave this to cure for 24 hours (this can happen while testing the camera).
  2. Carefully slide the electronics assembly into the tube, ensuring that the ethernet adapter is on the underside.
  3. Focus the Pi Camera. This can be performed using the white adjusting wheel provided with Pi Cameras. It is recommended to focus the camera to about half the distance of average visibility for the location of use.
  4. Test camera thoroughly. We recommend running the camera for a day before performing the final glueing step.
  5. Glue on the end cap. Hold it steady and apply good pressure for 5 minutes.

<PHOTOS>

4.0 Usage & Testing

To control the camera and receive video to a destination of your choosing, there must be a netreceiver/vidgrind site for which the camera is registered to. This may be defined on either a local or remote instance of netreceiver/vidgrind. To create a site and/or add a device, see the Could Configuration Guide. The camera can then be controlled using “variables”; see the RV Software Guide.

5.0 Appendices

5.1 Appendix A: SSH into Pi

  1. Connect the Pi to your local network using the micro USB ethernet adapter.
  2. Using your computer and NMAP or similar, find the IP address of the Pi.

$ nmap -sP 192.168.1.0/24

  1. Connect to the raspberry Pi with ssh. The default password will be raspberry. On linux, use the command:

$ ssh pi@<ip address of rpi>

On windows use PuTTY.


[1] AusOcean uses special UV-transmitting acrylic.

[2] This may seem excessive, but the connections are not rigid, any movement can cause issues. Once the housing is sealed, it will need to be cut open to fix any problems.