Project showcase

Smart Health Kit © CERN-OHL

Creating E-health care system that allows easier, better, and faster communications between patients, doctors, and hospitals.

  • 749 views
  • 1 comment
  • 6 respects

Components and supplies

Pi 3 02
Raspberry Pi 3 Model B
The Processing Unit in The Major Kit
×1
A000066 iso both
Arduino UNO & Genuino UNO
To control the pulse sensor
×1
Pulse Sensor
Heart rate pulse sensor
×1
DS18B20
Temperature sensor
×1
Nodemcu
NodeMCU ESP8266 Breakout Board
The Processing and Wi-Fi Module in the Minor Kit
×1
GPS u-blox 6
GPS Module in Ambulance Minor Kit
×1
Nokia 5110 lCD 84x84
Graphic LCD for The Major Kit
×1
398 09
Adafruit RGB Backlight LCD - 16x2
Alphanumeric LCD for the Minor Kit
×1

Apps and online services

About this project

Introduction

There are many patients all over the world that suffer from common dangerous diseases or illnesses that affect their health and life, so they need to continuously keep up with their health status, or immediate relief in some emergency cases, to avoid serious complications of the disease on patient’s health.

There are many problems that face patients from getting proper medical care:

  • Late discovery of emergency cases
  • Late arrival of the ambulance
  • Lack of immediate treating of critical cases.
  • Lack of continuous health monitoring of the patients
  • Lack of tools to provide the latest health status to doctor and hospitals

What it Does

This system will make it easier for the patient to follow up his health status on a regular basis, help him contact the nearest hospital or emergency center in critical situations, and connect with the doctor.

The proposed system can also do a report on a continuous basis for the patient to be able to follow his condition first hand. Also, the doctor can find out the patient’s health status and to what extent it reached.

Schematics

Pulse Sensor Connection
Heart Pulse sensor is a heart-rate sensor for Arduino. We connect the sensor with Arduino and start to measure the number of beats per minute. When the heart beat status change from stable to critical, the Raspberry-pi sends a relevant message to the web services to deliver an Ambulance.
Pulse 1weyixutkv
Temperature sensor
Temp lmgqlos6pj
Nokia 5110 Graphic LCD 84x84
Pic3 tyiub5zymx
Alphanumeric LCD with NodeMcu by I2C Protocol
I2c 6a7vgy5ajh
GPS with NodeMcu
Gps 1dmu9iguq1

Code

integration.pyPython
The Code in Raspberry Pi to control the major kit
import os
import glob
import serial
import time

import Adafruit_Nokia_LCD as LCD
import Adafruit_GPIO.SPI as SPI

from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont

import paho.mqtt.client as mqtt

import urllib2  
import urllib  

import RPi.GPIO as GPIO

import re
# Raspberry Pi hardware SPI config:
DC = 23
RST = 24
SPI_PORT = 0
SPI_DEVICE = 0
# Hardware SPI usage:
disp = LCD.PCD8544(DC, RST, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=4000000))
# serial communication between raspberry pi and arduino 
ser = serial.Serial('/dev/ttyACM0', 115200)
#Temprature Sensor
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'

# Initialize library.
disp.begin(contrast=60)
# Clear display.
disp.clear()
disp.display()
def read_temp_raw():
	f = open(device_file, 'r')
	lines = f.readlines()
	f.close()
	return lines
def read_temp():
	lines = read_temp_raw()
	while lines[0].strip()[-3:] != 'YES':
		time.sleep(0.2)
		lines = read_temp_raw()
	equals_pos = lines[1].find('t=')
	if equals_pos != -1:
		temp_string = lines[1][equals_pos+2:]
		temp_c = float(temp_string) / 1000.0
	#temp_f = temp_c * 9.0 / 5.0 + 32.0
	return temp_c
def draw_heart():
        draw.polygon([(2,22), (10,42), (25,22)], outline=0, fill=0)
        draw.ellipse((2,10,12,32), outline=0, fill=0)
        draw.ellipse((10,10,25,32), outline=0, fill=0)
def draw_temp():
        draw.rectangle((40,10,50,32), outline=0, fill=255)
        draw.ellipse((35,22,55,42), outline=0, fill=255)
        draw.rectangle((42,15,48,33), outline=0, fill=0)
        draw.ellipse((40,27,50,37), outline=0, fill=0)
GPIO.setmode(GPIO.BCM)
GPIO.setup(17,GPIO.OUT)
GPIO.output(17,0)

