Sensors
This is a list of sensors and their related information.
MH-Z19 CO2 Sensor[edit | edit source]
These CO2 modules cost about $17 USD. They come in 3 models: 0-2000PPM, 0-5000PPM, and 0-10000PPM.
Interface: PWM or UART
See: MH-Z19 Carbon Dioxide Sensor
CCS811 Air Quality Sensor[edit | edit source]
The CCS811 air quality sensor can measure Volatile Organic Compounds (VOCs). The internal microprocessor will calculate the equivalent CO2 value from the VOC measurement. These cost about $8 USD. The device or the library driving it is causing issues with the I2C bus which causes the entire bus to freeze. If you want to measure CO2, I would recommend using the MH-Z19 which actually measures CO2 rather than eCO2.
The datasheet can be found at: https://www.sciosense.com/wp-content/uploads/2020/01/CCS811-Datasheet.pdf
Pin Number | Pin Name | Description |
1 | VCC | Power supply for the module can typically 3.3V is used |
2 | GND | Ground of the module, connected to ground of the circuit |
3 | SCL | Serial Clock Line, used to provide clock pulse for I2C communication |
4 | SDA | Serial Data Address, used to transfer the data through I2C communication |
5 | WAK | Wake (active low) |
6 | INT | Interrupt (active low) |
7 | RST | Reset (active low) |
8 | ADD | Single address select bit to allow alternate address to be selected |
To use the sensor:
- Connect Vcc and Ground
- For a ESP8266, connect SCL and SDA (I2C) to D1 and D2 respectively.
- Connect WAK to ground
Using I2C, the device is on address 0x57.
I2C Freezing Issue[edit | edit source]
The sensor randomly causes the I2C bus to freeze after an hour or so. This issue is discussed at https://github.com/arendst/Tasmota/issues/3364.
One proposed solution by Frogmore42 is to add a delay in the Adafruit library:
// in Adafruit_CCS811::read
Wire.endTransmission();
delay(1);
Wire.requestFrom((uint8_t)_i2caddr, read_now);
Sensor Broke?[edit | edit source]
The first sensor I tried to use worked for a bit, but the I2C issue cropped up. I then soldered it to a protoboard thinking the issue may be related to the breadboard, but then it completely stopped working. ReadData returned 24 which suggests an issue with the heater?
MQ135 Air Quality Sensor[edit | edit source]
This module will return a high signal when the air quality meets a certain criteria.
DHT 11, DHT22[edit | edit source]
The DHT11 is a digital temperature and humidity sensor. They are notable by their blue perforated plastic package. The DHT11 is created by Aosong Guangzhou Electronics Co. Ltd. Each unit costs around $1.5 USD.
The DHT22, also called AM2302, RHT03, is similar to the DHT11 but offers a slightly wider operating temperature range and higher temperature and humidity resolution. The DHT22 is slightly more expensive at around $3 USD per unit.
The difference between the two modules are outlined in the table below.
DHT11 | DHT22 | |
Relative Humidity Operating Range | 20 ~ 90% | 0 ~ 100% |
Relative Humidity Accuracy | ±5%RH | ±2%RH (Max ±5%RH) |
Humidity Resolution | 1%RH | 0.1%RH |
Humidity Repeatability | ±1%RH | ±1%RH |
Humidity Hysteresis | ±1%RH | ±0.3%RH |
Long-term Stability | ±1%RH/year | ±0.5%RH/year |
Temperature Operating Range | 0 ~ 50°C | -40 ~ 80°C |
Temperature Accuracy | ±2°C | ±0.5°C |
Temperature Resolution | 1°C | 0.1°C |
BMP085, BMP180, BMP280[edit | edit source]
These BMPs are atmospheric pressure sensors. They use I2C or SPI. The BMP280 appears to have superseded and are readily available on Ebay for around $0.50 and $1 USD each.
The BMP280 I obtained appear on address 0x76. If you are using the Adafruit library, you need to use the BMP280_ADDRESS_ALT address.
MAX30102[edit | edit source]
The MAX30102 is a heart rate monitor and pulse oximeter biosensor. These modules cost about $2 USD on AliExpress.
Using I2C, this has address 0x5A.
HC-SR501 Infrared Motion Sensor[edit | edit source]
The SR501 is an infrared motion sensor. They cost around $1.5 USD each. It has 2 potentiometers that are used to adjust the detection sensitivity and duration of the signal. The middle output pin gives a 3.3V signal when motion is detected and resets back to ground after a period of time.