---
title: Mussel-driven voting system

date: 2025-04-23

toc-depth: 2

format:
  stylish-report-pdf:
    pdfversion: "2.0"
    pdfstandard: [A-4f, UA-2]
    pdftestphase: latest

metadata-files:
  - _actors.yml
keywords:
  - voting
  - bioindicator
  - Arduino

breaks: false

---

# Abstract

*TODO*

*NOTE TO EDITORS:
TODO notes like this are annotations targeted authors and editors;
they are **not** intended for inclusion in the final delivery.*

# Introduction

A system in Poland to monitor water treatment plants
uses mussels as bioindicators
[@FerreiraRodriguez2023].
The system, SYMBIO,
measures once per second the opening level of 8 freshwater mussels
by way of a magnet glued to each mussel
[@Prote2024].
If either half of the mussels close rapidly
or one of them remains closed for longer time,
an alarm is triggered and further laboratory tests are done
[@Nazaruk2016].

This project will implement mechanisms like the polish system.

## Detecting stressful mussel behavior

The use of a mussel as biodetector requires distinction
between slow-paced valve gaping change (normal),
paused valve gaping at the closed position (resting or starved)
and rapid valve gaping change (stressed)
[@Miller2022 p. 1097; @Robson2006 p. 1200].

Detecting behavioural change to a rapid gaping pace,
measurements are needed at a much higher sampling rate
than that of the normal gaping pace.
E.g. one mussel with normal gaping pace of about 1 minute
required a sample rate of 5 seconds to detect its normal pace,
and another mussel with normal gaping pace of 3-4 minutes
required a sample rate of 0.5 seconds to detect more rapid cycles
[@Robson2009 p. 195].
Another measurement of both normal and stressed behaviour,
assuming that x-axis is in seconds (not hours as indicated),
similarly shows a need for fast sampling rate
to detect a normal pace of about 1.2 minutes
and a stressed pace faster than the visualized resolution
of about 1 second
[@FerreiraRodriguez2023 fig. 2].

One concrete approach used in @Robson2009 and Robson2010
is to collect data at a sample rate of 0.5 seconds, i.e. 2 hZ,
and convert that into gape angle per second (CHIGA)
to then monitor gape movement instead of gape position.

## Copyright and licensing

To encourage collaboration and stimulate a circular gift economy
as introduced by @Mikkelsen2000,
this project is copyleft licensed:
Code parts are licensed
under the GNU Public Licence version 3 or newer,
and non-code parts are licensed
under the Creative Commons crediting share-alike 4.0.

# Project Planning

*TODO*

# Analysis and Design

*TODO*

# Description of the Program

The system consists of two parts,
the sensor system on each mussel
and the vote handling system...

*TODO*

```{.plantuml}
!include Mussel/components.puml
```

*TODO*

## Library function `begin()`

```{.plantuml}
!include Mussel/Mussel_begin.puml
```

## Library function `read()`

```{.plantuml}
!include Mussel/Mussel_read.puml
```

# User Guide

Concrete use of the library in a sketch involves...
*TODO*

## Sensor system

```{.plantuml}
!include Mussel/examples/read_to_EddystoneTLM/read_to_EddystoneTLM.puml
```

## Voting system

```{.plantuml}
!include Mussel/examples/voting_from_EddystoneTLM/voting_from_EddystoneTLM.puml
```
*TODO*

# Testing

*TODO*

# Discussion

*TODO*

# Conclusion

*TODO*

# Bibliography {.appendix}

\begingroup
\raggedright
::: {#refs}
:::
\endgroup

\appendix

# Mussel library {.appendix}

## Headers

```{.c include="Mussel/Mussel.h" code-line-numbers="true"}
```

## Source code

```{.c include="Mussel/Mussel.cpp" code-line-numbers="true"}
```

## Example sketch

```{.c include="Mussel/examples/seconds/seconds.ino" code-line-numbers="true"}
```