CJA3D
Published © CC BY

Home Monitoring System For Elderly - Using Hologram

This demo's a home monitoring system for elderly in your family who don't have internet at home, using hologram.io cellular connection.

EasyWork in progress5 hours1,180
Home Monitoring System For Elderly - Using Hologram

Things used in this project

Story

Read more

Schematics

Circuit using the Grove Pi

Here are the sensor connection to the Grove Pi
-Air Quality sensor connected to A0
-DHT22 connected to D4
-Touch sensor connected to D2
Circuit ko9jbew5bb

Code

sendSensorData.py

Python
#Created to demo the Home Monitoring system for the elderly - using Hologram Nova
#This code is based on -
# Hologram sample code -https://hologram.io/docs/reference/cloud/python-sdk/
# and sample code for the Grove sensors - https://github.com/DexterInd/GrovePi/tree/master/Software/Python
import grovepi
import time
import math
import sys
from Hologram.HologramCloud import HologramCloud

#Update your Holgram device key
credentials = {'devicekey': 'XXXXXXXXXXXXXXXX'}
hologram = HologramCloud(credentials, network='cellular')
# Connect the Grove Temperature & Humidity Sensor Pro to digital port D4
sensorDHT22 = 4
# Connect the Grove Air Quality Sensor to analog port A0
air_sensor = 0
grovepi.pinMode(air_sensor,"INPUT")
# Connect the Grove Touch Sensor to digital port D2
touch_sensor = 2

grovepi.pinMode(touch_sensor,"INPUT")
# temp_humidity_sensor_type
# Grove Base Kit comes with the blue sensor.
blue = 0    # The Blue colored sensor.
white = 1   # The White colored sensor.

def send_messages(messages):
    if len(messages) < 1:
        return
    result = hologram.network.connect()
    if result == False:
        print ' Failed to connect to cell network'
    for message in messages:
        response_code = hologram.sendMessage(message)
        print('{} : {}'.format(hologram.getResultString(response_code), message))
    hologram.network.disconnect()

while True:
    try:
        print(grovepi.digitalRead(touch_sensor))
        time.sleep(1)
        if grovepi.digitalRead(touch_sensor) == 1:
           print("touch sensor hit..")
        # This example uses the blue colored sensor.
        # The first parameter is the port, the second parameter is the type of sensor.
           [temp,humidity] = grovepi.dht(sensorDHT22,white)
           if math.isnan(temp) == False and math.isnan(humidity) == False:
               print("temp = %.02f C humidity =%.02f%%"%(temp, humidity))
        # Get sensor value
           sensor_value = grovepi.analogRead(air_sensor)
           if sensor_value > 700:
               print ("High pollution")
           elif sensor_value > 300:
               print ("Low pollution")
           else:
               print ("Air fresh")
           print("sensor_value =", sensor_value)
           #msgSend = ' {} {} {}'.format(str(temp), str(humidity), str(sensor_value))
           #send_messages(msgSend);
       result = hologram.network.connect()
	   if result == False:
		print ' Failed to connect to cell network'
	   else:
		response_code = hologram.sendMessage(str(temp),topics=['SensorVal'])
		print("Message sent to Hologram..")
	   hologram.network.disconnect()
	   time.sleep(.5)

    except IOError:
        print ("Error")

Credits

CJA3D

CJA3D

6 projects • 57 followers
Tinkerer and 3D Printing enthusiast.
Contact

Comments