|
|
Subscribe / Log in / New account

A Zephyr-based camera trap for seagrass monitoring

By Jake Edge
December 10, 2024

OSSEU

In a session at Open Source Summit Europe (OSSEU) back in September, Alex Bucknall gave an overview of a camera "trap"—a device to capture images in a non-intrusive way—that he helped develop which is being used to monitor seagrass. He works for the Arribada Initiative, which is a non-profit organization focused on creating open-source technology for studying wildlife and ecosystems. The camera system uses the Zephyr realtime operating system (RTOS) on an open platform that is designed to be inexpensive and usable for multiple applications.

He began with a brief mention of some of the kinds of projects that the Arribada Initiative has helped build over the years. That includes projects all over the world such as satellite transmitters mounted on the backs of tortoises, thermal-imaging traps for monitoring pangolins in Cameroon, suction tags for tracking manta rays in a non-intrusive way, and penguin colony nest cameras in Antarctica.

Seagrass

The specific project he talked about is for the only flowering marine plants, which are seagrasses. They can form meadows on the ocean floor, storing 10% of the oceans' buried carbon though they only cover 0.1% of the seafloor. "They also produce a significant amount of oxygen as well". They are critical habitat for various marine species, especially juveniles that need to hide out from predators.

$ sudo subscribe today

Subscribe today and elevate your LWN privileges. You’ll have access to all of LWN’s high-quality articles as soon as they’re published, and help support LWN in the process. Act now and you can start with a free trial subscription.

Beyond that, seagrasses stabilize the seafloor; a lot of coastal islands have seagrass meadows that slow erosion of their coastlines. But seagrass is declining, sadly; it is disappearing at a rate of around 1.5% per year and at least 29% of seagrass has disappeared over the last 50 years, he said. Sustaining seagrass is important for both climate-change mitigation and for maintaining marine biodiversity.

[Alex Bucknall]

The project partnered with some local organizations in Bermuda to help them figure out what was going on with the seagrass in that country. The government had noticed the decline in seagrass and some research had indicated that it was caused by green sea turtles that were eating the seagrass back to its roots, Bucknall said. In order to test that, the government placed cages over juvenile seagrass meadows to exclude the turtles, but found that did not change anything. So the government put out a call to help it understand what was happening, which is how the local organizations and Arribada got involved.

What the organization came up with was an underwater time-lapse camera "that could monitor the decay of the seagrass or, at least ideally, the growth of the seagrass" along with measuring characteristics of the water, such as temperature, pH, and the amount of light reaching the seafloor. The idea was to build a number of these cameras to place on the cages to help in determining "whether we were seeing turtles eating the seagrass or whether it was the case that something else was happening", he said.

Device

So the team developed a generalized platform for time-lapse photos as well as sensing. There are a number of requirements, including the need to be field configurable for changing parameters like the realtime clock, photo interval, and the sampling rate for the sensors. It also needed to be low power so that it could last weeks underwater in a hardened enclosure that would allow it to survive the hostile underwater environment ("sea water tries to destroy everything"). Another requirement is that everything be open source; "it's important for the world of conservation that these tools are made accessible for people to use".

Something that Arribada tries to do when it designs the hardware for projects like this is to take it as an opportunity to create a base platform "that allows us to use one piece of hardware for multiple projects". That is part of "why Zephyr is really important for us". There is only a small team at Arribada, so it tries to use off-the-shelf hardware, such as Adafruit's Feather and FeatherWings for its projects. Standard hardware connectors are also used, such as STEMMA/Qwiic, which allows plugging multiple sensors together into an I2C bus.

Different microcontrollers are used in various projects, so another important piece was to find a camera that is supported in Zephyr on multiple microcontrollers. Many cameras require large frame buffers in main memory, but the Arducam Mega that was chosen has its own buffers and allows frames to be transferred over SPI. The camera also needed to be inexpensive so that more of the devices can be deployed in the field. At the time of the talk, ten cameras were deployed in Bermuda, he said, but the hope is to scale the project to put more in place. The overall design is flexible, allowing others to add and remove components based on the needs of their conservation projects.

Zephyr

"Why does Zephyr make sense for conservation?" Historically, Arribada has done a lot of projects that ended up with their own code repositories and code bases, which meant that there "were handfuls of on-the-shelf, never-to-be-used-again projects". Since they have a small team, building everything new for each project slowed things down considerably.

Zephyr allows the team to choose a variety of ready-made SoCs depending on the needs, such as power consumption or connectivity. It has easy-to-use APIs for power management, networking, and sensing, as well. When designing something new, the team often splits into two parts, one for drivers and the other for the "business logic of the application", Bucknall said; the APIs make that split easier.

