Code Monkey home page Code Monkey logo

esplogger2's Introduction

Esplogger2

Rewrite of https://github.com/Aeprox/ESPLogger, using arduino frameworkfor esp8266 (with platformio). Still using the DHT22 and TSL2561 sensors to measure temperature, humidity and light intensity and periodically send this data to a server.

Changes in rewrite:

  • Use MQTT to upload to Thingspeak instead of HTTP
  • Save sensor values to RTC memory and send average once every X measurements. Reduces power consumption.
  • Use MQTT to upload to local private server, and fetch admin/config information from the MQTT server.

Configuration and building/uploading

Configuring is done in config.h

#define SSID "Your ssid"
#define PASSWORD "Your network password"

Enter your network name and password.

// defines for thingspeak MQTT connection
#define MQTTSERVER "mqtt.thingspeak.com"
#define CHANNELID "your channel ID"
#define APIKEY  "your api key"

This is where you enter your channel ID and API write key, which you find in your Thingspeak channel settings.

// defines MQTT admin connection
#define MQTTADMINSERVER "192.168.1.252"
#define MQTTADMINSERVERPORT 1883
#define MQTTADMINTOPIC "templogger/admin"

Private server to send data to. Data is published to templogger/output topic.

Also subscribes to the configured topic. The module will look for messages published in this topic (and subtopics) with topic templogger/admin/num and templogger/admin/intand parse their values to update the measurement interval, see below.

//update & measurement inverval (in seconds)
#define DEFAULTMEASUREMENTINTERVAL 60
//# of measurementintervals before update
#define DEFAULTNUMMEASUREMENTS 5

The important bit. The module will take measurements every DEFAULTMEASUREMENTINTERVAL seconds, and upload the average after DEFAULTNUMMEASUREMENTS measurements. This means the module will update to the remote server once every (DEFAULTMEASUREMENTINTERVAL * DEFAULTNUMMEASUREMENTS) seconds.

Building is quite simple when you're using platformio to build this project, as it will automatically fetch the needed libraries from GitHub. Never tested it using any other IDE, but you'll need to manualy add these libraries:

esplogger2's People

Contributors

aeprox avatar

Watchers

 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.