Published using Google Docs
AusOcean Fluid-filled Pressure-compensating Underwater Camera (FPUC) Guide
Updated automatically every 5 minutes

 

AusOcean Fluid-filled Pressure-compensating Underwater Camera (FPUC) Guide

Revised: 13/02/2023

Author(s):

Saxon Nelson-Milton <saxon@ausocean.org>

Trek Hopton <trek@ausocean.org>

Frank Cui <frank@ausocean.org>

Breeze del West <breeze@ausocean.org>


Copyright

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

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        3

2.0 Fabrication and Assembly        4

2.1 Pi Software Setup        4

Materials        4

Initial Software Installation        5

Installing Raspbian        5

Configuring the Pi Zero        6

Connecting your Pi to the Internet        13

On the raspberry pi zero:        25

2.2 Viewing window        26

Materials        26

Instructions        26

2.3 Rear Cap        29

Materials        30

Instructions        32

2.4 Housing Body        33

Materials        33

Instructions        34

2.5 Cable Plug        34

Materials        35

Instructions        35

2.6 (STANDARD SENSOR) Inner Camera Enclosure        38

Materials        40

Tools and Equipment        41

Instructions        41

2.6 (WIDE ANGLE SENSOR) Inner Camera Enclosure        45

Tools and equipment        47

Materials        47

2.7 (STANDARD) Camera Electronics        56

Materials        57

Instructions        57

2.7 (SPUC CONNECTED) Camera Electronics        60

Materials        60

Instructions        60

2.8 Final Assembly        61

Materials        62

Instructions        63

— If using an imaged SD card, assemble camera and start here –        70

3.0 Usage & Testing        71

3.1 Configuring Camera to VidGrind        76

3.2 Broadcasting        77

3.3 Use with AusOcean Rig        82

4.0 Appendices        82

4.1 Appendix A: SSH into Pi        82

4.2 Appendix B: Focusing the raspberry pi camera.        83

4.3 Appendix C: Using system images for the raspberry pi        85

Setting up SD card with an image        85

Creating an SD card image        86

Writing an image file to an SD card        86


1.0 Introduction

