Muhammad Afzal
Published © Apache-2.0

Remote Temperature & Humidity Monitoring Using Hologram & Pi

Temperature & humidity monitoring is a very important factor in our daily life especially if we want to monitor remote places.

BeginnerFull instructions provided1 hour5,889
Remote Temperature & Humidity Monitoring Using Hologram & Pi

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Hologram Nova
Hologram Nova
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1

Software apps and online services

Hologram Data Router
Hologram Data Router
Python

Story

Read more

Schematics

dht-hologram

Code

dht-hologram.py

Python
#
# dht-hologram.py - Example of using a supported modem to send messages to the Hologram Cloud.
# 
#
# Author: M. Afzal (maker.pk)
#
#
# LICENSE: Distributed under the terms of the MIT License
#

#!/usr/bin/python
import sys
import Adafruit_DHT
import time
import requests
import json


sys.path.append(".")
sys.path.append("..")
sys.path.append("../..")

from Hologram.HologramCloud import HologramCloud

while True:

    humidity, temperature = Adafruit_DHT.read_retry(11, 11)
    data = {'humidity':humidity,'temperature':temperature}
    json_data = json.dumps(data)
	#send data to Hologram
	if __name__ == "__main__":
		print "Testing Hologram Cloud class..."

		hologram = HologramCloud(dict(), network='cellular')

		print 'Cloud type: ' + str(hologram)

		recv = hologram.sendMessage(json_data,
									topics = ['Temperature'],
									timeout = 3)
		print 'RESPONSE MESSAGE: ' + hologram.getResultString(recv)
		
    print(humidity,temperature)
    print 'Temp: {0:0.1f} C  Humidity: {1:0.1f} %'.format(temperature, humidity)
    time.sleep(10)
	

Credits

Muhammad Afzal

Muhammad Afzal

24 projects • 116 followers
I am Software Eng having 13+ Years of experience. Hackster.io & Cayenne Mydevices Ambassador in Pakistan.

Comments