Skip to content

Current hardware software solution

Scott Veirs edited this page Dec 28, 2024 · 15 revisions

Current Orcasound solution for live ocean listening

December, 2024 update:

For our colleagues at OrcaLab, across the BC Hydrophone Network, at DFO, and beyond

As 2025 begins, Orcasound continues to optimize our hardware and software for:

  1. end-to-end performance of real time streaming of audio data (not video, yet), from a single board computer to a web app that "just works" on any combination of OS, device, and browser.
  2. detection of "interesting" signals by humans and/or machines (definition of bouts, ideally with NIST-synchronized FaceTime stamps and some initial strong labels)
  3. minimal cost (<US$1,000 total) of the underwater and on-land infrastructure (hydrophones, cables to shore, ADC computer systems, and cloud-based storage and analysis) to facilitate future scaling across the SRKW range.

Across the network (now with 5 operational & 3 developmental nodes), this means we usually deploy at least one -- but ideally 2 -- low-cost hydrophones as close to shore as possible to minimize cable costs. One is enough for detection detection, but 2 is good for redundancy -- and also opens the door to a 2025 stretch goal: real time bearing computation. Most recently, we've been experimenting with these hydrophones makes/models -- each in the $300-$500/element range (with 10m cable):

  • Labcore40 (made by Lon Brocklehurst in Olympia, WA), including in 2024 a custom dual-element binaural array using a single cable.
  • Aquarian AS-1 (made in Anacortes, WA), most recently a 60m version made to order in <2 weeks for Val.
  • Cetacean Research Technologies CRT-40P (previously by Joe Oslon in Seattle; now made in Golden, CO, by Adam Sniff)
  • HTI-96-MIN (made in Missouri)

Typically, we order them with 20-60m cables and straight, low-profile 1/8" male jacks for the shoreside termination (easier to pass through intertidal protection and/or weatherproof enclosure glands. A strong constraint leading us to these makes/models is that any preamplifiers need to provide adequate sensitivity with the 5.4 or 6.0V bias power that can be provided by the Pisound ADC (a Raspberry Pi HAT) with a simple soldering jumper job... A secondary, weaker constraint is seeking elements with flatter frequency response -- mainly to open the door to more accurate noise monitoring (at least relative metrics for the frequency bands used for orca signals).

We have briefly explored other single board computers, but have mostly standardized on and field tested the Raspberry Pi (first the 3b+, now all nodes run on 4s). They are remarkably robust, even with minimal protection in a $20 waterproof enclosueThus far, we've avoided the Rpi 5 due to the increased cost and processing power that far exceeds our current ADC and audio streaming needs, but that could change if we start doing more edge computing. We are transitioning to higher-endurance SD cards having learned that i/o speed is not our primary criterion any longer.

The SD cards run Raspian operating system and the orcanode open source code (which uses ffmpeg for the ADC process and a custom script for uploading the audio chunks to an S3 data bucket that is sponsored by Amazon (free storage and egress). The containerized software manages the data streaming so that (ideally) no data accumulates locally at the hydrophone node; instead, all is queued and uploaded to optimize real time playback.

State of the art (5/9/2023):

Screenshot 2023-05-09 at 12 17 58 PM

SV: Annotate image and get better lighting in green box!

From left to right:

  1. Black power cord: attach your Uninterruptible Power Source (UPS) into grounded AC power source.
  2. Gray ethernet cable: connect your router input jack to a DSL or fiber or other modem with Internet access (upload bandwidth at least 1 Mbps, ideally 10 Mbps).
  3. Thin black cords: plug your router and the Power-Over-Ethernet (POE) injector into the battery-back up side of the UPS. The hope is that the combined loads from your router and the POE injector will not exceed your UPS endurance before a local black-out has been resolved.
  4. White ethernet cable: connect your router (any free port, usually #1-5) to the POE data-only jack
  5. Blue ethernet cable: connect the POE data+power jack to the POE splitter that is powering your streaming computer.
  6. Connect your hydrophone(s) to the Analog-to-Digital-Converter (ADC) input jack(s).

Finally, power up the UPS (usually by pressing the power button briefly, or for some models a couple seconds).

April 2018 blog post about Orcasound hard/soft-ware solution

Hydrophones

On-land hardware

Streaming software

SD card cloning procedure (for Rpi)

Last update: 5/30/2024

  1. Detatch ethernet and turn off wireless for the Rpi you are using to clone. (If you don't you may disrupt the Dataplicity installation for the existing, working node...)

  2. Boot up the Rpi with a working node SD card (with keyboard, mouse, and monitor attached)

  3. Start the "SD Card Copier" application from the Raspberry menu's Accessories menu.

  4. Check and note the device name of the current SD card (so you know what device should be the source for the cloning processes).

  5. Insert a blank SD card (of the same capacity as the source card) using e.g. a USB card reader, and then start the copying process from the current SD as a source to the blank SD card as the target.

  6. Wait. The copying will take 10-15 minutes.

  7. Shutdown and reboot using the new card.

  8. Edit the .env file in the subdirectory of ~/orcanode that contains the .yml for the Docker container. Change the node name to be unique, or to match the name of the node where the SD card will be deployed. Change BUCKET_TYPE to dev.

  9. Remove Dataplicity. Uninstall Dataplicity in 3 steps:

sudo rm -rf /opt/dataplicity
sudo apt purge -y supervisor
sudo rm -rf /etc/supervisor
  1. Shutdown, attach Rpi to ethernet or other Internet access, and reboot.

  2. Browse to Dataplicity, login as an Orcasound admin, delete the old device (noting it's name and description), and install a new device node using the provided curl command to install Dataplicity client on the node SD card.

  3. With a synthetic sound source like a radio attached to the Pisound input, test the end-to-end streaming using the dev.orcasound.net web app.

  4. Check the cron jobs are what you want for the node. (As of 5/30/24: User pi crontab is commented out and sudo crontab -e yields both a 24-hour restart of the container and a restart of the streaming container upon a reboot event.)

  5. Stop the streaming container.

  6. Finally, edit .env file, setting BUCKET_TYPE to prod.

  7. Shutdown and transport cloned SD card to the relevant network node for deployment.

SD card set up for a Raspberry Pi

Last update: 11/12/2023

  1. Download the Raspberry Pi Imager software for your computer (with a card reader and an SD card inserted).

  2. Use Imager to install the latest Raspberry Pi OS.

Note: if your SD card isn't new, we recommend you first use Imager to format it (FAT32). After choosing your Raspberry Pi version (e.g. 4), choose the 32 bit version of the OS (unless your Pi 4 or 5 has 8GB or more of RAM):

Screenshot 2023-11-12 at 11 35 58 PM

If successful, you should get a message like this:

Screenshot 2023-11-13 at 12 01 28 AM

This How-To assumes you install the desktop environment. Eject the SD card, insert it into your Raspberry Pi (with a monitor, mouse, keyboard, and ethernet cable attached), and turn the computer on.

  1. In the pi user's home directory, create an orcasound directory with mkdir orcasound

  2. Change into the new orcasound directory (with cd orcasound) and clone the orcanode repository, e.g with git clone https://github.com/orcasound/orcanode.git

DockerHub image method (from Steve Hicks):

  1. Pull down the pre-built orcanode image

Try first (to avoid early 2023 end of docker-compose

To pull down this ~2021 image -- https://hub.docker.com/r/orcasound/orcanode -- try docker pull orcasound/orcanode

Also look at Karan's ~2022 amd64 image?

Otherwise, do what Steve said (in email to Scott & David Bain Sep 24, 2022):

  1. Pull down the pre-built orcanode image

Since we have the image in docker hub you technically don't need the whole repo just to run. You just need the compose file. But it's moved to orcanode/node/docker-compose.rpi-pull.yml

Download this .yml file and rename it "docker-compose.yml" and then do docker compose build followed by docker compose up in the same directory as the file. It will pull the pre-built image down.

The other thing is that the unsupported logspout image is probably more trouble that it's worth. It's not necessary for streaming. You can safely delete these lines from your docker-compose.yml and it might make things simpler:

logspout:
    # Use unofficial logspout that's been compiled for armhf
    # TODO: Build an updated version of this image. Looks unmaintained.
    image: emdem/raspi-logspout
    command: ${SYSLOG_URL}
    restart: always
    hostname: ${NODE_NAME}
    env_file: .env
    environment:
      - SYSLOG_HOSTNAME=${NODE_NAME}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "8000:8000"

If that fails, try this instead:

Build an Orcanode image from scratch:

  1. Follow the orcanode README installation guidance:
./orcanode/base/rpi/buildrpibase.sh
docker compose ./orcanode/base/

Finish by setting environmental variables & remote access software

  1. Edit your .env file

To set up a basic development node, try this .env file template:

AWSSECRETACCESSKEY=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_METADATA_SERVICE_TIMEOUT=5
AWS_METADATA_SERVICE_NUM_ATTEMPTS=0
REGION=us-west-2
BUCKET_TYPE=dev
#BUCKET_TYPE=prod
NODE_TYPE=hls-only
#NODE_TYPE=research
#NODE_TYPE=offline
NODE_NAME=rpi_test_dev
NODE_LOOPBACK=true
SAMPLE_RATE=48000
#SAMPLE_RATE=19200
AUDIO_HW_ID=pisound
CHANNELS=1
FLAC_DURATION=30
SEGMENT_DURATION=10

If you're trying to log, add these lines:

SYSLOG_URL=syslog+tls://syslog-a.logdna.com:6514
SYSLOG_STRUCTURED_DATA='logdna@48950 key="313dbd82f35ccbe462e6e3483984f464" tag="docker"
  1. Set up remote access

As of fall 2023, we use Dataplicity, but we are studying swarm management tools like (Val investigating with Andreas in :

Install via curl:

curl -s https://www.dataplicity.com/9lg2t5pk.py | sudo python

If you are using an SD card that previously utilized Dataplicity (e.g. you're upgrading Dataplicity), then you should uninstall before running the above curl command afresh. Uninstall Dataplicity in 3 steps:

sudo rm -rf /opt/dataplicity
sudo apt purge -y supervisor
sudo rm -rf /etc/supervisor
  1. Set up crontab

Do sudo crontab -e and add these lines:

0 0 * * * /usr/local/bin/docker-compose -f /home/pi/orcanode/node/docker-compose.yml down && /usr/local/bin/docker-compose -f /home/pi/orcanode/node/docker-compose.yml up -d
@reboot sleep 60 && /usr/local/bin/docker-compose -f /home/pi/orcanode/node/docker-compose.yml up -d

Val's 2021 progress procedure:

Building an OrcaNode on a Raspberry Pi

  1. Install Rpi operating system and put a blank ssh file in boot sector

  2. Connect to Rpi via command line or by dataplicity.

  3. su pi followed by Rpi password

  4. sudo apt update

  5. sudo apt upgrade

  6. sudo reboot

  7. sudo curl -fsSL https://get.docker.com/ -o get-docker.sh

  8. sudo bash get-docker.sh

  9. sudo usermod -aG docker $(whoami)

  10. sudo reboot

  11. check version with docker version

  12. sudo apt install python3-pip -y

  13. sudo pip3 install docker-compose

  14. make a directory home/pi/hti and cd there

  15. git init

  16. clone orcanode branch: https://github.com/orcasound/orcanode.git

17: create .env file and save in this directory

Archive of past solutions

Old but good ideas & lessons learned