The AusOcean Underwater Camera is a low-cost IP video camera designed for continuous immersion up to depths of 20m. 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 VidGrind (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 approximately A$250 in parts.

This version of the underwater camera adopts pressure compensation techniques to achieve water tightness. This entails a PVC housing filled with mineral oil and a pressure compensation membrane. This allows the inner pressure to be approximately equal to the outer pressure at depth, reducing the tendency for the liquid mediums to cross the seals.

2.0 Fabrication and Assembly

2.1 Pi Software 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

Micro SD card (16GB at least)

Micro SD to SD Adapter

Raspberry Pi Zero (no wifi)

                                                         

Micro USB to eth adapter

Micro USB to USB adapter

Micro USB cable

Mini HDMI to HDMI adapter

HDMI Cable

USB wall charger

Monitor or TV (with HDMI cable)

USB Keyboard

Laptop or PC (With a Linux OS)

Initial Software Installation

Installing Raspbian

1

On your computer, download the Raspberry Pi Imager. This is a program that will help you install the operating system onto your SD card. Choose the right option for your operating system.

2

Also download this specific Raspberry Pi OS: Raspberry Pi OS Lite (Legacy), scroll down until you find it on the raspberry pi operating systems page. This is the specific version of the operating system you will need to use.

3

Insert the SD into your computer.

Note: you may need to use an SD card adapter.

4

Open Raspberry Pi Imager and flash that OS onto the SD card.

If installing for the first time you will need to run through the installation set-up.

Once downloaded, select finish.

5

CHOOSE OS ->

Note: Versions newer than Buster are not compatible with the rv software.

Use Custom ->

Select previously downloaded image file.

CHOOSE STORAGE ->

SDHS Card ->

WRITE ->

YES ->

CONTINUE ->

Remove the SD card from your laptop.

Configuring the Pi Zero

1

Insert the SD card into the Pi

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.

You can plug the other end of the micro USB cable into a USB wall charger.

3

Once the Pi is connected to power the green light will come on. If connected correctly the Raspberry Pi terminal window will appear. Log in with:

username: pi

password: raspberry

4

Use the following command to enter the configuration UI: sudo raspi-config

5

Use your keyboard arrows to navigate up and down, use the enter key to select the option. Go to localisation options  ->

Keyboard layout ->

Generic 105-Key PC (intl.)->

You will then need to select a region. Select Other -> English (US)

For the next two options, keep the defaults.

6

Now select System options ->

Change User Password. Set the password to something of your choosing, you will need to input the password twice.

Note: You must remember this password, so write it down for later.

7

Go to interface options ->

Select camera and follow prompts to enable camera.

YES ->

OK->

8

Again go to interface options -> 

SSH and follow prompts to enable SSH. This will allow you to login and control the pi from your computer later when it is connected to the network.

9

Select finish to reboot the Pi.

10

Use the following command to open the network configuration file:

sudo nano /etc/dhcpcd.conf

Connecting your Pi to the Internet

  1. Scroll down to the bottom of the file and uncomment (remove the # on) 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 red and bold above) to something other than your wifi subnet otherwise there will be network conflicts.

Note: In the AusOcean system that number is 1 so we change the number to any other single digit number e.g. 2. In your school system it may be a different number, change yours accordingly.

  1. Save the changes to file by pressing ctrl+x then y then Enter.
  2. For the next steps your pi will need to be connected to the internet, to achieve this replace the keyboard USB  with a micro USB ethernet adapter and connect it to your router with an ethernet cable.

ON WINDOWS:

  1. Download nmap
  2. Open command prompt (i.e. on your windows laptop), to find <gateway IP> use the command:

$ ipconfig

You should see a section that looks similar to this:

Wireless LAN adapter Wi-Fi:

 Connection-specific DNS Suffix  . : lan

 Link-local IPv6 Address . . . . . : fe80::1e29:ebb4:66ee:bd3b%18

 IPv4 Address. . . . . . . . . . . : 192.168.1.222

 Subnet Mask . . . . . . . . . . . : 255.255.255.0

 Default Gateway . . . . . . . . . : 192.168.1.1

The example gateway IP here is 192.168.1.1.

  1. Open nmap, type in the command section: “nmap -sn <gateway IP>/24”
  2. You should see a list like this:


In this example the pi’s IP address is 192.168.1.175. Look for the (Realtek Semiconductor) label.

Hint: Pi IP address always starts with 00:E0:4C.

  1. Download Putty - https://www.putty.org/ We want to download the 64-bit x86:

MSI (‘Windows Installer’)

64-bit x86: putty-64bit-0.78-installer.msi

  1. Go through the installation window and click install.
  2. Once installed, launch Putty and type in the IP address in the host name section. Click open.

  1. The Terminal will open.

Login as: pi

Enter your password from earlier.

Press enter.

Note: If you get the message “authenticity of host … can’t be established”, type “yes” and press enter.

  1. Go to step 8 in the Linux instructions and continue on with the steps.

ON LINUX:

  1. On your computer terminal (i.e. on your linux laptop), to find <your IP> use the command:

$ ifconfig

You should see a section that looks similar to 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 example IP address here is 192.168.1.120

  1. On your computer terminal, find your pi’s IP address using the command:

$ nmap -sP <your IP>/24

(If not already installed, use the command:

 $ sudo apt install nmap)

The pi’s address should be named “raspberrypi.lan” but may not be named.

  1. To ssh into the pi from your computer use this command: ($ ssh pi@<pi IP>)

<pi IP> is your pi’s ip address.

Note: If you get the message “authenticity of host … can’t be established”, type “yes” and press enter.

  1. Log in with the password you set earlier.

Windows continues here:

  1. Now to install golang and some software tools. Firstly, enter the following commands to update the pi to the latest version:

$ sudo apt update

$ sudo apt -y upgrade

  1. Open a browser window and go to (https://go.dev/doc/install).
  2. Click on the “Other Downloads” link under the download button.

  1. This will take you to a page where you can then find the latest version of the ‘linux-armv6l.tar.gz’ file.

  1. right click on the ‘linux-armv6l.tar.gz’ file link, then select ‘copy link address’.
  2. Execute the command
    $ wget <paste link address here> Press enter.

  1. Input the command:
    $ sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.20.3.linux-armv6l.tar.gz

Note: this may take 30 seconds.

  1. Then:
    export PATH=$PATH:/usr/local/go/bin

  1. Then:
    $ go version

  1. Install git:

$ sudo apt install git

  1. Check git version installed:

$ git --version

  1. Create directory structure for AusOcean software:

$ cd ~

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

  1. Enter the new directory:

$ cd go/src/bitbucket.org/ausocean

  1. Clone the AusOcean av repository:

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

NOTE: STEPS 30 TO 32 DO NOT NEED TO BE COMPLETED IF MOTION DETECTION WILL NOT BE USED ON THE CAMERA.

  1. Install ffmpeg:

$ sudo apt install ffmpeg

  1. Check ffmpeg version installed

$ ffmpeg -version

  1. Install gocv using the following guide. This may take many hours.

On the raspberry pi 3:

$ nohup make install_raspi &

On the raspberry pi zero:

$ nohup make install_raspi_zero &

The command & is used for running the process in the background. This is necessary as the installation time is very long and we don’t want it to be stopped when terminating  the ssh connection from the computer to the pi.

To view the standard out:

$ less nohup.out

or

$ tail -f nohup.out

If you make a mistake, remove opencv:

$ sudo rm -rf /tmp/opencv
—----------------- end motion detection steps—--------------------

  1. Go to vidgrind.ausocean.org to register the camera.
  2. Install things for rv, the software that will record and handle video:

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

To see makefile instructions and options view the makefile using cat,

$ cat Makefile

We’ll need to specify the desired mac and device corresponding to this mac after registration of the mac on netreceiver/vidgrind.

$ sudo make install_hard BUILD_TAG=nocv MA=<desired mac address> DK=<device key for registered mac on vidgrind>

Note: This may take several minutes.

  1. Edit the netsender config file and complete:

$ sudo nano /etc/netsender.conf

Paste in the following text in the file:

ma <mac address>

dk <device key>

wi

ip V0,T0

op

mp 60

ap 60

tg

hw

sh vidgrind.appspot.com

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

2.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 threaded PVC cap that has a hole on its surface.

Materials

5mm acrylic sheet

Weld on 16 acrylic cement

90mm PVC Threaded Cap (with o-ring)

Instructions

  1. Sand the cap with low grit sand paper using a power sander or by hand, until much of the protrusions has been removed (see image below). It needs to be flat enough around the edges so that once the hole is drilled, the material left is flat.

  1. Use the grooves on the side of the cap to mark two lines using a ruler. This intersection point is the middle of the cap. Mark this clearly and then drill an M5 pilot hole.

  1. Using a 75mm wide hole saw (with the center twist bit to be placed on the pilot hole) drill a hole in the cap. Remove any burring with a coarse grit sandpaper to make the top surface of the cap flat (this is important for gluing in later steps).

  1. Using the cap, trace a circle of the same size onto a piece of acrylic.

  1. Using a set square, draw tangential lines to create a square

  1. Use a hacksaw to cut out the square marked out around the circle.

  1. Draw approximately tangential lines at the corners of the square cut out.

  1. Fix the acrylic piece between bench and a piece of wood (or similar arrangement) and use a hacksaw to cut off all 4 corners marked out.

  1. Use a belt sander to remove the corners and create an approximately circular shape.

  1. Apply the weld on 16 to the top surface of the cap. There should be enough applied so that it will ooze slightly when the acrylic is applied.

  1. Take one layer of the protective plastic off the acrylic circle. Put the acrylic in place, bare side down, applying some pressure. Make sure you see through the acrylic and check that the glue has covered all of the cap top surface. It should ooze out of the sides. Clean up excess with a paper towel. Leave this for 24 hours to fully set.

  1. Once cured and ready to install on a camera, you may take off the protective plastic.

2.3 Rear Cap

The rear cap of the camera housing provides two threaded sockets; one for the cable plug and the other for the pressure compensating membrane plug.

Materials

PVC Pressure Pipe Plug Threaded 20mm

2 x PVC Pressure Female Adapter 25mm x 3/4in

Multi Layer Disposable Glove (usually nitrile or chemical resistance) 

NB: alternative gloves can be used but they should be fairly thick and must be resistant to mineral oil. It is recommended that they be made from nitrile, polyacrylate, viton, polyurethane and/or flourosilicone.

90mm PVC Threaded Cap

PVC Cement

Instructions

  1. Remove protrusions and label from threaded cap.

  1. Drill two 20mm holes 25mm in from the outer edge as shown in the picture.

  1. Using a hacksaw, cut off the non threaded section of the pressure adapter just after the hex section, and then sand flat the cut face. Do this for 2 adapters.

  1. Glue the 2 adapters over the holes on the threaded cap using PVC cement. Let cure for 24 hours before using plugs.

  1. Drill a hole in a pressure plug approximately the same diameter as its inside cavity.

  1. Cut off the thumb of a thick glove and stretch over plug thread.

2.4 Housing Body

The housing body is composed of a small section of pipe and two threaded access couplings that the front and rear caps screw on to .

Materials

Item

Image

90mm Stormwater PVC Pipe

2 x 90mm PVC Threaded Access Coupling

PVC Cement

RJ45 Connector

Instructions

  1. Cut 90mm length of 90mm PVC Pipe.

  1. Glue access couplings to pipe using PVC cement. Be liberal with glue; it should be oozing after putting couplings on pipe. Ensure couplings are pushed all the way onto pipe. Leave to cure for 24 hours before exposing to oil or water.

2.5 Cable Plug

The cable plug pots the sheath opening of a cat-6 cable so that no water or mineral oil can enter. The plug then allows the cable to screw into the rear cap where it can connect to the corresponding electronics.

Materials

Item

Image

CAT-6 ethernet cable

PVC Pressure Pipe Plug Threaded 20mm

2 part epoxy (with mixing nozzles preferably)

Instructions

  1. Strip the outer sheath of the CAT-6 cable exposing about 30cm of the inner cables.

  1. Spread wires apart revealing the plastic separator (aka star filler) and fabric, and remove both.

  1. Unwind twisted pairs.

  1. 3D printed 20mm socket plug

 

  1. Insert socket plug into the non-threaded end of 20mm male threaded coupler

 

  1. Feed the cable into the plug such that the edge of the outer sheet sits in the middle inside the plug. A vice or clamp is useful for this.

  1. Spread wires apart and fill the plug with 2 part epoxy up to the rim. Let this cure for 24 hours before the next step.

  1. Crimp ethernet plug using solid green, stripped green, solid orange and stripped orange wires (facing spring in diagram).

2.6 (STANDARD SENSOR) Inner Camera Enclosure

The following section details the process for preparing the inner camera enclosure with the standard sensor i.e.  to achieve a standard field of view. If you intend to use a wide angle sensor, for a wider field of view, please see the next section titled “Inner Camera Enclosure (STANDARD SENSOR)”.

The camera sensor cannot be exposed to the mineral oil because it will distort the image, furthermore, the mineral oil makes it very difficult to focus the raspberry pi camera with the default lens, therefore, we must enclose the raspberry pi camera in an “oil tight” enclosure.

Materials

Raspberry Pi Camera Board V2 8MP

Selleys Araldite 5 minute epoxy

4.3mm thick transparent acrylic sheet

Both pieces of the 3D printed inner camera enclosure

Tools and Equipment

Instructions

Carefully swap out the default ribbon cable for the pi zero cable.

Note: gently push the sides of the black part of the ribbon cable port towards the cable to release the cable from the ports.

Note: the black sided ends of the ribbon cable face away from the boards.

Plug ribbon cable into a pi zero with HDMI to a monitor, keyboard and power.

Login to the pi with username and password.

Note: default username is pi, default password is raspberry.

Enter commands:

sudo raspi-config

Choose interfacing options, then enable the camera.

sudo reboot

Wait for the pi to reboot.

sudo raspistill -t 0

You should see a picture of what the camera sees.

Set up objects with fine detail at 40cm and 3m. For example, use a box with 1cm high text.

Adjust the camera’s focus by rotating the lens with the focusing wheel until both objects can be seen clearly with sharp edges. Your camera is now focused.

Turn off the pi with:

sudo shutdown now

Unplug the ribbon cable from the pi.

Use a hacksaw to cut a rectangle of transparent acrylic 25 x 24mm.

Remove the protective film and wipe off any debris from the cutting process with a soft cloth.

Note: this step uses epoxy glue so ensure you are wearing protective gloves and working on a surface that can tolerate  any spillage. Some cardboard works well.

Click the inner wall into place on the camera board.

Feed the ribbon cable through the slot in the enclosure so that the camera can fit facing up in the enclosure, lightly place it on the pegs to ensure that the holes line up, then bend the cable away so you can see the base of the enclosure.

Using 5 minute epoxy, fill the base of the enclosure so that the whole surface is covered. Don’t go over the height of the ribbon cable.

Pull the ribbon cable through the slot until the camera can fit securely on the pegs.

Carefully surround the inner wall’s top surface with a small amount of epoxy, use the nozzle to spread it thinly across the surface.

Gently push the acrylic rectangle onto the epoxy, ensure the epoxy does not cover the area in front of the lens.

Fill around the outside of the inner wall with epoxy making sure to fill under the ribbon cable. Fill up to the sides of the acrylic but do not fill over the acrylic.

Note: be careful, the epoxy’s chemical reaction will produce heat so don’t touch the enclosure for 5 minutes while it cures.

You have now finished assembling the inner camera enclosure.

2.6 (WIDE ANGLE SENSOR) Inner Camera Enclosure

The following section details the process for preparing the inner camera enclosure with the standard sensor i.e.  to achieve a standard field of view. If you intend to use a wide angle sensor, for a wider field of view, please see the next section titled “Inner Camera Enclosure (STANDARD SENSOR)”.

The camera sensor cannot be exposed to the mineral oil because it will distort the image, furthermore, the mineral oil makes it very difficult to focus the raspberry pi camera with the default lens, therefore, we must enclose the raspberry pi camera in an “oil tight” enclosure.

Tools and equipment

Materials

Using some tweezers, carefully disconnect the camera ribbon cable from the board.

The existing camera sensor is held in place by double sided tape. Carefully pry the camera sensor away using some tweezers, then remove the double sided tape.

Align the new wide angle sensor and lens with the connector and carefully push into place. Please ensure the connector is well aligned otherwise damage may occur.

Expose the double sided tape on the wide camera sensor and lens, and then carefully apply some pressure to stick it down.

Turn the camera board over and open the ribbon cable clasp.

Insert the ribbon cable into the port with the contact facing up.

With the ribbon cable inserted, close the clasp.

Carefully swap out the default ribbon cable for the pi zero cable.

Note: gently push the sides of the black part of the ribbon cable port towards the cable to release the cable from the ports.

Note: the black sided ends of the ribbon cable face away from the boards.

Plug ribbon cable into a pi zero with HDMI to a monitor, keyboard and power.

Plug a HDMI cable into the pi zero and a monitor

Plug a keyboard into the USB port of the pi zero

And connect the pi to power with a micro USB cable

Login to the pi with username and password.

Note: default username is pi, default password is raspberry.

Enter commands:

sudo raspi-config

Choose interfacing options, then enable the camera.

sudo reboot

Wait for the pi to reboot.

sudo raspistill -t 0

You should see a picture of what the camera sees.

Exit the program with Ctrl C

Turn off the pi with:

sudo shutdown now

Unplug the ribbon cable from the pi.

Use a hacksaw to cut a rectangle of transparent acrylic 31 x 31mm.

Remove the protective film and wipe off any debris from the cutting process with a soft cloth.

Note: this step uses epoxy glue so ensure you are wearing protective gloves and working on a surface that can tolerate  any spillage. Some cardboard works well.

Click the inner wall into place on the camera board.

Feed the ribbon cable through the slot in the enclosure so that the camera can fit facing up in the enclosure, lightly place it on the pegs to ensure that the holes line up, then bend the cable away so you can see the base of the enclosure.

Using 5 minute epoxy, fill the base of the enclosure so that the whole surface is covered. Don’t go over the height of the ribbon cable.

Pull the ribbon cable through the slot until the camera can fit securely on the pegs.

Carefully surround the inner wall’s top surface with a small amount of epoxy, use the nozzle to spread it thinly across the surface.

Gently push the acrylic rectangle onto the epoxy, ensure the epoxy does not cover the area in front of the lens.

Fill around the outside of the inner wall with epoxy making sure to fill under the ribbon cable. Fill up to the sides of the acrylic but do not fill over the acrylic.

Note: be careful, the epoxy’s chemical reaction will produce heat so don’t touch the enclosure for 5 minutes while it cures.

You have now finished assembling the inner camera enclosure.

NOTE: for the wide angle camera to be mounted onto the 3D printed camera tray, new holes will have to be drilled to accommodate the wider enclosure. Shave the face down to a flat edge first, and then mark out 19mm from either edge. Drill the holes using a 3mm drill bit.

2.7 (STANDARD) Camera Electronics

This version of the “Camera Electronics” section assumes we are employing a standard PoE setup, i.e. no self passivating underwater connectors (SPUC) are in use. If you wish to use SPUC then see the following section “2.7 (SPUC CONNECTED) Camera Electronics” to see adapted camera electronics instructions.

The camera electronics are the insides of the camera, composed of the camera enclosure, voltage regulator and raspberry pi zero, along with a piece of acrylic to hold it all together.

Materials

Prepared raspberry pi zero from section 3.1

Prepared inner camera enclosure (See previous steps).

DC Step Down Voltage Regulator

Micro USB Ethernet Adapter (used also for section 3.1)

M3 10mm screws

M3 nuts

(3mm) Gauge No. 4 self tapping screws 12mm

3D printed camera tray

4x .12mm light duty cables (2x red, 2x black)

1 set (out) = 200mm, the other (in) = 300mm

Instructions

  1. Solder a 2-pin JST male socket to the Pi Zero power pins.

  1. Make up a power cable (18cm long) that connects the output of the DC step down regulator to the JST header. Strip the wires (~1cm) and solder  to the inputs as shown.

Tip: solder both sides of the regulator ensuring a good connection.

  1. Use a power supply to adjust output voltage of the regulator to 5V. Set the voltage to 24V and max out the current. Hook up the input cables to the voltage supply and use a multimeter to check output voltage. Adjust the screw on the potentiometer until the multimeter reads 5V.

  1. Use super glue to glue the two halves of the 3D printed camera tray together. Note: the holes at the front of the tray are only suitable for the standard camera lens enclosure. For the wide-angle lens enclosure, you will need to create a flat face on the front edge with a stanley knife, then mark out two points along the edge that wil make the lens central to the tray. Drill 3mm pilot holes at those points and then the tray is prepared to mount the wide-angle lens enclosure with 10mm x M3 screws

 

  1. The 3D printed camera tray has mounting holes positioned to secure the raspberry pi, the DC voltage step down and the lens enclosure. Mount the electronics to the tray as shown. Use 10mm x M3 BOLTS for the stepdown, and 10mm x M3 SCREWS for the pi and lens enclosure.

2.7 (SPUC CONNECTED) Camera Electronics

This version of the “Camera Electronics” section provides methodology for assembling electronics for a camera that will be connected via a self passivating underwater connector (SPUC). In this situation, the ethernet data connection is superimposed onto the power line using a modified TP-Link ethernet over power adapter.

Materials

Prepared raspberry pi zero from section 3.1

Prepared inner camera enclosure (See previous steps).

DC Step Down Voltage Regulator

Micro USB Ethernet Adapter (used also for section 3.1)

M3 10mm screws

M3 nuts

Gauge No. 4 self tapping screws 12mm

3D printed camera tray

Modified TP-Link AV600 Nano Powerline Adapter (converted from AC to DC)

Instructions

  1. Solder a 2-pin JST male socket to the Pi Zero power pins.

2.8 Final Assembly

The final assembly sections describe the process in which everything comes together to form the underwater camera. Particular care and attention needs to be taken to ensure the camera housing is water tight and does not fail. Our main aim here is to ensure there are no air bubbles in the housing once everything is sealed up. This ensures minimal deformation of the pressure compensating membrane and housing body, when reaching pressure equalisation. For cameras that only need to be water resistant (not being submerged, but might be subjected to rain or splashes) the mineral oil can be omitted.

Before this process, it is recommended that the camera hardware is tested. See the “3.0 Usage & Testing” section of this document for instructions on how to do this.

Materials

Viewing window (fabricated part)

Housing body (fabricated part)

Rear cap (with pressure compensator plug - fabricated parts)

Cable plug (fabricated part)

Camera electronics (fabricated part)

Mineral oil (aka paraffin oil)

Thread seal tape

Instructions

  1. Apply around 6 layers of thread seal to the cable plug evenly over the thread.

  1. Screw in the cable plug into one of the sockets on the rear cap. Use your fingers initially and then do a couple of turns with a spanner. NOTE: the plug does not need to screw in all the way; doing so may cause failure on the socket.

  1. Apply around 16 turns of thread seal onto both threads of the housing body.

  1. Screw the rear cap onto the housing body as tight as possible with hands. NB: ensure o-ring is on inside of cap.

  1. Use shorting blocks on power leads and then connect solid blue and striped blue to red power lead and connect solid brown and striped brown leads to black power wire. Plug eth plug into eth adapter.

  1. Pull cables below acrylic and then slide electronics into housing body until the camera enclosure is only just sitting outside past the end of the body.

  1. Screw on viewing window cap as tight as possible by gripping both threads and turning in opposite directions.

Note: Test in housing before filling with oil

  1. Fill the housing with mineral oil until it’s just under the top of the pressure compensator socket.

  1. Block off the socket with the palm of your hand and turn the camera housing upside down so that all air bubbles move to the viewing window, then tilt the housing back to an upright position such that bubbles do not go back to the cable plug socket, but come out open socket, i.e. cable plug should be on bottom when tilting the housing back up. You should notice that the oil level has gone down. Repeat this process until it stops going down.

  1. Make sure mineral oil is up to top of socket. Apply mineral oil to the outside of pressure membrane plug, and push on membrane with finger (so as to reduce risk of air pocket) while beginning to screw into socket. After 2 turns you may remove your finger. Turn with fingers until no longer possible.

  1. Your camera is finished! Perform testing of function.

— If using an imaged SD card, assemble camera and start here –

Note: confirm the camera is reporting an image first.

3.0 Usage & Testing

WARNING: before powering on the camera, please be sure the voltage step down is set to output 5V, otherwise there is risk of damaging the camera hardware.

Testing of the camera may be performed with the housing open and electronics exposed, or with the housing closed up. These instructions assume you do not know the mac as specified in the /etc/netsender.conf file, and/or you do not know if the camera has been registered with a netreceiver site.

NOTE: TO BE READY FOR DEPLOYMENT, JETTY CAMERAS MUST STREAM AT LEAST FOR 2 WHOLE DAYS ON A REPEAT BROADCAST, RIG CAMERAS MUST STREAM FOR AT LEAST 5 WHOLE DAYS.

  1. Let’s first get our camera connected to data and power. Given that we use JSTs for the data and power lines, you might need some additional connectors/cabling to do this. See figure 3.1 for an example setup. You could also use the rig to do this i.e. connect to the rig controller board and piggyback off the rig power and network.

Figure 3.1: Example setup to connect camera JSTs to ethernet and power lines.

  1. With everything physically connected and powered, confirm that you can see the blue lights on the camera hardware board voltage regulator. If you have a sealed housing, you should be able to see the glow from the front viewing window. In addition to this, it’s a good sign if you can see a red flashing light (even through the housing viewing window), this indicates data transfer through the ethernet dongle. If you see only one, or neither of these lights, then you have an obvious connection or hardware issue; perform further diagnostics.
  2. On a linux laptop (or a windows laptop with a linux terminal emulator or similar) connect to the same network that the camera is connected to through either wire or wifi, and run ifconfig to find the subnet number:

$ ifconfig

You should get output similar to this:

enp4s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether 00:2b:67:bf:8b:5d  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 43337  bytes 15085428 (15.0 MB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 43337  bytes 15085428 (15.0 MB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

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

        inet 192.168.8.202  netmask 255.255.255.0  broadcast 192.168.8.255

        inet6 fe80::f4ed:469:b9e9:af9a  prefixlen 64  scopeid 0x20<link>

        ether 8c:c6:81:6c:e1:98  txqueuelen 1000  (Ethernet)

        RX packets 1004175  bytes 933848594 (933.8 MB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 529443  bytes 166901043 (166.9 MB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Each entry in this output refers to different network interfaces (enp4s0, lo, wlp0s10f3) some of which will and will not be connected to a network. Interfaces connected to a network will show an IP address, as in the highlighted interface above (192.168.8.202). We will need to remember the first 3 numbers, which correspond to the network we are on. The IP of the camera will be some number: 192.168.8.X, where x will be some unique number.

  1. We’ll now perform an nmap scan to try and find the address of the camera. You may need to install nmap. Replace the ip with whatever the subnet is that was found in the previous step:

$ nmap -sP 192.168.8.0/24

This will show output similar to this:

Starting Nmap 7.80 ( https://nmap.org ) at 2022-06-28 14:09 ACST

Nmap scan report for StarlinkRouter.lan (192.168.1.1)

Host is up (0.0020s latency).

Nmap scan report for 192.168.1.35

Host is up (0.088s latency).

Nmap scan report for 192.168.1.62

Host is up (0.0069s latency).

Nmap scan report for Galaxy-S10.lan (192.168.1.158)

Host is up (0.0045s latency).

Nmap scan report for saxon-ThinkPad-E15.lan (192.168.1.202)

Host is up (0.00036s latency).

Nmap done: 256 IP addresses (5 hosts up) scanned in 2.46 seconds

One of these hosts should be the camera (if not, this indicates a network connectivity problem). The IP may or may not have a hostname like “raspberrypi.lan”. Some of the hosts will obviously not be the camera for example “StarlinkRouter.lan”.

  1. Pick a host you think might be the camera (this might take some trial and error) and try to ssh into the camera.
    $ ssh pi@192.168.1.35

If you can successfully ssh then you’ve found the camera (or another raspberry pi on the network, but please remove these to simplify the process).

  1. Now that we’re logged into the camera, let’s check the /etc/netsender.conf file to see what the mac is registered as. The /etc/netsender.conf file will either be complete, incomplete or non-existent. If non-existent or incomplete see the steps in software setup for the /etc/netsender.conf file. Grab the mac which is listed under the “ma” field and go to netreceiver.

$ cat /etc/netsender.conf

  1. Select an arbitrary site from the netreceiver site menu and then click on the admin tab.
  2. At the bottom of the admin page, there is a ‘find device’  tool. Supply the mac and press the button. This will tell you what site the device is registered to. If a question mark appears, this means that a device with the provided mac has not been registered to any site. In which case, you must add the device. Follow the next 2 steps. If however, the device is registered to a site, skip the next 2 steps.
  3. The device will need to be registered to a site. Follow the steps here from the rig configuration guide for device registration. Note that some fields will be different to ESP registration. An example camera configuration is shown below.

ID

CameraABCD

MAC

AB:CD:EF:GH:IJ

WIFI/SSID

Inputs

V0,T0

Output

Mon Period

60

Act Period

60

Type

pi

Ver

Key

NOTE: the key field will be generated after pressing the add button.

  1. Copy the number in the key field after hitting the add button. This is the device key and will need to be copied into the /etc/netsender.conf “dk” field value. Open the file using nano and fill/replace the dk field:

$ sudo nano /etc/netsender.conf

  1. Now that we’ve got the configuration sorted, we can start a test broadcast. Head to vidgrind.ausocean.org, log in and select the site for which the camera is registered to.
  2. Head to the broadcast UI which is reachable by pressing on the “Broadcast” menu item on the left side.
  3. Follow the guide below for the set up of a broadcast.

TIPS FOR DIAGNOSING PROBLEMS

  1. While you schedule a broadcast to test the camera, have the logs for the camera open. This might show errors and/or warnings corresponding to problems observed when trying to stream. To do this, tail the logs:

$ sudo tail -f /var/log/netsender/netsender.log

3.1 Configuring Camera to VidGrind

To configure the camera to VidGrind, the pi will need to be registered with the variables detailed below:

  1. Go to https://vidgrind.ausocean.org/ and select the preferred site from the home menu.
  2. Select devices from the drop down menu in the top left corner.
  3. Either select the Pi from the tab or if it's a new device, leave it as such.
  4. For new devices, input an arbitrary mac that is not yet occupied, name the device in ID, and set inputs, mon period, act period and client type as shown below:
  5. Register the Pi to the preferred site by clicking ‘add’, and this will automatically register the device key.
  6. On your linux terminal; SSH into the Pi and go to the netsender.conf file in your terminal to update the MAC (to what you specified in VidGrind earlier) and the device key.
    $ sudo nano /etc/netsender.conf
  7. Press control X, then Y, then enter to save.
  8. Now register the variables of the pi into VidGrind according to below:

3.2 Broadcasting

To go to the broadcast UI go to vidgrind.ausocean.org. Select the site for which you would like to broadcast with. Now hit the “Broadcast” item on the menu on the left side of the page. You will get an unfilled form as shown in Figure 1. The meaning and options for these fields are shown are provided in Table 1.

TIP: Set up the camera to stream in front of an analogue clock for easier diagnosis of potential stream issues.

Figure 1: unfilled form on the broadcast configuraiton UI.

An example configuration is shown in Figure 2.

Table 1: fields of the broadcast configuration form and their descriptions and options.

FIELD

DESCRIPTION

Select Broadcast

This drop down lists previously saved broadcast configurations labeled by the broadcast name. When either the “Start” or “Repeat” buttons are pressed for a configuration, the broadcast configuration will be saved and listed here for future usage/modification.

If a broadcast is modified and then saved again (without modification to the name) the broadcast configuration will be overwritten. If however a saved broadcast configuration selected is modified, as well as the name, then a new broadcast will be saved with that name.

Selecting an option in the Select Broadcast list will fill the form with saved information and will display an embedded youtube player below from which any previous stream can be watched. See Figure 2 for an example of how this might look.

Broadcast Name

This is the name of the broadcast. This is what appears on youtube as the broadcast title under the video, and is also used for identification of a broadcast configuration in the datastore and therefore the “Select Broadcast” field above. AusOcean has a convention of using the site name at the start of a broadcast name for example. At stony point, we call the broadcast “Stony Point CuttleCam by AusOcean”.

NOTE: we currently have a feature that will automatically add the date to the Broadcast Name when it’s communicated to youtube. This date will appear on youtube next to the name.

Description

This is the description that appears on youtube under the title of a view.

Stream Name

The stream name identifies the name of the stream that will be connected to the broadcast. This name will not be revealed outside of this configuration and is purely for satisfying the youtube API. This can probably be named similarly to the Broadcast Name.

Privacy

This controls who can see the broadcast. There are three options: Public, Unlisted and Private.

Public broadcasts will be listed by youtube on the youtube website and will send a notification to users subscribed to the  channel. The broadcast is linkable.

Unlisted broadcasts will not be listed by youtube and subscribers will not get a notification, but the video can still be linked to.

Private broadcasts are not listed by youtube, subscribers will not get a notification and they are not linkable. You must be logged in as the channel on which the broadcast is controlled to see it.

For testing purposes, we generally go with Unlisted. This allows us to still view the stream in the embedded player in the broadcast UI.

Resolution

This describes the resolution of the broadcast. We normally set this to 1080p.

On Actions

These are the actions that must be performed to turn on the streaming hardware. This is a CSV list of key value pairs. The keys are the device variables and values are the values that will be set to turn on the device. For example, imagine that we have a device called “Camera”. On a rig with ESP controller called “ESP_D7ED01”. We would have to power on the camera and make sure its mode is set to normal:

Camera.mode=Normal,ESP_D7ED01.CamPower=true

Off Actions

These are actions that must be performed to turn off the streaming hardware. This also a CSV list of key value pairs. The keys are again the device variables and the values are the values that should be set for turning off. Imagine we have a “Camera” device and a controller esp called “ESP_D7ED01” an example of off actions could be:

ESP_D7ED01.CamPower=false

RTMP URL Variable

This is the variable that contains the destination RTMP URL i.e the destination the streaming hardware will send video data to. The broadcast software will automatically set the value of this to the appropriate value which is obtained from youave after creating the broadcast. If we have a camera called “Camera”, this would be:

Camera.RTMPURL

Start Date/Time

This is the date and time that the broadcast will be scheduled to start at. This should be set to at a minimum 2 mins from modifying and hitting start on the configuration. Between the broadcast being created and this start time. The broadcast will appear listed as an “upcoming” stream. This time is used to automatically perform the On Actions that were specified above.

End Date/Time:

This is the date and time that the broadcast is scheduled to end at. This will be used to perform the off actions to turn of external streaming hardware. THe broadcast code will also use to set the status of the broadcast to complete through the youtube api.

Repeat Schedule Time

This is the time at each day that the broadcast will be created (not the start time of the broadcast) if repeat is set up i.e. if the repeat button is pressed. NOTE: for a single broadcast event this field can be left blank.

Start (button)

Press this button to do a one time scheduling of a broadcast. Once this button is pressed the page will refresh and an embedded youtube video will appear as shown in Figure 3 with a countdown to the scheduled live time.

Stop (button)

The stop button can be used to stop a broadcast by transition the status to complete. To use this feature the broadcast that is currently live must be selected using the “Select Broadcast” field and then this button is pressed.

Repeat (button)

This button automatically adds crons for the daily scheduling of a broadcast configuration. To use this feature the “Repeat Schedule Time” field must be filled. This will correspond to the specification of the cron that will call the appropriate repeat broadcast functionality.

Generate Token (button)

This button is used to generate a new authentication token if necessary. This need only be used if for some reason an error is returned after attempted broadcast start stating that authentication failed.

Figure 2: Example of the UI after a previous broadcast has been selected. The most recent stream is shown in the embedded player beneath the form.

Figure 3: Example of UI after pressing start button. The embedded player shows the AusOcean slate image and displays a countdown until the scheduled start time. Once the stream starts, it can be viewed here.

3.3 Use with AusOcean Rig

<INSERT HOW TO PLUG INTO RIG>

4.0 Appendices

4.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 pi>

On windows use PuTTY.

4.2 Appendix B: Focusing the raspberry pi camera.

The following steps assume that section 2.1 has been completed. Here we’ll configure the raspberry pi to stream RTP to a VLC session. This will allow us to adjust camera focus and see results quickly on a live stream.

  1. Ensure the raspberry pi and your computer are on the same network. Check your computer IP using ifconfig:

$ ifconfig

The output should look similar to this:

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

        inet 192.168.0.11  netmask 255.255.255.0  broadcast 192.168.0.255

        inet6 fe80::1d1c:5d16:42e3:de8e  prefixlen 64  scopeid 0x20<link>

        inet6 2405:7f00:b80d:1900:1b7b:c0bd:86c0:84db  prefixlen 64  scopeid 0x0<global>

        inet6 2405:7f00:b80d:1900:b568:b8f1:aceb:6a7a  prefixlen 64  scopeid 0x0<global>

        ether 5c:ea:1d:45:30:2f  txqueuelen 1000  (Ethernet)

        RX packets 441631  bytes 318673295 (318.6 MB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 262631  bytes 62724134 (62.7 MB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The IP in this case is 192.168.0.11 this is where we’ll configure RVCL to stream to i.e. rtp://192.168.0.11:6970

  1. Now were going to build rvcl and configure it to stream to out VLC session on the laptop. SSH into the pi and navigate to the rvcl software:

$ cd /home/USER/go/src/bitbucket.org/ausocean/av/rvcl

  1. Build the software:

$ go build

  1. Now we’ll write a configuration file:

$ nano config.json

Copy the following JSON into the file, replacing the RTPADDRESS field with your IP and the RTP port e.g. if your IP is 192.168.1.30, you’d have the following config file:

{

        “Bitrate”:”2000”,

        “Output”:”RTP”,

        “RTPAddress”:”192.168.1.30:6970”,

        “FrameRate”:”25”,

        “Input”:”Raspivid”,

        “logging”:”Debug”

}

  1. Now we’ll run rvcl with the configuration file we just created:

$ ./rvcl -config-file=config.json

  1. Open up VLC on your computer, go to Media->Open Network Stream, and then type in the RTP URL, i.e. if your laptop IP address is 192.168.1.30 as previous step, the RTP URL is “rtp://192.168.1.30:6970”. Now hit play and you should see your camera’s stream.
  2. If you do not see your stream, make sure your IP and Port in the config.json RTPAddress field is consistent with the rtp url you just configure vlc with. It’s also worth looking at the rvcl logs. To do this, tail the log file:

$ tail -f /var/log/netsender/netsender.log

Please contact saxon@ausocean.org if you have any issues with the log file attached.

4.3 Appendix C: Using system images for the raspberry pi

Setting up SD card with an image

If you are going to be setting up a camera SD card multiple times, you may want to create an ‘image’ of an existing camera SD card. This essentially clones the contents of the card so you don’t have to set it up from scratch every time. Follow these steps if you would like to create an image or you already have an image, otherwise skip to the section “Setting up and SD card from scratch”.

Creating an SD card image

  1. Insert the SD card which you would like to create an image for into your computer. You may need an adapter for this.
  2. Open the terminal and run the command
    $ sudo fdisk -l
  3. Take note of the disk name which has the size of the SD card you are using (eg. 14.9 GiB for a 16GB SD card). For example, looking at this output, the disk name of the 16GB SD card is “/dev/mmcblk0”.
  4. Run this command to create a compressed image file on your computer for that SD card. (Replace <USER> with your username for the computer and replace /dev/mmcblk0 with the disk name if it is different)
    $ sudo dd bs=4M if=/dev/mmcblk0 status=progress | gzip > /home/<USER>/Documents/image`date +%d%m%y`.gz
  5. When that is finished (it may take a while) you should have an image file in your Documents folder. That can now be used to set up future SD cards.

Writing an image file to an SD card

  1. Insert the SD card to write to into your computer. Note: the following steps will permanently erase all contents of the SD card.
  2. Open the terminal and run the command
    $ sudo fdisk -l
    Take note of the disk name for the SD card (see step 3 of the above section).
  3. Run the following command replacing <USER> with your username, replace image***.gz with the name of the image file, and replace /dev/mmcblk0 with the disk name of the SD card if it is different.
    $ sudo gzip -dc /home/<USER>/Documents/image***.gz | sudo dd status=progress bs=4M of=/dev/mmcblk0
  4. The process will take a number of minutes but when it is complete the SD card should contain a functional image for use in a camera.
    Be sure to safely unmount and remove the two SD card partitions from your computer. This can be done by finding the two partitions on your desktop or in file explorer and right clicking and selecting the “unmount” or “eject” option.
  5. Troubleshooting note: occasionally the imaging process will be unsuccessful. You may not be able to access the boot partition on the SD card. In this case, insert it back into your computer and repeat step 3.

NOTE: the following steps are to bring the pi up to date with the latest AusOcean software.

  1. Insert the SD card into a pi and login via ssh or physical access.

Navigate to the av repository and update using these commands:
$ cd ~/go/src/bitbucket.org/ausocean/av/cmd/rv

$ git checkout master

$ git pull

$ go build --tags circleci

(Do not include --tags circleci if using motion detection)

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

$ sudo make install_hard

  1. Find the MAC address of the pi:

$ ifconfig

A similar section should appear:

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::dcd5:527:9b50:e817  prefixlen 64  scopeid 0x20<link>

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

        RX packets 188550  bytes 242748244 (231.5 MiB)

        RX errors 543  dropped 267  overruns 290  frame 944

        TX packets 121628  bytes 10283604 (9.8 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

In this example the MAC address is 00:e0:4c:53:44:58

  1. Edit the netsender config file:

$ sudo nano /etc/netsender.conf

Copy the following text into the file replacing <MAC_address> with your MAC address:

ma <mac_address>

dk 0

wid

ip V0,T0

op

mp 60

ap 60

tg

hw

sh vidgrind.appspot.com

Save changes by pressing ctrl+s then ctrl+x.