Every time he looks at the Zephyr repositories, there are new sensor drivers that can be used, which makes it easy to quickly integrate others sensors into the platform. "A growing library of performant sensors for data collection is really important when we have people doing all sorts of crazy things." The team also likes the tools that Zephyr has available for build- and run-time configuration, such as the various shells (for sensors, I2C, and for the system) that allow non-programmers to configure devices at run time.

To make things easier, Arribada uses a central board repository with devicetree overlays for various pieces like the camera. A project can choose a repository for a particular microcontroller based on the needs of the project, such as whether it needs WiFi, Bluetooth, or reduced power usage, which will provide a base to start building the application. That also allows Arribada to outsource writing the drivers to contractors while the team focuses on the application, especially when there are tight timing windows. The overlays make it easy to add new hardware to a system and "it is a really nice way to almost have a hardware bill of materials" that shows what components the system has and how they connect; Zephyr takes care of connecting the buses together and attaching the peripherals correctly.

The Zephyr driver model allows Arribada to develop a library of code for sensors, which is "a little bit similar to Arduino, with their comprehensive libraries of random sensors off the shelf, but in a much more standardized method", he said. For a given project, the developers can simply pick the drivers they need and add things that are unique to their application.

For example, Arribada has been working with Arducam on a Zephyr driver for the Mega camera. The organization encouraged the company to create an open-source driver so that others can use it, and not just in conservation applications. At the time of the talk, the driver was working its way into the Zephyr mainline, he said, though the apparent repository for it does not show any recent activity.

Overall, the goal is to reduce the cost of these conservation tools. Arribada's usual partners are resource-constrained university research groups and charities. Development time costs money, so reducing the complexity by abstracting the drivers using standard APIs is helpful. Less time spent dealing with drivers and hardware means that the tools to start monitoring can be deployed that much more quickly.

Deploying

Field deployment is more than just flashing the device and delivering it. There is a need for doing configuration, updates, and debugging remotely on devices that may not be easily accessible. One problem that the team faced is how to build binaries and then get them to the field. The Zephyr Docker images that are used for continuous integration (CI) testing on GitHub have been useful in that regard. The binaries can be built and tested in the cloud, then local technicians can obtain them from there in order to update the devices. That helps avoid versioning problems in the field, he said.

The Zephyr shells make it much easier for technicians in the field; they can get instant feedback on configuration changes, network connectivity, device status, and more. The Arribada team is not always on-site to do any hand-holding, so giving the local technicians tools that avoid them having to do builds in the field before deployment is important. Some update mechanisms are easier than others; the UF2 bootloader is the easiest, because people know how to drag-and-drop a file onto a USB device, using a serial terminal is another possibility, since getting a terminal running is fairly easy to teach, but other options are far more cumbersome.

Over the years, Arribada has found some "things to watch out for". For example, support from vendors can be hit or miss, though Bucknall has been impressed by the number of vendors starting to support Zephyr of late. Newer microcontrollers and other hardware may take a while to be supported or lack features, such as power management, that these devices require. That means either waiting for the support to be added, or the team adding those features and contributing them back. "If you want an unusual feature, you will have to write it yourself", he said.

Learning Zephyr is somewhat difficult at this point, though it is getting better; "training a new team to use Zephyr is not the easiest", but once you get going, the tools make development and deployment faster. The documentation is generally good, but examples are somewhat limited, especially for unusual uses. Arribada tries to help fill these holes with documentation and examples from what it did.

Other uses

Arribada has a few different projects that are using Zephyr currently. There is a humanitarian-aid-tracking project in Ethiopia, a project for avian leg tags, and a seaweed-monitoring project that is close to deployment in the Philippines.

He closed his talk with a video from the seagrass-monitoring cameras, which can be seen in the YouTube video of his talk. The slides (without the video) are also available. The video showed a variety of fish passing through a cage on the seafloor. As far as the seagrass problem goes, "we don't know yet"; there are a number of cameras deployed and "we are hoping to collect the data sets from them in the next couple months". They will take that data back to the Darwin Initiative that funded the work to help scientists get a handle on the problem; hopefully there will be more funding to do further deployments if needed.

[ I would like to thank LWN's travel sponsor, the Linux Foundation, for travel assistance to Vienna for Open Source Summit Europe. ]


Index entries for this article
ConferenceOpen Source Summit Europe/2024


to post comments


Copyright © 2024, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds