Giter Site home page Giter Site logo

iotgod / mqtt-mam Goto Github PK

View Code? Open in Web Editor NEW

This project forked from peterokwara/mqtt-mam

0.0 1.0 0.0 3.97 MB

A demonstration of fetching sensor data from a nodemcu connected to a dht11 humidity and temperature sensor, publishing the data to a raspberrypi acting as a mqtt server, and storing the information on the blockchain (iota tangle)

Home Page: https://peterokwara.hashnode.dev/mqtt-and-mam-sending-temperature-and-humidity-data-to-the-iota-tangle-ck4wbbzap01artjs1t5dfog2t

License: MIT License

Python 63.28% JavaScript 36.72%

mqtt-mam's Introduction

MQTT MAM

This project seeks to demonstrate the use of MQTT protocol and IOTA-MAM to store temperature sensor on the blockchain.

A view of the temperature and humidity data on the iota tangle.

Hardware setup

Nodemcu & Current sensor

Circuit design

Board design

Final look

Installation

Esp

Installing in a NodeMCU involves pushing the python files into the device whether it's via a usb to ttl or just a usb cable. This can be done using the command

sudo ampy --port /dev/ttyUSB0 --baud 115200 put main.py
sudo ampy --port /dev/ttyUSB0 --baud 115200 put config.py
sudo ampy --port /dev/ttyUSB0 --baud 115200 put connectWifi.py

You need to create a config.py file with the following information for each and every esp folder (current-sensor, dht-sensor, motion-sensor, relay-bulb, relay-fan)

MQTT_CONFIG = {
    'SENSOR_ID': '',
    'MQTT_HOST': '',
    'PORT': '',
    'PUB_TOPIC': ''
}

WIFI_CONFIG = {
    'WIFI_ESSID': '',
    'WIFI_PASSWORD': ''
}

Raspberry Pi

To install npm packages used for the Raspberry Pi, you run.

npm install @iota/mam mqtt

You also need to create a config folder and have the file config/config.js with the following configuration

module.exports = {
    brokerUrl: "",
    port: "",
    topic: "",
    provider, ""
};

Usage

Raspberry Pi

To run the code for Raspberry Pi just cd into the folder and run

node app.js

To ensure that the Raspberry Pi runs the code whenever it boots, edit the rc.local file

sudo nano /etc/rc.local

and add

node app.js &

Contributing

To contribute code to this repository please read the CONTRIBUTING guidelines.

License

MIT

mqtt-mam's People

Watchers

James Cloos 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.