Introduction: Cloud Health Monitoring (Intel IoT)

This project was showcased at Intel IoT Hackthon 2015, Pune INDIA.

So whats the Idea and reason behind Project :

Project aims to provide medical assistance to rural population with the help of electronic hardware and cloud platform so that doctors can remotely examine the patients and study the reports.Problem:

Still there are many rural areas deprived of primary medical check-ups, services and certified doctors. Many times villagers have to travel urban hospitals in emergency conditions or even for minor medical tests.

So lets go..!

Step 1: What You Need ?

Hardware:

  1. Intel Edison with Arduino type breakout board
  2. Temperature Sensor Anyone will work. I used the Groove sensors.
  3. Heartbeat Sensor Here also I used Groove sensor.But you can use any sensor that gives digital output pulses.
  4. 16x2Display To display the samples of temperature and heartbeat. I have used Groove RGB LCD. Remember that coding of Groove LCD is different that Regular 16x2 LCD's.
  5. Groove Base shield V2Just for expanding the ports of board. You can even go ahead without this.
  6. Power supply for board
  7. 2 Micro B to Type A USB cables

  8. Wires n all

Software:

  1. Drivers and software package of Intel Edison installed on your PC. Download all the software related stuff of Edison on this https://software.intel.com/en-us/iot/hardware/edison/downloads
  2. Terminal Window To communicate with Edison
  3. Notepad For writing Python Script for Edison
  4. MIT App Inventor 2 This is online Android App developer which doesn't require coding skills. Exciting right? We will make a simple app using this. http://ai2.appinventor.mit.edu/
  5. A website Website will be required for observing live analytics and different user interaction. No need to purchase your own domain. Just get a free blog here blogger.com

Other

  1. Android Mobile
  2. Windows based Computer

Step 2: Setting Up Intel Edison

Assemble your board

You can follow brief instructions from Intel website itself from here https://software.intel.com/en-us/articles/assemble-intel-edison-on-the-arduino-board or follow the video here https://software.intel.com/en-us/videos/intel-edison-kit-for-arduino-unboxing-and-assembly.

Connect the board to your system

Plug in the power supply.Note: If you do not have a DC power supply, you can still power the board through a USB port. A green LED should light up on the expansion board. If it doesn't, check your connection. Find the micro switch in between the USB ports on the expansion board. Switch the microswitch down towards the micro-USB ports, if it isn't already.lug in one of the micro-USB cables to the middle USB connector on the expansion board.Plug in the other end of the USB cable to your computer.

Voila! You've setup the hardware.

Step 3: Interfacing Sensors

So we have interfaced two sensors as mentioned earlier.

So interface sensor to Edison. Connect Groove base shield to the main board.You can even connect sensors directly. But its more easy if you go with base shield

1. Temperature Sensor.

Just connect Groove sensor to the base shield

2. Light Sensor

Here light sensor is used to detect the pulses reflected back from our finger. Adjust the pot suitably by trial and error to get exact toggled pulses of heartbeat. You can attach the sensor to finger by rubber band or anything, so it will be stable. Connect this sensor to Edison base shield.

Step 4: Create Thingspeak Channel

So we have to upload the sensor data to the cloud platform. So that it can be monitored remotely. We have choose thingspeak as a data platform for heartbeat and temperature sensor data.

You can also use other platforms like Microsoft, Amazom AWS or Intel itself.

So lets get started with Thingspeak

What is Thingpseak?

ThingSpeak is an application platform for the Internet of Things. ThingSpeak allows you to build an application around data collected by sensors. Features of ThingSpeak include: real-time data collection, data processing, visualizations, apps, and plugins.
At the heart of ThingSpeak is a ThingSpeak Channel. A channel is where you send your data to be stored. Each channel includes 8 fields for any type of data, 3 location fields, and 1 status field. Once you have a ThingSpeak Channel you can publish data to the channel, have ThingSpeak process the data, and then have your application retrieve the data.

Posting on Thingspeak

You put data into a ThingSpeak Channel by using HTTP POST.

Visit http://community.thingspeak.com/tutorials/ to get detailed information about creating channels.

So once you create a channel, you can see graphs of your data.

Step 5: Coding the Edison

We have used Python script instead of using Arduino, because of readily available libraries. Some groove sensors as well as LCD's are not available in Arduino as of now.

This code simply takes input of both sensors manipulates the sampled data and posts it to Thingspeak channel ID.

Python Code:

import pyupm_i2clcd as lcdd
import mraa import time import httplib import math import time import socket import sys temppin=0 heartbeatpin=2

temp=mraa.Aio(temppin) beat=mraa.Gpio(heartbeatpin)

beat.dir(mraa.DIR_IN)

lcd= lcdd.Jhd1313m1(0, 0x3E, 0x62) count=0 beatrate=0 currtime=time.time() key="your_key_here"

def beatme(args): global count global beatrate global currtime count=count+1 if ((time.time()-currtime)>20): beatrate=60*count/(time.time()-currtime) currtime=time.time() count=0 return

beat.isr(mraa.EDGE_RISING,beatme,beatme)

B=3975 def gettemp(): a=temp.read() resistance=(float)(1023-a)*10000/a temperature=1/(math.log(resistance/10000)/B+1/298.15)-273.15 return temperature

def updateme(f1,f2): global key conn = httplib.HTTPConnection("api.thingspeak.com") query="/update?api_key="+key+("&field1=%d&field2=%d" %(f1,f2)) conn.request("GET", query) r1 = conn.getresponse() preresult = r1.read() observation("temp",f2) observation("beat",f1) return preresult

def observation(var,val): UDP_PORT = 41234 # UDP port iotkit-agent is listening: defined in /etc/iotkit-agent/config.json sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.sendto('{"n":"' + str(var) + '","v":"' + str(val) + '"}', ('localhost', UDP_PORT)) return

while 1: lcd.setCursor(0,0) lcd.write("Temperature:%d" %(gettemp())) lcd.setCursor(1,0) lcd.write("Heartbeat:%d" %(beatrate)) updateme(beatrate,gettemp())

Step 6: Creating Interactive Web Platform

HTML of a specific channel can be placed on a website. Here's how HTML of channel looks like

<iframe width="300" height="250" style="border: 1px solid #cccccc;" src="http://thingspeak.com/channels/43135/charts/1?dynamic=true"></iframe>

To show the data, we need a website.

To access the data in specific channel, HTML DOB is created. By using which we can take a input of channel ID from user and then modify the HTML of thingspeak channel by javascript.

You can see our website for reference rmaps.blospot.in

.

Your Name:

Device ID :

Access the data

Step 7: Creating Android App

Creating android app is optional.

Using MIT app inventor 2 you can create android app without coding skills.App inventor exhibits Block programming.You can put the same HTML codes into the app just by creating the WEB view and done

Step 8: Done!

First Time Author Contest

Participated in the
First Time Author Contest

Epilog Contest VII

Participated in the
Epilog Contest VII