Giter VIP home page Giter VIP logo

arduino-dht-logger's Introduction

arduino-dht-logger

Log DHT Temperature sensor data over serial using an Arduino

Support and dependencies.

So far, this has only been tested with DHT22 temperature sensors.

See the .gitmodules file for the Arduino library dependencies.

JSON

This logs temperature, humidity, and heat index over JSON. Each sensor is enumerated in the json according to the pin number that it is connected to. The JSON data for each pin is represented as t for temperature, h for humidity, and hi for heat index, or e for error. All values are in Celcius.

Library

The following code imports the DHT logger library and creates a logger object that uses pins 2 and 4 as sensors and enables power over pin 8. It then logs the temperature data over the Serial interface.

#include "dht_logger.h"

// Pin arrays must have 0 as the last element or else this will panic. Future
// revisions of this library will make that no longer necessary.
constexpr uint8_t kPowerPins[] = {8, 0};
constexpr uint8_t kSensorPins[] = {2, 4, 0};

// Create a logger object that logs DHT22 pins over Serial
dht::DhtLogger logger(kSensorPins, DHT22, &Serial, kPowerPins);

void setup() {
  // Note that Serial.begin() is not done from within logger.begin(). The
  // serial interface must be explicitly initialized somewhere before the
  // logger can begin.
  Serial.begin(115200);
  logger.begin();
}

void loop() {
  // This reads measurements and writes them over serial in JSON format.
  delay(logger.writeToSerial());
}

Standalone

To use the standalone method on Ubuntu, install the arduino-mk package. The standalone method is currently only supported on Ubuntu 20.04 and Raspbian Buster, but may work on other OS configurations.

The standalone method generates an Arduino firmware binary based on a config file. The config file is in JSON format. See example_config.json for an example of a valid config file with every option used. The serial and power_pins keys in the config are optional. All other keys listed in example_config.json are required.

Configuration binaries can be built and flashed to Arduino devices as follows:

python3 build.py -c example_config.json -p /dev/ttyUSB0

arduino-dht-logger's People

Contributors

domagalski 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.