Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey 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
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

An IoT-based virtual doctor

By EG Projects August 5, 2021

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

You may also like:


  • What are the top 4G modems available in India?

  • What are LoRa gateways and what types are available?

  • How does LoRa modulation enable long-range communication?

  • What is the role of embedded software in electric vehicles?

  • What are the top tools for developing embedded software?
  • battery selection low power design
    What are the battery-selection criteria for low-power design?

Filed Under: Electronic Projects, PIC Microcontroller
Tagged With: doctor, physician, picamera, python, raspberrypi, virtual
 

Next Article

← Previous Article
Next Article →

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



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

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!


RSS EDABOARD.com Discussions

  • Exporting sensor readings as data...
  • Inconsistent Charge Termination Voltage with battery charger
  • 21V keeps getting shorted to my UART line.
  • Voltage mode pushpull is a nonsense SMPS?
  • Voltage mode push pull with extra DC blocking capacitor

RSS Electro-Tech-Online.com Discussions

  • Is AI making embedded software developers more productive?
  • Why can't I breadboard this oscillator?
  • using a RTC in SF basic
  • Parts required for a personal project
  • Cataract Lens Options?

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • GigaDevice launches GD32C231 MCU series with 48MHz Cortex-M23 core and 64KB Flash
  • Advanced Energy releases 425 W CF-rated medical power supply in 3.5 x 6 x 1.5-inch format”
  • LEM combines shunt and Hall effect sensing in 2000 A current measurement unit
  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 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

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey 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
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe