Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

An IoT-based virtual doctor

By EG Projects

In this tutorial, we’ll learn how to build a device that works as a virtual doctor. The device inputs patient data, which can then be emailed remotely to a registered physician using the simple mail transfer protocol (SMTP) — the internet standard communication protocol for electronic transmissions.

The purpose of this device is to support physicians who are unable to visit patients in person. This could be because of distance, location (such as for those in remote areas), patent immobility (due to illness or access to transportation), and/or costs. A virtual doctor’s visit can also sometimes be more cost-effective, allowing healthcare access to more people.

For this project, we’ll use Raspberry Pi (RPi), Picamera (a portable camera that supports RPi), and an ultrasonic sensor. These devices will be processed using Raspbian OS and Python. Overall, the cost of this project is fairly affordable and can be implemented in rural areas with Internet access.

Components required

Tools & libraries required:

  • Python interpreter
  • Python Libraries: picamera – can be installed by the following commands in the terminal…

      $ sudo apt-get install python-picamera python3-picamera

  1. Putty Terminal for accessing the terminal for input

Technical insights
When the device detects the patient’s presence, it asks for the required information and documents it. Upon completion, this data is then emailed to the registered physician.

This project works on SMTP. The system script runs on Python 2.7.

The device receives input from the camera module, which includes a keyboard. The data is saved using RPi and emailed to the physician using SMTP.

Block diagram

Circuit diagram

To properly take the reading, we’ll use a voltage divider because RPi GPIO is unable to directly support 5V.

Detecting the patient
An ultrasonic sensor is used to detect the presence of a patient. The sensor sends ultrasonic waves for about 20 milliseconds. When those waves are reflected back to the sensor, it detects the distance by calculating the time the wave was sent and then returned.

How the system works

  • The system only works when a person is in front of the device. The ultrasonic distance-measurement sensor (HC SR-04) senses the change in the distance around the device (because of the patient in front of it).
  • The device then asks for the details programmed on the screen. For example, it asks the patient to open their mouth and their eyes, and takes photos using the camera module, saving the images locally.
  • The device also requests the patient’s ID.
  • After all of the data is documented, it emails the registered doctor with the attached images, using the “multipart content type.” This is a type of data that specifies that the email contains media content.
  • This email is sent using the SMTP protocol. The physician downloads the email using the standard, Internet message access protocol (IMAP).
  • The physician examines the information and images and contacts the patient.

Understanding the source code
The code can be understood from its functions. For example, there is a calling of one of the functions in the main one that’s an “intrusion()”. This function then calls two others, the “Capture_image” and the “SendEmail”.

The functions are as follows…

1. Def Intrusion(): This function ensures the HC SR-04 sensor continually sends out an ultrasonic wave and then calculates the distance.

GPIO.output(TRIG, True)
time.sleep(0.00001)
GPIO.output(TRIG, False)

This function also has a range. So, if the distance in front of the sensor is less than that set range, it triggers another function to take a photo: “capture_image(name)”. It also takes an input parameter for the image name.

if(object_stay > 1 and object_present_again == False):
object_present_again = True
name = raw_input(“Ente your visting number:”)       

print “Open Your mouth in front of the camera!”
time.sleep(3)
print “Taking Picture…”
capture_image(name,” Mouth”)

The function also provides instructions on the screen that asks for the name of the patient. Afterward, it triggers the camera to shoot the photo(s).

2. Def capture_image(name_,part): This function inputs the patient’s name and the body part (the eyes or mouth) in the photo.

camera.capture(filepath)

After taking the photo(s), this function calls on another one that emails the physician with the attached images.

download(name_ + part,filepath)
sendEmail(self.jobid, self.jobid, [self.filepath])

3. Class sendEmail(threading.Thread): This function writes the email and identifies whether any media content is attached. It then sends it using the SMTP to the proper physician.

mailServer.sendmail(gmail_user, gmail_user, msg.as_string())

This project is one example of how it’s possible to implement a simple SMTP protocol in applications that can solve important problems, such as access to a family doctor.

https://www.engineersgarage.com/wp-content/uploads/2021/08/Video.mp4

Filed Under: Electronic Projects, More Editor's Picks
Tagged With: doctor, physician, picamera, python, raspberrypi, virtual
 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Designing Gate Driver Circuit and Switching Mechanism for Modified Sine Wave Inverter – (Part 9/17)
  • Completing Modified Sine Wave Inverter Design with Full Bridge Circuit and Step Up Transformer – (Part 10/17)
  • Designing an Offline UPS – Part (12 /17)
  • How to reduce Switching Time of a Relay – (Part 15/17)
  • Testing MOSFET – (Part 16/17)
  • Driving High Side MOSFET using Bootstrap Circuitry – (Part 17/17)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Designing Gate Driver Circuit and Switching Mechanism for Modified Sine Wave Inverter – (Part 9/17)
  • Completing Modified Sine Wave Inverter Design with Full Bridge Circuit and Step Up Transformer – (Part 10/17)
  • Designing an Offline UPS – Part (12 /17)
  • How to reduce Switching Time of a Relay – (Part 15/17)
  • Testing MOSFET – (Part 16/17)

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd ldr led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics Research robot samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Please help to identify the signal input port on board
  • Hotplugging UART
  • RF switch selection
  • sensitivity in filters and number of bits of system
  • MDO4104-6 Front Panel Not Working

RSS Electro-Tech-Online.com Discussions

  • software PWM
  • Combination of Wires of two DC motor giving Output current.
  • Passthrough charging-simple but impossible to achieve?
  • geared motor to revolve oval platform
  • None existant errors (MPLAB X)
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering