Skip to content

schmettow/ylab-edge

Repository files navigation

YLab Edge

... is a framework for high performance hetereogeneous sensor arrays on common microcontrollers. Apparatus is essential for experimental research, but is expensive, too. Most instruments are designed for intensive industrial quality control or critical medical use, which makes them very expensive. What many researchers often really need is a one-time setup with a combination of sensors and a one-press recording device.

The goal of YLab Edge is to provide a high-level API making it easy to create dedicated firmwares for many combinations of MCUs and sensors. For example, a researcher in Movement Sciences may want to collect data from an array of EMG probes and a second array with motion sensors. YLab Edge alrady supports several sensor types and by using a shared bus architecture, allows to use use several sensors on one string.

The high performace is achieved by consequently using a concurrency programming approach (async/await). For this purpose, several sensor driver crates have been forked and given async traits. While this is complex, it will be hidden from users of the framework. On the surface level, programming a YLab Edge system just means to call one task per sensor (array). The ultimate goals is to have a declarative (almost) way to configure the system. Curently, all sensors, input and output devices can be added to the play by simply adding a task to main(), with some boilerplate code.

The programming language is Rust, which is a robust choice for embedded development. It is famous for performance and for fearless concurrency. YLab Edge makes most use of these features, which allows to build very efficient devices, which can handle many data streams concurrently, as well as save the batteries for low-rate sampling devices (e.g. in climate research).

Using Rusts concurrency features, Ylab Edge uses a straight-forward task messaging architecture, where all communication between tasks is transferred via thread-safe channels. This even allows to use multiple cores on controllers as on RP2040 or ESP-C6.

Supported MCUs

  • RP2040
  • STM32 F446Zet
  • STM32 F446Re
  • STM32 H743Zit
  • Espressif ESP32-C6 (untested)

Supported busses

  • I2C (shared bus)
  • SPI (shared bus)

Planned support

  • RP3050
  • other common STM32 discovery boards
  • Arduino UNO

Supported sensors

  1. Digital pins for moments-of-interest coding
  2. Analog converters
  3. 8-channel signal amplifier (ADS1299 aka HackEEG)
  4. 6 axis motion sensor Lsm6ds
  5. arrays of up to eight motion sensors using the XCA9548 multiplexer
  6. SCD41 CO2 sensor
  7. MAX30102 oximeter/heart rate

Untested

  1. ADS1115 6-channel analog converter
  2. BMI160 6 axis motion sensor
  3. Sensirion SEN5x air quality sensor
  4. TLV493d magnetic field sensor

Output

Currently data is transmitted as CSV stream with time stamp, device ID, sensor ID and up to eight measures.

Planned output

One bottleneck is the serial output, which currently is 1Mb for RP2040 boards and 2Mb for STM32 boards. In the future an optional binary format will be introduced, which will probably give throughput a factor of 2x to 3x.

Since the data output is an encapsulated task, it is possible to implement alternative data channels, such as Bluetooth or LoRaWan. This will be the main target for the Espressif platform.

User EXperience

Every YLab Edge firmware is plug-and-play. Plug it in, open the serial port and the data will stream in. At the same time, YLab Edge is capable of interaction programming. Currently supported are Led, RGB and Ssd1306 displays for output and debounced buttons for input. A control flow is easy to develop as triggered state transitions using enum and match.

Currently, the RP2040 firmware provides a voice recorder type of interaction, whereas the STM32 firmwares just start running when plugged in.

Credits

  • Embassy developers
  • Embedded_hal developers
  • The consequent use of concurrent IO made it necessary to fork and adjust several existing sensor driver crates. The made changes were close to trivial and the credits go to the original authors.
  • Frodo Muijser for contributing a galvanically isolated remix of the HackEEG board.

About

High performance sensor systems

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages