پنج شنبه,۲۰ مرداد ماه ۱۴۰۱مطابق با ۱۳ محرم ۱۴۴۴ هجرى قمرى
Gas Meter with reed switch and ESP8266 using Light Sleep and Blynk
(which I can wake it up with a GPIOs).
This project helps you to monitor the consumption of your home gas meter remotely over the internet by using pulse counting methods.
Many standards gas meters for electricity (in the GR or other countries) have a unique “spot” on their rotating disk, which can be read with a suitable magnetic sensor and appropriate electronics.
I have a BK-G4 gas meter installed in my home. This meter has a small magnet on the last two digit of the meter.
We can count these magnetic pulses by using a Hall effect sensor or a reed switch to determine gas consumption.
Each pulse corresponds to 0.1 m³.
Why a magnetic reed switch?
A magnetic reed switch does not require a power supply to operate, responds equally to magnetic fields of any polarity and orientation and its sensitivity is sufficient for our purpose.
The reed switches closes when exposes to a magnetic fields.
1. ESP8266 or (ESP-12)
2. A not open magnetic reed switch
The plan is to use an ESP8266 RTC built-in timer and try to implement a light sleep mode on it.
Each time the reed switch closes, the ESP wakes up from light sleep and therefore we can count the reboots.
Why Light Sleep Mode?
This mode of operation is useful to get minimal power consumption between each pluses.
In this mode, digital peripheral devices, most of the RAM, and CPUs are clock-controlled.
To do this, we set the maximum sleep time on ESP-12 and wake it up by triggering the GPIO02 pin(or any other GPIO pins).
Save Data on RTC Memories
The ESP82xx has 512 bytes SRAM on the RTC part, called RTC memory. The data saved will not be deleted during light sleep.
To save how often the ESP8266 wakes up from a light sleep, we use the RTC internal memory of the ESP82xx.
The RTC memory is addressable per 32 bits.
In total, there is 768 bytes (192 addressable blocks).
- 0 .. 63 (256 bytes) Reserved for esp8266/Arduino library.
In this structure I define two variables one for storing the count of reboots (_count) and another one for daily task (_lastDay).
_count (This variable is used to store the count of times that the ESP woke up from light sleep).
Code checked into the GitHub repository under:
A very simple circuit that uses a reed switch to count the pulses:
The Magnetic Reed switch is connected between GPIO02 and ground.
GPIO02 use an external pullup resistor. In this case, when switch is open and magnet is away, the pin is high.
When the switch is closed then the pin is low, it’s grounded.
The Sleep for longest possible time for the ESP is:
#define FPM_SLEEP_MAX_TIME 0xFFFFFFF wifi_fpm_do_sleep(FPM_SLEEP_MAX_TIME);
Finally, when the reed switch is closed due to the proximity of the magnet, it wakes up, connect to wifi and when the reed switch is open then it goes back to sleep again. It waits for the next event.
m3 To kWh Conversion Formula
Formula to conversion of gas consumption in cubic meters to kilowatt hours.
1 kWh = 3.6 MJ
1 m3 of natural gas = 39 MJ (GCV) = 10,83 kWh (GCV).
The gas consumption can be calculated with the formula :
m³ x calorific value x number = kWh
Please note that different qualities of natural gas have different energy densities.
The calorific value is between 8,0 und 12,5 kWh/m³.
The average value for 45 m² is 3,500 kWh, 12,600 kWh for 90 m², 20,000 kWh for 115 m².
DWE21 energy factors in Germany from 2022:
- calorific value: 10.943 and price in kWh/€: 0.0665
It uses the Blynk for notifications.
Blynk App is the easiest way to set up phone notification with wifi board.
Monitor the battery level
The ESP8266 has a single analog input with an input range of 0 – 1.0 V maximum.
To monitor the battery voltage, I built a voltage divider from 4.2V to 1.0V.
All I need are two resistors (I use 50K and 15K).
The ADC pin (A0) has a resolution of 10 bits, which means that we get values between 0 and 1023.
Vin = 4.2V Max Input Voltage
R1 = 15k
R2 = 50k
Vout max = 1.0V by 1023bit
Vout = (R2/(R1+R2))*Vin => 0.969V is Okay
Resistors Ration Factor = Max Input Voltage/1023 => 4.2V/1023bit = 0.0041
float calibration = 0.0041; // Resistors Ration Factor
TXD (TX, TXO or UTXD) – transmit pin. Connected to Arduino Uno pin 1.
RXD (RX, RXI or URXD) – receive pin. Connected to Arduino Uno pin 0.
VCC (3V3 or 3.3V)- power supply pin (3-3.6V).
RST (RESET) – reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.
GND – Ground. Connected to Arduino board GND pin
See more website here...
- Gas meter counter with reed switch
- Make a Solar System Energy Monitor with a Sonoff Basic
- Building a Home Energy Monitor with ESP-12E & CT Sensors
- Quiz Game Buzzer with LCD 128×64
- Solar Monitoring System
- Geiger Counter with Arduino and 16×2 LCD
- Clock with LED Strip and NeoPixel Ring
- Philips Uranus 54
- Motion detector with light & mp3 player
- Ceiling Light with direct & indirect light
- Solarpanel selber bauen
- LED Cube 8x8x8
- Rotary phone Pulse to DTMF Converter
- Tonbandkoffer – Simonetta TB-11
- DDS Signal Generator (Device Voltages)
- Raspbian und Kodi
- AD8232 Heart Rate Monitor
- Philetta 234L BD234U/L Radio
- Transistortester GM328
- Ali Esteki (1)
- Blog (22)
- Electronic (12)
- iribTv (4)
- Linux (10)
- Ring Clock Project (4)
- Root (15)
- Tools (6)
- WordPress (6)
- اصفهان (چهارسوق) (2)