Add driver for Sensirion SEN6x environmental sensors
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- go
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
Read the TinyGo driver design guide and the referenced drivers/pull/345 discussion to understand the Sensor interface; compare the proposed port with the linked periph driver in PR 118. Decide how the measurements, optional raw reads, and configuration methods should work before implementing the driver. Done means a SEN6x driver is ported to TinyGo with the requested interface and behavior, with the design questions resolved.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I wrote a SEN6x driver for periph (PR is here) and I'd like to contribute it to TinyGo as well. I'm currently working on porting it to TinyGo, including:
- Remove
github.com/google/go-cmp/cmpfrom tests since it uses unimplementedreflectfunctions - Remove periph-specific stuff like the
SenseContinuousmethod - Avoid heap allocations
- Implement TinyGo's
Sensorinterface
Background
The Sensirion SEN6x family includes 6 sensors (SEN62, SEN63C, SEN65, SEN66, SEN68, SEN69C) that support the following measurements, in different combinations depending on the model:
- Particulate matter (PM1.0, PM2.5, PM4, and PM10, with the addition of PM0.5 from the "Read Number Concentration Values" command)
- Relative humidity
- Temperature
- VOC as a Sensirion VOC index value
- NOx as a Sensirion NOx index value
- Formaldehyde (HCHO)
- CO2
Datasheet: https://sensirion.com/media/documents/FAFC548D/693FBB15/PS_DS_SEN6x.pdf
Sensor interface implementation
(I read the entirety of https://github.com/tinygo-org/drivers/pull/345 to understand the design.)
I'm considering the mapping from sensor values to drivers.Measurement:
- Particulate matter:
drivers.ConcentrationI guess? It's measured in μg/m^3, not ppx, but still a concentration - Relative humidity:
drivers.Humidity - Temperature:
drivers.Temperature - VOC index:
drivers.Concentrationis the closest of the existingMeasurements but this isn't strictly a concentration value - NOx index: ditto VOC index
- Formaldehyde (HCHO):
drivers.Concentration - CO2:
drivers.Concentration
I think I'm fine with the mapping above with the exception of particulate matter, which seems different enough from the gas measurements to merit a different measurement type (and it's different from the intent of drivers.Concentration, whose comment says, "Gas or liquid concentration, usually measured in ppm (parts per million)."). Maybe we could add drivers.ParticulateMatter?
The command "Read Measured Values" returns all of these values at once (there is no way to read an individual measurement) so for this sensor the details are academic I guess... But I imagine that we do want a sensor to accurately represent its capabilities, like for composing sensors, right?
To complicate matters, the set of measurements above is actually not the only one. There is also "Read Measured Raw Values" which returns the uncompensated temperature and humidity values and "Read Number Concentration Values" which returns particulate matter in particles/cm^3.
One could imagine a call to Update performing "Read Measured Values", "Read Measured Raw Values", and "Read Number Concentration Values", thereby updating all measurements, but that's wasteful. I expect that most users of this sensor will only use the main measurements returned by "Read Measured Values". They're all I'm using for my project.
I'd like to allow the user to request the raw values and PM number concentrations only if they desire; tripling the number of I2C transactions per Update seems silly.
I can see several options for handling this:
Updateonly updates the values returned by "Read Measured Values". The others are for niche use cases that the user can implement manually usingDevice.ReadMeasuredRawValuesandDevice.ReadNumberConcentrationValues.- We add a new
Measurementlikedrivers.Rawor something that tellsUpdatethat we want the measurements from "Read Measured Raw Values" and "Read Number Concentration Values". Ifdrivers.Rawis not given we'll only send the "Read Measured Values" command. - We add a new method (or my driver just implements)
UpdateRawthat handles the raw measurements.
Config
The driver design guide suggests creating a Config struct to capture the device's config and a Configure method to set config on a device. Seems reasonable. It kinda breaks down for the SEN6x though because there's a ton that can be configured:
- Temperature offset parameters
- Temperature acceleration parameters
- VOC algorithm tuning parameters
- VOC algorithm state
- NOx algorithm tuning parameters
- CO2 forced recalibration, which is a process that includes sending config to the device
- Ambient pressure for the CO2 sensor
- Altitude for the CO2 sensor
My periph driver defines structs for each of these (well, for the collections of params, some like pressure are just scalars). Putting them all together and setting them via one Configure method would result in a huge struct and 8 I2C commands per call.
I'm inclined to leave config separated out so that users can configure only what they need to. Thoughts?
- Ngôn ngữ chính
- Go
- Star
- 756
- Fork
- 251
- Merge trung bình
- 7 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tinygo-org/drivers
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
tinygo-org/drivers#946 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
tinygo-org/drivers#927 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 22/100
tinygo-org/drivers#901 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
tinygo-org/drivers#886 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
240Mhz Support For ESP32-S3Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
tinygo-org/drivers#876 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của tinygo-org/drivers
Issue tương tự
-
release
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
github/gh-aw-mcpg#17603 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
avr: SPI Mode2 runs as mode 1Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
tinygo-org/tinygo#6727 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
help wanted
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
oras-project/oras-go#1827 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: database/sql Sessions example never commits its batch, and its "Full Example" link is a 404Đang mởdocumentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ClickHouse/clickhouse-go#2185 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs triage receiver/podman
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
open-telemetry/opentelemetry-collector-contrib#53700 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày