GithubHelp home page GithubHelp logo

tstoegi / mymeter Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 561 KB

Arduino energy and gas meter monitoring with a Wemos D1 Mini over mqtt

License: MIT License

C++ 92.66% C 7.34%
arduino battery firmware gas-sensor mqtt wemos wemos-d1-mini microwakeupper energy-monitor homeassistant

mymeter's Introduction

Arduino energy and gas meter monitoring with a Wemos D1 Mini over mqtt

::: energy meter ::: This is how your basic setup should look like if you use a IR Sensor breakout board to count each cycle.

RED - VIN - SWITCH_OUT (3V3)
BLACK - GND
ORANGE - SIGNAL - SWITCH_IN

Alt IR Sensor Setup

::: gas meter :::

  • Setup A (recommended for battery): Reed switch connected to SWITCH OUT/IN on a MicroWakeupper battery shield (stacked to a Wemos D1 mini)

  • Setup B (external power/USB): Inductive proximity sensor LJ12A3-4-Z/BX 5V connected with signal line to SWITCH IN (common GND) on a MicroWakeupper battery shield (stacked to a Wemos D1 mini). The sensor usually consumes about 50mA (always on).


There are different gas meters in the wild - usually one with a) an internal magnet that is turning around on each cycle - so we can use a reed switch for counting or b) an internal metal plate is turning around on each cycle - so we can use a proximity sensor LJ12A3-4-Z/BX 5V

Usually one turn around is euqal to 0,01m3 (or 10 liters) of gas - check your gas meter.

The stacked MicroWakeupper shield is turning your Wemos D1 mini on and off. Recommended: onboard jumper J1 cutted!

tldr; The firmware will count each cycle, write the total amount to eeprom and sent a mqtt message to your broker with the total amount of gas (total).

Setup/Installation

  1. Install the MicroWakeupper library (https://github.com/tstoegi/MicroWakeupper) to your Arduino IDE

  2. Update the sketch file "config.h" with your custom setup

  3. Connect a Wemos D1 mini (or pro, with external antenna) via USB and upload the code (if the MicroWakeupper shield if already stacked, you have to press the onboard FLASH button during upload)

    -> OTA: If the firmware is already installed, you can use OTA updates by setting (with retain) a mqtt msg/value "/settings/waitForOTA" to "true" once. OTA will be available for one minute.

Warning: As long as you power the Wemos via USB (or external VIN) the MicroWakeupper shield cannot turn it off.

All mqtt messages from the client (Wemos) are sent with flag "retain" - so you see the last messages, even if the device is off.

faq

Q: Where can I buy the MicroWakeupper battery shield?
A: My store: https://www.tindie.com/stores/moreiolabs/

Q: How can I set an initial counter value?
A: Just send/publish a mqtt message (with retain!) to "haus/gasmeter/settings/total" e.g. "202.23" - after receiving that message is removed and you should see the new value.

Q: How can I install OTA update (via Arduino IDE)?
A: Send/publish a mqtt message (with retain!) to "haus/gasmeter/settings/waitForOTA" with "true" - after receiving that message is removed and you will see the OTA device named "[device_name]_[ip_address]".

Q: How can I adjust (calibrate) the battery voltage value?
A: Send/publish a mqtt message (with retain!) to "haus/gasmeter/settings/voltageCalibration" e.g. "+0.3" or "-0.5" volt - the message has to stay there!

(c) 2022, 2023 @tstoegi, Tobias Stöger, MIT license

mymeter's People

Contributors

tstoegi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.