while True: 
    # Create blank image for drawing.
    # Make sure to create image with mode '1' for 1-bit color.
    image = Image.new('1', (LCD.LCDWIDTH, LCD.LCDHEIGHT))
    # Get drawing object to draw on image.
    draw = ImageDraw.Draw(image)
    # Draw a white filled box to clear the image.
    draw.rectangle((0,0,LCD.LCDWIDTH,LCD.LCDHEIGHT), outline=255, fill=255)
    # Load default font.
    font = ImageFont.load_default()
    # read Heart pulse from pulse sensor
    Heart_pulse = ser.readline()
    #data_left = ser.inWaiting() # return data in buffer
    #Heart_pulse += ser.read(data_left)
    print(Heart_pulse)
    #read Temprature sensor
    Temp_record = read_temp()
    print(read_temp())
    # Write some text.
    draw.text((26,10), '{0}'.format(Heart_pulse[:2]), font=font)
    draw.text((52,10), '{0}'.format('%0.1f'%Temp_record), font=font)
    draw.ellipse((72,5,76,9), outline=0, fill=255)
    draw_heart()
    draw_temp()
    #node.connect("test.mosquitto.org",1883)
    # publish the sensor records
    try:
            node=mqtt.Client("python_pub") 
            node.connect("broker.hivemq.com",1883)
            node.publish("SHK/Temp","T = {0}".format('%0.1f'%Temp_record))
            node.publish("SHK/Pulse","BPM =  {0}".format(Heart_pulse[:2]))
    except:
            pass
    
    temp_URL= 'http://redhawk-001-site1.btempurl.com/RegistrationForm2.svc/gettemp?temperature_sensor={"Temprature_records":"%d"}'%Temp_record
    #print temp_URL
    req_temp = urllib2.Request(temp_URL)
    response = urllib2.urlopen(req_temp).read()
    print 'response={0}'.format(response)
    try:
            pulse_URL='http://redhawk-001-site1.btempurl.com/RegistrationForm2.svc/getpulse?Pulse_sensor={{"BPM":"{0}"}}'.format(Heart_pulse[:2])
            #print pulse_URL
            req_pulse = urllib2.Request(pulse_URL)
            response2 = urllib2.urlopen(req_pulse).read()
            print 'response2={0}'.format(response2)
    except:
            pass
    
    # Display image.
    disp.image(image)
    disp.display()
    time.sleep(1.0)
    #print(ser.readline())
    #Heart_pulse=ser.readline()[:2]
    #print(Heart_pulse)
    alarm_URL = 'http://redhawk-001-site1.btempurl.com/RegistrationForm2.svc/alarm?Major_Kit={"Major_Id":"1"}'
    req_alarm = urllib2.Request(alarm_URL)
    response_alarm = urllib2.urlopen(req_alarm).read()
    print 'alarm_response={0}'.format(response_alarm)
    if(response_alarm == 1): #patient in emargency case
            print "Alarm"
            GPIO.output(17,1)
    #Heart_pulse=[]trast=60)
# Clear display.
disp.clear()
disp.display()
def read_temp_raw():
	f = open(device_file, 'r')
	lines = f.readlines()
	f.close()
	return lines
def read_temp():
	lines = read_temp_raw()
	while lines[0].strip()[-3:] != 'YES':
		time.sleep(0.2)
		lines = read_temp_raw()
	equals_pos = lines[1].find('t=')
	if equals_pos != -1:
		temp_string = lines[1][equals_pos+2:]
		temp_c = float(temp_string) / 1000.0
	#temp_f = temp_c * 9.0 / 5.0 + 32.0
	return temp_c
def draw_heart():
        draw.polygon([(2,22), (10,42), (25,22)], outline=0, fill=0)
        draw.ellipse((2,10,12,32), outline=0, fill=0)
        draw.ellipse((10,10,25,32), outline=0, fill=0)
def draw_temp():
        draw.rectangle((40,10,50,32), outline=0, fill=255)
        draw.ellipse((35,22,55,42), outline=0, fill=255)
        draw.rectangle((42,15,48,33), outline=0, fill=0)
        draw.ellipse((40,27,50,37), outline=0, fill=0)
while True: 
    # Create blank image for drawing.
    # Make sure to create image with mode '1' for 1-bit color.
    image = Image.new('1', (LCD.LCDWIDTH, LCD.LCDHEIGHT))
    # Get drawing object to draw on image.
    draw = ImageDraw.Draw(image)
    # Draw a white filled box to clear the image.
    draw.rectangle((0,0,LCD.LCDWIDTH,LCD.LCDHEIGHT), outline=255, fill=255)
    # Load default font.
    font = ImageFont.load_default()
    # read Heart pulse from pulse sensor
    Heart_pulse = ser.readline()[:2]
    data_left = ser.inWaiting() # return data in buffer
    Heart_pulse += ser.read(data_left)
    print(Heart_pulse)
    #read Temprature sensor
    Temp_record = read_temp()
    print(read_temp())
    # Write some text.
    draw.text((26,10), '{0}'.format(Heart_pulse[:2]), font=font)
    draw.text((52,10), '{0}'.format('%0.2f'%Temp_record), font=font)
    draw.ellipse((72,5,76,9), outline=0, fill=255)
    draw_heart()
    draw_temp()
    
    # publish the sensor records
    node=mqtt.Client("python_pub")
    node.connect("test.mosquitto.org",1883)
    node.publish("SHK/Temp","T = {0}".format(Temp_record))
    node.publish("SHK/Pulse","BPM =  {0}".format(Heart_pulse[:2]))
    Heart_pulse=[]

    # Display image.
    disp.image(image)
    disp.display()
    time.sleep(1.0)
    #print(ser.readline())
    #Heart_pulse=ser.readline()[:2]
    #print(Heart_pulse)
    
    

Comments

Similar projects you might like

Arduino Obstacle Avoidance Robot with Ultrasonic HC-SR04

Project tutorial by Jorge Rancé

  • 345 views
  • 1 comment
  • 3 respects

Using Finite State Machines

by Gustavo Gonnet

  • 5,818 views
  • 2 comments
  • 16 respects

Alexa: "Your Clothes Are Dry"

Project in progress by TNunnster

  • 1,387 views
  • 0 comments
  • 5 respects

Temperature Streaming with Arduino + Big Data Tools

Project showcase by Gabriel Rodriguez

  • 1,336 views
  • 1 comment
  • 14 respects

How to Configure NeoPixels Using Vixen Lights and Arduino

Project tutorial by Victor Aguilar

  • 137 views
  • 0 comments
  • 3 respects

Bluetooth Speaker w/ Music-Reactive LED Matrix

Project tutorial by Modustrial Maker

  • 2,811 views
  • 0 comments
  • 10 respects
Add projectSign up / Login