The CCS811 is a sensor for monitoring indoor air quality. There are a number of configuration settings that make this sensor tricky to get up and running correctly. In this example we'll go over all of the steps I took to get readings from the CCS811 using a Particle Photon and a Si7021 temperature sensor.
- CCS811 $19.95
- Photon Core $19.00
- Breadboard $4.95
- Photon Micro OLED Shield $19.95 Optional
- Humidity and Temperature Sensor - Si7021 $6.95
- Break Away Headers $1.50
- Misc wires for hookup $2
Total Project Cost: ~$74.30 + tax & shipping costs
Add a Photon Battery Shield and lithium battery to make your project portable!
The following global dependencies are required for this project.
- Node.js
- Mongo
- Browserify
- apiDoc
Create a .env
file in the project root directory. Add the following environment variables replacing the value to the right of the equals sign.
ENCRYPTION_KEY=replace_me
npm install
npm run build:watch
npm start
apidoc -i server/routes/ -o apidoc/
For the complete schematic, open the air-quality.fzz file in Fritzing.
The CCS811 requires a one time 48 hour burn in period. After hooking up your components, run the burn-in.ino
code for 48 hours. The temperature and humidity readings will be accurate during this time but the tVOC reading will likely jump around.
From here on our we'll be using the air-quality.ino
file. The burn-in.ino
file is no longer needed.
By default, the CCS811 measures tVOC every second. This may be useful in some applications but is unnecessary for this example. If you end up putting this in an enclosure, reading every second will likely produce enough heat to throw of the temperature sensor.
When switching drive modes, the data sheet recommends setting the mode to 0 (idle) for 10 minutes first. After 10 minutes have passed we can set the drive mode to 3 (every 60 seconds). The CCS811 needs ~30 minutes to calculate a baseline after setting the drive mode. Make sure the levels of tVOC and CO2 aren't elevated during this time.
NOTE: The burn in only happens once but the baseline is established every time you reboot your Photon core. Make sure to ignore data collected during this time.
The air-quality.ino
is set up to display data on the micro OLED and publish the results to a variable resultstr
. You can make a request to the device at a set interval to record the data.
NOTE: Turning the WiFi off on your Photon core between data requests will help prevent the temperature from elevating.