Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertisers
    • Advertise
    • PR Submissions
    • Eblast Submissions
  • 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 Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

Log in to leave a comment:

Lost your password?

Don't have an account? Register here

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Wide Bandgap Semiconductors
Moving from silicon to GaN or SiC feels like a whole new ballgame, doesn’t it? It isn’t just about faster switching; it’s about managing the layout parasitics and thermal realities that come with that speed. This month’s Tech Toolbox features a curated eBook that tackles these design hurdles head-on.

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 feed: EDABOARD.com Discussions. EDABOARD.com Discussions.

  • 7555 with no discharge resistor for monostable operation?
  • Flyback converter working incorrectly
  • Improve Equipment Efficiency
  • I have an Acer Aspire 5 A515-54G-53H6 issue with mother board
  • Need Help Setting Up GM/ID Lookup Tables (LUTs) Using ADT for TSMC 180nm in Cadence Virtuoso

RSS feed: Electro-Tech-Online.com Discussions Electro-Tech-Online.com Discussions

  • PIC code for 2.42" I2C OLED Display?
  • Getting Back Into Electronics
  • Best way to check charge and discharge many mixed batteries?
  • Electronics and PIC Programming Assembler Update
  • How to charge 3S1P LFP batteries?

Featured Tutorials

LoRa and LoRaWAN: A Complete Guide to Wireless Communication

  • Best practices for securing LoRa networks
    Best practices for securing LoRa networks
  • Understanding LoRa architecture: nodes, gateways, and servers
    Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
    Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
    How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
    How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices
    How communication works between two LoRa end-node devices
More Tutorials >

Recent Articles

  • Rohde & Schwarz launches handheld combi analyzer
  • Taoglas adds CRPA reference design for GNSS
  • GigaDevice launches GD32H7 MCUs for industrial control
  • Diodes adds automotive high-side switches for 12V loads
  • Building a touchscreen calculator with Arduino and an ILI9486 TFT display

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • 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 © 2026 Arrowfly 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 Arrowfly
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertisers
    • Advertise
    • PR Submissions
    • Eblast Submissions
  • Subscribe