sen55=github:bsiever/pxt-sen55
This extension supports the Sensirion SEN55 Environmental Sensor Node, which includes sensors for:
Sensor details and data sheets can be found at: https://sensirion.com/products/catalog/SEN55/
Almost all the parts necessary for this project can be purchased from DigiKey:
There are also a few parts that are available in a variety of kits and from other sources. Below are variations that are available via Amazon:
All three are available in this Amazon kit: https://www.amazon.com/HJ-Garden-Electronic-Component-Breadboard/dp/B077SFGWYP/
Using parts like those from the Amazon kit, there are 9 major steps to wiring:
Errors most reading numeric values (sensor values, not firmware version) or reported as NaN
(“Not a Number”). Number.isNaN()
can be used to determine if the returned value is not valid (is NaN
).
sen55.startMeasurements(measurementType?: Sen55SensorMode) : void
Start making measurements. If no argument is provided, it defaults to including measurements of particles. Measurements that include particles (no argument or Sen55SensorMode.WithParticleMass
) use more power than measurements of gasses only (Sen55SensorMode.WithoutParticleMass
).
sen55.particleMass(size?: Sen55ParticleMasses) : number
Get the mass of particles of size 0.3µm up to the given size per volume (µg/m³). Returns NaN
on error.
Measurements must be started via sen55.startMeasurements(Sen55SensorMode.WithParticleMass)
prior to use.
sen55.particleCount(size?: Sen55ParticleCounts) : number
Get the count of particles of size 0.3µm up to the given size per volume (#/cm³).
Measurements must be started via sen55.startMeasurements(Sen55SensorMode.WithParticleMass)
prior to use. Returns NaN
on error.
sen55.VOCIndex(): number
Get the VOC index [1-500]. See https://sensirion.com/media/documents/02232963/6294E043/Info_Note_VOC_Index.pdf . Returns NaN
on error.
sen55.NOxIndex(): number
Get the NOx index [1-500]. See https://sensirion.com/media/documents/9F289B95/6294DFFC/Info_Note_NOx_Index.pdf . Returns NaN
on error.
sen55.temperature(): number
Get the temperature in Celsius. The temperature value will be compensated based on Sensirion’s STAR algorithm.
sen55.humidity(): number
Get the relative humidity (0-100%). The humidity value will be compensated based on Sensirion’s STAR algorithm. Returns NaN
on error.
sen55.stopMeasurements() : void
Stop making measurements and return to low-power idle mode.
sen55.onError(errCallback: (reason: string) => void) : void
Respond to any errors. reason
will be a description of the error.
sen55.typicalParticleSize(): number
Get the typical particle size in µm. Returns NaN
on error.
sen55.typicalParticleSize(): number
Get the typical particle size in µm. Returns NaN
on error.
sen55.deviceStatus(): number
Get the device status. Returns a number with bit masks given in sen55.StatusMasks
. Returns -1 on error.
sen55.rawVOC(): number
Get the raw VOC value (not an index). The raw value is proportional to the logarithm of the corresponding sensor resistance. Returns NaN
on error. See https://sensirion.com/media/documents/5FE8673C/61E96F50/Sensirion_Gas_Sensors_Datasheet_SGP41.pdf .
sen55.rawNOx(): number
Get the raw NOx value (not an index). The raw value is proportional to the logarithm of the corresponding sensor resistance. Returns NaN
on error. See https://sensirion.com/media/documents/5FE8673C/61E96F50/Sensirion_Gas_Sensors_Datasheet_SGP41.pdf .
sen55.rawTemperature(): number
Get the raw temperature value °C” (not compensated). Returns NaN
on error.
sen55.rawHumidity(): number
Get the raw relative humidity” (not compensated). Returns NaN
on error.
sen55.productName(): string
Get the product name. Returns an empty string on error.
sen55.serialNumber(): string
Get the Serial number. Returns an empty string on error.
sen55.firmwareVersion(): number
Get the firmware version. Returns -1 on error.
sen55.reset(): void
Reset the sensor (back to startup conditions; Not performing measurements).
sen55.clearDeviceStatus(): void
Clear the device status.
sen55.startFanCleaning(): void
Start cleaning the fan. Takes ~10s and all values are invalid while cleaning.
Fan will automatically be cleaned if the device is continuously running without reset/restart for 1 week (168 hours). Ideally fan should be cleaned after 168 hours of use, even if not continuously in use.
The following program will get air quality measures every second and relay them to the serial console / logger.
basic.showIcon(IconNames.Heart)
sen55.startMeasurements()
sen55.onError(function (reason) {
serial.writeLine(reason)
})
loops.everyInterval(1000, function () {
serial.writeValue("pm10", sen55.particleMass(Sen55ParticleMasses.PM100))
serial.writeValue("voc", sen55.VOCIndex())
serial.writeValue("NOx", sen55.NOxIndex())
serial.writeValue("temp", sen55.temperature())
serial.writeValue("rh", sen55.humidity())
})
Icon based on Font Awesome icon 0xf0c2 SVG.
I develop micro:bit extensions in my spare time to support activities I’m enthusiastic about, like summer camps and science curricula. You are welcome to become a sponsor of my micro:bit work (one time or recurring payments), which helps offset equipment costs: here. Any support at all is greatly appreciated!
for PXT/microbit