Skip to content

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)

License

Notifications You must be signed in to change notification settings

Horace310/mqtt-mam

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 63.3%
  • JavaScript 36.7%