Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ADataDate/pxt-airQuality
Makecode Package for the CCS811 Air Quality Sensor
https://github.com/ADataDate/pxt-airQuality
Last synced: 3 months ago
JSON representation
Makecode Package for the CCS811 Air Quality Sensor
- Host: GitHub
- URL: https://github.com/ADataDate/pxt-airQuality
- Owner: ADataDate
- License: mit
- Created: 2017-08-25T21:13:23.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-12T19:19:02.000Z (almost 7 years ago)
- Last Synced: 2024-03-05T14:48:27.654Z (4 months ago)
- Language: TypeScript
- Size: 1.41 MB
- Stars: 5
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-microbit-zh - CCS811 - CCS811空气质量传感器模块(可提供等效二氧化碳(eCO2)等级或总挥发性有机化合物(TVOC)指标)的pxt驱动. (编程 / JavaScript 和 MakeCode)
- awesome-microbit - CCS811 - Makecode Package for the CCS811 Air Quality Sensor. (👩💻 Programming / 🗿 JavaScript and MakeCode)
README
# airQuality
![SparkFun Air Quality Breakout - CCS811](https://www.sparkfun.com/products/14193)
This package adds functionality to the weather:bit board sold by SparkFun.
To use this package, go to https://makecode.microbit.org, click ``Add Package`` and search for: https://github.com/ADataDate/pxt-airQuality in the search bar.
### ~
This package is still under development and subject to changes.
### ~
### Usage
* The CCS811 Air Quality Sensor can be directly mated to the matching pins (I2C) of the weather:bit for micro:bit system.
* I2C is set up so the user needs to start the device, then read the data.
* The CCS811 sensor takes 20 minutes to burn-in or get meaningful data.
* The TVOCs are presented as number between 0ppb to 1187ppb.
* The eCO2 (equivalent CO2) is presented as a number between 400ppm to 8192ppm.### Micro:bit Pins Used
* ``P19`` -- I2C - SCL
* ``P20`` -- I2C - SDA### CCS811 Start Function
The first block in the AirQuality package is the |CCS811 Start| block. At the start of any program which will use the air quality sensor place the |CCS811 Start| block in a
"Forever" block above the rest of your code.### Air Quality Data
The CCS811 air quality sensors communicates via I2C. The data returned as a number can be stored in a variable, displayed on the 5x5 LED Matrix or sent serially to OpenLog.
* ``|CCS811 Start|``block sets the CCS811 sensor into APP MODE - basically turns it on and ready to transmit data
* ``|Read eCO2|``block reads the equivalent CO2 and can be any number between 400ppm and 8182ppm.
* ``|Read TVOCs|``block reads the total organic volatile compounds and can be any number between 0ppb to 1187ppb.
* ``|Device Error|``block is used while troubleshooting otherwise don't use it. It will return a number corresponding to a specific error on the CCS811.
* ``|Device Status|``block is used while troubleshooting otherwise don't use it.
* ``|HWID|``block is used to test the most basic read on the I2C line. Use if you are having probelms establishing communication.### Example Project:
The following project will read the eCO2 and TVOCs data and then display it on the 5x5 LED matrix.```blocks
let eCO2 = 0
let TVOCs = 0
basic.forever(() => {
TVOCs = airQuality.readTvoc()
eCO2 = airQuality.readCo2()
basic.showString("TVOC")
basic.showNumber(TVOCs)
basic.pause(1000)
basic.showString("eCO2")
basic.showNumber(eCO2)
basic.pause(1000)
})
airQuality.appStart()
```## License
MIT
## Supported targets
* for PXT/microbit
```package
airQuality=github:ADataDate/pxt-airQuality
```