Skip to content

Sensors

NicolasDenier edited this page Jan 12, 2023 · 4 revisions

Presentation

The tiny house contains 8 sensors, which are taking 12 measurements. Each measurement has an unique ID for the EPF API.

sensor measure unit API ID
DHT22 1 upper air layer humidity %RH 57
DHT22 1 upper air layer temperature °C 58
DHT22 2 lower air layer humidity %RH 59
DHT22 2 lower air layer temperature °C 60
DHT22 3 upper tube humidity %RH 67
DHT22 3 upper tube temperature °C 68
DHT22 4 lower tube humidity %RH 69
DHT22 4 lower tube temperature °C 70
Thermocouple 1 upper surface temperature °C 61
Thermocouple 2 lower surface temperature °C 62
Pyranometer irradiance W/M² 52
Anemometer outside wind speed km/h 53

The following diagram shows their locations on the prototype.

The collected values are accessible at https://preprodapi.mde.epf.fr/measure.php?id=<id>, where <id> is a number corresponding to the sensor ID.

Circuit details

It is recommended to test each sensor individually before the whole system, here are the individual circuits associated to each sensor type, the code are stored on the P5A-Enerlog/sensor_testing repository.

Temperature humidity DHT22

This sensor is often used with Arduino, thus its documentation can be easily found.

measure unit min value max value accuracy
temperature °C -40 +125 ±2°C
humidity %RH 0 100 2-5%

Thermocouple Max6675

The Max6675 is measuring a surface temperature, it can work between -20 and +80 °C but can measure higher temperatures.

measure unit min value max value accuracy
surface temperature °C 0 +1024 ±0.25°C

Pyranometer SP-215 Apogee

full datasheet

power supply 5.5 to 24 V DC
sensitivity 2.5 mV per W.m⁻²
spectral range 360 to 1120 nm

The pyranometer is a bit difficult to calibrate, as the response is not linear, a post processing may have to be done. Also, the sensor output needs to be adjusted to the ESP32.
We measured the maximum voltage output from the sensor with an artifical light, and reached 4.6 V. As the ESP32 pins can only receive up to 3.3 V, a voltage divider can be used to have the supported range. Based on the following diagram, the maximum received voltage is

$$ V_{received} = V_{max} \times \frac{R_1}{R_1+R_2} = 4.6 \times \frac{5.6}{5.6+2.2} \approx 3.3 V$$

This value will be read by the ESP32 as an int between 0 and 4096, due to its 12 bits ADC (Analog to Digital Converter).
The final irradiance value is obtained with the following conversion:

$$ irradiance = V_{received} \times \frac{0.4 \times 3300}{4095} $$

The 0.4 is coming from the datasheet (1/sensitivity) but may have to be adapted because of the voltage divider.

A strange observation is that during night the sensor is giving values around 600 W.m⁻²

WiFi needs to be turned off when sensing with an analog pin due to the ESP32 ADC

Anemometer

An anemometer is actually equivalent to a switch that is activated at every revolution, and the ESP32 will count the occurences of activations over a certain time (we defined it to 10 seconds to have a smoothed average). According to the datasheet, one turn per second equals a wind speed of 2.4 km/h, so the wind speed is obtained with:

$$ 2.4 \times \frac{count}{record time} $$

This blog explains it well, they use 5 V but this signal is then sent to the Arduino board, we noticed that in our case 3.3 V is better and works fine (otherwise the board is receiving 5 V and can be damaged).


The two wires from the anemometer can be inverted, that is why there is no distinction on the diagram.

Fan

The 12 V computer fan used can be replaced by any other fan, as long as the power supply is adapted. An analog output from the ESP32 is controlling how much voltage is granted to the fan and so the resulting wind speed.

Clone this wiki locally