GithubHelp home page GithubHelp logo

szuecs / esp32-dh22-metrics Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 32 KB

Get data from dh22 running on esp32 and sends Prometheus metrics via pushgateway

License: GNU General Public License v3.0

C++ 100.00%
iot prometheus pushgateway esp32-arduino dh22

esp32-dh22-metrics's Introduction

esp32-dh22-metrics

Get data from AM2302 (dh22) running on an esp32 and sends Prometheus metrics to a pushgateway using WiFi. Prometheus can scrape metrics from the pushgateway and you can use grafana to show nice dashboards.

Features

You can select different serial output and push data types. Both supports CSV, JSON and Prometheus data. Serial output defaults to CSV and push data defaults to Prometheus.

All data and functions exported by https://github.com/beegee-tokyo/DHTesp library are used to provide the metrics.

Requirements

Hardware:

  • dev board: ESP32
  • sensor: AM2302 (dh22)
  • USB connector to connect your computer with ESP32 (power and flash)
  • 3 cable connectors to connect sensor with ESP32 (power, ground, GPIO data), see also page 2 picture and table top left

Software:

  • pushgateway should be running, for example: docker run -d -hostnetwork -p 9091:9091 prom/pushgateway
  • C++ dev package to have unordered_map, should be available.

You can find a nice tutorial at techtutorialsx.

Install

Install Arduino IDE and start Arduino IDE.

Install dependencies:

  1. Install in the IDE: Board "ESP32 Dev Module" (Tools -> Manage Libraries..)
  2. Install in the IDE: beegee-tokyo DHTesp https://github.com/beegee-tokyo/DHTesp (Tools -> Manage Libraries..)

First steps:

  1. If you have the hardware connected and all dependencies setup, clone this repository
  2. Open File -> Open... dialog to open the cloned repository and select file esp32-dh22-metrics.ino
  3. Change file esp32-dh22-metrics.ino line 10-13 to your own setup
  4. click Tools -> Port and select your USB serial port to configure the connection from your computer to ESP32.
  5. click the Upload button to flash your ESP32 and run the software
  6. Open the Tools -> Serial Monitor to show the serial output of the software running on your ESP32, after a few seconds you should get some data output, if it was successful
  7. Check metrics endpoint of the running pushgateway
% curl -s http://127.0.0.1:9091/metrics | grep dh22
absolute_humidity{instance="dc",job="dh22"} 9
comfort_status{instance="dc",job="dh22",state="Comfort_OK"} 1
dew_point{instance="dc",job="dh22"} 9.9
distance_too_cold{instance="dc",job="dh22"} 1
distance_too_dry{instance="dc",job="dh22"} -1624.1
distance_too_hot{instance="dc",job="dh22"} -7.7
distance_too_humid{instance="dc",job="dh22"} -1079.4
heat_index{instance="dc",job="dh22"} 19.7
humidity{instance="dc",job="dh22"} 51
push_failure_time_seconds{instance="dc",job="dh22"} 0
push_time_seconds{instance="dc",job="dh22"} 1.578165888371657e+09
temperature_celsius{instance="dc",job="dh22"} 20.3
too_cold{instance="dc",job="dh22"} 1
too_dry{instance="dc",job="dh22"} 0
too_hot{instance="dc",job="dh22"} 0
too_humid{instance="dc",job="dh22"} 0

Development

Please create issues and Pull requests as you like.

License

LICENSE

esp32-dh22-metrics's People

Contributors

szuecs avatar

Stargazers

 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.