Table of Contents

The Result

Click to open in a new window.

Media ID: B4qE0sVoC2s

This project takes a couple of simple modules and joins them together on a single PCB:

  • D1mini microcontroller, incl. USB serial
  • BME280 temperature, humidity, pressure
  • CCS811 air quality (VOC, eCO2)
  • APDS9960 light sensor, gesture sensor (not used)

The data from the BME280 is used to correct/calibrate the CCS811.

The data form all sensors is read and sent to a server on my local network. The data is sent as CSV string:


The Parts (.stl/.kicad Downloads)

A big thank you to Aisler for sponsoring the PCBs. Their service and support is awesome. You can order the PCB that I created directly from them, or modify my sources and create your own. All you need to do is upload the .kicad_pcb file here: You can use my promo code p3dt50 until the end of 2019 which will give you 50% off.

Amount Part Type Datasheet Links
1 ย Env.Sens. V1.1 PCB ย PCB ย N/A ๐Ÿ’พ ๐Ÿ›’
1 ย Env.Sens. V1.1 Case 3D Print ย N/A ๐Ÿ’พ
1 D1mini Module N/A ๐Ÿ”Ž aliexpress
1 BME280 Module ๐Ÿ”Ž google ๐Ÿ”Ž aliexpress
1 CCS811 Module ๐Ÿ”Ž google ๐Ÿ”Ž aliexpress
1 APDS9960 Module ๐Ÿ”Ž google ๐Ÿ”Ž aliexpress
1 10k R ย  ๐Ÿ”Ž aliexpress
1 PhotoResistor R ย  ๐Ÿ”Ž aliexpress
ย 1 ย M2x5mm Hex Screw ย  ย  ๐Ÿ”Ž aliexpressย 
ย 1 ย M2x4mm Brass Insert ย  ย  ๐Ÿ”Ž aliexpressย 

The table only includes example searches for the parts. Make sure to get the right modules, see the image below for details:

The modules face to the outside of the PCB that holds everything together. The BME280 is as far away as possible from the ESP to avoid temperature drift as the chip heats up a bit.

Click on the image for a higher resolution.

The Schematics

As all modules communicate with each other via *I2C*, all we need to do is connect them to GND, VCC (=3V3), SCL and SDA. The CCS811 as well as the APDS9960 have additional pins, such as interrupt pins, that we connect to empty pins, we might use them later.
The photo resistor is connected to VCC (=3V3), and via a 10k resistor to GND to create a voltage divider. We measure the voltage between both resistors via pin A0 on the D1mini. Depending on the amount of light hitting the photo resistor the resistance changes and thus the voltage that is divided between the two resistors.


All the parts added on a single PCB. I added a USB-A connector into the PCB to be able to use this as a mobile sensor, directly plugged into a battery pack.

We need to add a piece of paper to make the PCB a bit thicker. The USB port expects 2.2mm, the PCB is 1.6mm. Otherwise it will fall out as is.
The 3D preview. I added labels that point into the direction of the antenna and the USB connector of the D1mini as reminders when soldering. Always check twice. ;)

The 3D Print

You can download the blender sources as well as the .stl file here: ๐Ÿ’พ

The case is only used to place the device on a flat surface. Feel free to modify the original and add a case around it.

The Code

My github repositories below contain files.

The server code: node-mini-iot-server.

The client code: arduino-mini-iot-client ย devices/envsens-1.0

If you know how to use Grafana you can use my mini iot server as a simple json datasource:

You can see the air quality decreasing if you spend time in the room without opening a window ;). I started cooking around 14h00.
You can see the sun rise at 07h38 and the sunset around 17h00. The fluctuations show it was partially covered.


  • fix: itโ€™s APDS9960 not APDS9960, updated PCB to v1.2 (fixed label), updated source to