Git Product home page Git Product logo

dhtpubmqttdaemon's Introduction

DHTpubMqttDaemon for Raspberry PI

A daemon written in C for reading data of an DHT22 sensor connected to an Raspberry PI. The read data will be published to an MQTT server with a given topic.

Getting Started

These instructions will get you a copy of the project up and running on your local machine.

Hardware prerequisites

You need a Raspberry PI board and a DHT22 sensor connected to Pin 7 (GPIO4) of the Raspberry to use this daemon.

Wiring

Software prerequisites

The daemon uses 3 non standard libraries which must be installed first:

libconfig-dev - This library allows parsing, manipulating and writing structured configuration files.

apt-get install libconfig-dev

libmosquitto-dev - Library for implementing MQTT version 3.1/3.1.1 clients.

apt-get install libmosquitto-dev

wiringpi - Wiring Pi GPIO Interface library for the Raspberry Pi

apt-get install wiringpi 

MQTT server - MQTT server running and reachable form the Raspberry.

Installing

  1. Build the executable file by running "make"
cd ~/dhtpubmqttd
make
  1. Edit the config file dhtpubmqttd.conf according to your needs
nano dhtpubmqttd.conf
  1. Copy the binary dhtpubmqttd and the config file dhtpubmqttd.conf to /opt/dhtpubmqttd/
sudo mkdir /opt/dhtpubmqttd
sudo cp dhtpubmqttd /opt/dhtpubmqttd
sudo cp dhtpubmqttd.conf /opt/dhtpubmqttd
  1. Copy the service configuration file dhtpubmqttd.service to /lib/systemd/system/
sudo cp dhtpubmqttd.service /lib/systemd/system/
  1. Enable DHTpubMqttDaemon service
sudo systemctl enable dhtpubmqttdaemon.service
  1. Start DHTpubMqttDaemon.service
sudo systemctl start dhtpubmqttd.service
  1. check syslog for errors
sudo tail -f /var/log/syslog
  1. Start an MQTT client and subscripe the topic configured in the config file. You should get a string in JSON format with the read data.
{"Humidity":"42.00","Temperature":"20.10"}

License

This project is licensed under the GNU General Public License - see the LICENSE file for details

dhtpubmqttdaemon's People

Contributors

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