Added luminosity sensor, more acurate temperature end debounced rainfall meter
This commit is contained in:
@@ -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>.
|
||||
|
Reference in New Issue
Block a user