Crates.io | sen0177 |
lib.rs | sen0177 |
version | 0.6.0 |
source | src |
created_at | 2020-08-25 03:48:31.474313 |
updated_at | 2024-01-10 00:12:46.179916 |
description | Read air quality data from the SEN0177 and PMSA003I sensors |
homepage | https://github.com/kelnos/sen0177-rs |
repository | https://github.com/kelnos/sen0177-rs |
max_upload_size | |
id | 280369 |
size | 30,310 |
sen0177
is a Rust library/crate that reads air quality data from the
SEN0177 air quality sensor.
embedded_hal
]
traits.Include the following in your Cargo.toml
file:
[dependencies]
sen0177 = "0.6"
If you are in a no_std
environment, you may depend on this crate like so:
[dependencies]
sen0177 = { version = "0.6", default-features = false }
See the examples/
directory.
Note that linux-embedded-hal
does not (as of this writing) have a
release supporting the stable 1.x series of embedded-hal
, so the Linux
example has to pull linux-embedded-hal
from GitHub.
Note that the serial device occasionally returns bad data. If you
receive [SensorError::BadMagic
] or [SensorError::ChecksumMismatch
]
from the [AirQualitySensor::read
] call, a second try will usually succeed.
If you're using this with a Raspberry Pi, note that by default the
primary UART is set up as a Linux serial console. You will need
to disable that (by editing /boot/cmdline.txt
) before this will work.
Instead of using a specifiy TTY device node, you should use
/dev/serial0
, which is a symlink to the proper device.
Alternatively, you can use the second UART, but you'll need to load an overlay to assign it to GPIO pins. See UART configuration and the UART-related overlays for more information.