Added luminosity sensor, more acurate temperature end debounced rainfall meter
This commit is contained in:
Binary file not shown.
After Width: | Height: | Size: 593 KiB |
Binary file not shown.
After Width: | Height: | Size: 76 KiB |
@@ -5,7 +5,7 @@
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<meta name="author" content="M.T. Konstapel" />
|
||||
<meta name="dcterms.date" content="2024-05-02" />
|
||||
<meta name="dcterms.date" content="2025-01-14" />
|
||||
<title>Weather station</title>
|
||||
<link rel="stylesheet" href="./css/mvp.css" />
|
||||
<style type="text/css">
|
||||
@@ -56,6 +56,8 @@
|
||||
<li><a href="#problems-i-encounter-after-four-months-of-use"
|
||||
id="toc-problems-i-encounter-after-four-months-of-use">Problems
|
||||
I encounter after four months of use</a></li>
|
||||
<li><a href="#additions"
|
||||
id="toc-additions">Additions</a></li>
|
||||
<li><a href="#software-dependencies"
|
||||
id="toc-software-dependencies">Software
|
||||
dependencies</a></li>
|
||||
@@ -78,7 +80,7 @@
|
||||
<h1 class="title">Weather station</h1>
|
||||
<p class="subtitle">with ModBus RTU interface</p>
|
||||
<p class="author">M.T. Konstapel</p>
|
||||
<p class="date">2024-05-02</p>
|
||||
<p class="date">2025-01-14</p>
|
||||
<p><a href="./weather_station.pdf"><i>PDF version</i></a></p>
|
||||
</header>
|
||||
<main>
|
||||
@@ -873,6 +875,7 @@ Address : 14</code></pre>
|
||||
src="./images/weather_station_schematic.svg" alt="Schematic" /></a></p>
|
||||
<h1 id="problems-i-encounter-after-four-months-of-use">Problems I
|
||||
encounter after four months of use</h1>
|
||||
<h2 id="humidity-sensor">Humidity sensor</h2>
|
||||
<p>The Si7021 humidity sensor is not made for outdoor use. The datasheet
|
||||
is clear about that. But a lot of people use this cheap sensor for
|
||||
weather stations anyway. So I choose this sensor for my design. But that
|
||||
@@ -894,6 +897,88 @@ price: it is ten times more expensive than the Si7021.</p>
|
||||
<p>The sensor can be controlled via the I2C bus, so implementing the new
|
||||
sensor in the firmware was very easy. From version 0.3.0 onward, this
|
||||
sensor is used. The Si7021 is removed from the code.</p>
|
||||
<h2 id="pressure-sensor">Pressure sensor</h2>
|
||||
<p>After a year the BMP280 pressure sensor started to give odd pressure
|
||||
values. The pressure was around 700hPa and followed the temperature
|
||||
curve. The temperature sensor still worked fine. After replacing the
|
||||
BMP280 the barometric values returned to normal. I suspect that it
|
||||
malfunctioned because of the perpetual fog we had for about two months.
|
||||
The sensor was mounted in the Garni RS1 Passive Radiation Shield. Rain
|
||||
could not enter the shield, but fog could.</p>
|
||||
<h1 id="additions">Additions</h1>
|
||||
<h2 id="luminosity-sensor">Luminosity sensor</h2>
|
||||
<p>From version 0.3.1 onward, the weather station has an ambient light
|
||||
sensor. It is an SEN0562 from DFRobot and it outputs the light intensity
|
||||
in Lux. It is a 5 Volt only device, so it should be connected to the 5
|
||||
Volt I2C bus.</p>
|
||||
<figure>
|
||||
<img
|
||||
src="./images/dfrobot-gravity-ip68-waterproof-ambient-light-sensor-1-65535lx-i2c.png"
|
||||
alt="The SEN0562 ambient light sensor" />
|
||||
<figcaption aria-hidden="true">The SEN0562 ambient light
|
||||
sensor</figcaption>
|
||||
</figure>
|
||||
<figure>
|
||||
<img
|
||||
src="./images/dfrobot-gravity-ip68-waterproof-ambient-light-sensor-wiring.png"
|
||||
alt="Connection of the I2C bus" />
|
||||
<figcaption aria-hidden="true">Connection of the I2C bus</figcaption>
|
||||
</figure>
|
||||
<p>The sensor has the following specifications:</p>
|
||||
<ul>
|
||||
<li>Supply Voltage: 5V</li>
|
||||
<li>Operating Current: 1µA</li>
|
||||
<li>Detection Range: 1 - 65535lx</li>
|
||||
<li>Accuracy: 1.2lx</li>
|
||||
<li>Communication Mode: I2C</li>
|
||||
<li>Operating Temperature: -40 to 85°C/-40 to 185℉</li>
|
||||
<li>Waterproof Rating: IP68</li>
|
||||
<li>Thread Length: 10mm</li>
|
||||
<li>Cutout Size: 26mm</li>
|
||||
<li>Wrench Size: 31mm</li>
|
||||
<li>Cable Diameter: 3mm</li>
|
||||
<li>Wire Length: 1m</li>
|
||||
</ul>
|
||||
<p>Sample code:</p>
|
||||
<pre><code>#include "Wire.h"
|
||||
#define address 0x23 //I2C address 0x23
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
Wire.begin();
|
||||
}
|
||||
uint8_t buf[4] = {0};
|
||||
uint16_t data, data1;
|
||||
float Lux;
|
||||
void loop()
|
||||
{
|
||||
readReg(0x10, buf, 2); //Register address 0x10
|
||||
data = buf[0] << 8 | buf[1];
|
||||
Lux = (((float)data )/1.2);
|
||||
Serial.print("LUX:");
|
||||
Serial.print(Lux);
|
||||
Serial.print("lx");
|
||||
Serial.print("\n");
|
||||
delay(500);
|
||||
}
|
||||
uint8_t readReg(uint8_t reg, const void* pBuf, size_t size)
|
||||
{
|
||||
if (pBuf == NULL) {
|
||||
Serial.println("pBuf ERROR!! : null pointer");
|
||||
}
|
||||
uint8_t * _pBuf = (uint8_t *)pBuf;
|
||||
Wire.beginTransmission(address);
|
||||
Wire.write(&reg, 1);
|
||||
if ( Wire.endTransmission() != 0) {
|
||||
return 0;
|
||||
}
|
||||
delay(20);
|
||||
Wire.requestFrom(address, (uint8_t) size);
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
_pBuf[i] = Wire.read();
|
||||
}
|
||||
return size;
|
||||
}</code></pre>
|
||||
<!---
|
||||
# Bill of materials
|
||||
|
||||
@@ -914,7 +999,7 @@ sensor is used. The Si7021 is removed from the code.</p>
|
||||
</ul>
|
||||
<p>Libraries are included with the source code of this project</p>
|
||||
<h1 id="license">License</h1>
|
||||
<p>Copyright (C) 2023, 2024 M.T. Konstapel</p>
|
||||
<p>Copyright (C) 2023-2025 M.T. Konstapel</p>
|
||||
<p><a
|
||||
href="https://meezenest.nl/mees/">https://meezenest.nl/mees/</a></p>
|
||||
<p>The software is published as open-source software (GPL). The hardware
|
||||
@@ -932,7 +1017,7 @@ option) any later version.</p>
|
||||
</main>
|
||||
<footer>
|
||||
<p>©
|
||||
2024-05-02
|
||||
2025-01-14
|
||||
M.T. Konstapel
|
||||
<a href="https://meezenest.nl/mees/">https://meezenest.nl/mees/</a>
|
||||
</p><p>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
|
||||
|
@@ -2,7 +2,7 @@
|
||||
title: Weather station
|
||||
subtitle: with ModBus RTU interface
|
||||
author: M.T. Konstapel
|
||||
date: 2024-05-02
|
||||
date: 2025-01-14
|
||||
website: https://meezenest.nl/mees/
|
||||
page_back: https://meezenest.nl/mees/weather_station.html
|
||||
logo: ./images/mees_logo.svg
|
||||
@@ -394,10 +394,83 @@ As a housing for the prototype, I used an old beehive. These are weatherproof an
|
||||
|
||||
# Problems I encounter after four months of use
|
||||
|
||||
## Humidity sensor
|
||||
|
||||
The Si7021 humidity sensor is not made for outdoor use. The datasheet is clear about that. But a lot of people use this cheap sensor for weather stations anyway. So I choose this sensor for my design. But that was not smart. After an initial time without any problems, the sensor started to saturate. This happened during a very wet and mild winter we had. My first solution was to utilize the build in heater to drive of the moisture. That worked, but only for a short period. The heater blew up and the sensor started to report humidity levels above 100% and because of a bug in the firmware of the sensor, the humidity register wrapped around and the sensor reported humidity levels of 0-30%. I tried to find a software solution, which worked for a while, but the sensor deteriorated even more. To the point of being totally useless. So I searched for another, better sensor. And I found the HYT-221 from Innovative Sensor Technology. This sensor is designed to work outdoors and can even be used in saunas, where the humidity levels are always high and the air is condensating. The datasheet specifically mentions outdoor weather stations as an application. The only downside is its price: it is ten times more expensive than the Si7021.
|
||||
|
||||
The sensor can be controlled via the I2C bus, so implementing the new sensor in the firmware was very easy. From version 0.3.0 onward, this sensor is used. The Si7021 is removed from the code.
|
||||
|
||||
## Pressure sensor
|
||||
|
||||
After a year the BMP280 pressure sensor started to give odd pressure values. The pressure was around 700hPa and followed the temperature curve. The temperature sensor still worked fine. After replacing the BMP280 the barometric values returned to normal. I suspect that it malfunctioned because of the perpetual fog we had for about two months. The sensor was mounted in the Garni RS1 Passive Radiation Shield. Rain could not enter the shield, but fog could.
|
||||
|
||||
# Additions
|
||||
|
||||
## Luminosity sensor
|
||||
|
||||
From version 0.3.1 onward, the weather station has an ambient light sensor. It is an SEN0562 from DFRobot and it outputs the light intensity in Lux. It is a 5 Volt only device, so it should be connected to the 5 Volt I2C bus.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
The sensor has the following specifications:
|
||||
|
||||
- Supply Voltage: 5V
|
||||
- Operating Current: 1µA
|
||||
- Detection Range: 1 - 65535lx
|
||||
- Accuracy: 1.2lx
|
||||
- Communication Mode: I2C
|
||||
- Operating Temperature: -40 to 85°C/-40 to 185℉
|
||||
- Waterproof Rating: IP68
|
||||
- Thread Length: 10mm
|
||||
- Cutout Size: 26mm
|
||||
- Wrench Size: 31mm
|
||||
- Cable Diameter: 3mm
|
||||
- Wire Length: 1m
|
||||
|
||||
Sample code:
|
||||
|
||||
#include "Wire.h"
|
||||
#define address 0x23 //I2C address 0x23
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
Wire.begin();
|
||||
}
|
||||
uint8_t buf[4] = {0};
|
||||
uint16_t data, data1;
|
||||
float Lux;
|
||||
void loop()
|
||||
{
|
||||
readReg(0x10, buf, 2); //Register address 0x10
|
||||
data = buf[0] << 8 | buf[1];
|
||||
Lux = (((float)data )/1.2);
|
||||
Serial.print("LUX:");
|
||||
Serial.print(Lux);
|
||||
Serial.print("lx");
|
||||
Serial.print("\n");
|
||||
delay(500);
|
||||
}
|
||||
uint8_t readReg(uint8_t reg, const void* pBuf, size_t size)
|
||||
{
|
||||
if (pBuf == NULL) {
|
||||
Serial.println("pBuf ERROR!! : null pointer");
|
||||
}
|
||||
uint8_t * _pBuf = (uint8_t *)pBuf;
|
||||
Wire.beginTransmission(address);
|
||||
Wire.write(®, 1);
|
||||
if ( Wire.endTransmission() != 0) {
|
||||
return 0;
|
||||
}
|
||||
delay(20);
|
||||
Wire.requestFrom(address, (uint8_t) size);
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
_pBuf[i] = Wire.read();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
<!---
|
||||
# Bill of materials
|
||||
|
||||
@@ -421,7 +494,7 @@ Libraries are included with the source code of this project
|
||||
|
||||
# License
|
||||
|
||||
Copyright (C) 2023, 2024 M.T. Konstapel
|
||||
Copyright (C) 2023-2025 M.T. Konstapel
|
||||
|
||||
[https://meezenest.nl/mees/](https://meezenest.nl/mees/)
|
||||
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user