icon

BP Classification & Announcing Results Over Voice Using Pi3

0 39503 Hard
projectImage

Hey, what's up, Guys! Akarsh here from CETech.
 

This project that we have made this time is capable of Classification Of Blood Pressure, Spo2, Body Temperature Monitoring, and announcing sensor Results Over The Voice Using Raspberry Pi. In this Upgrade Project, I Have provided the following parameters

1. SpO2 Monitoring

2. IR Temperature Sensor

3. LCD Display

4. Voice Broadcasting

5. Data Saving For Future ML Training

 

I added the basic details of different Classifications of blood pressure for adults (18 years and older). I will utilize the same chart to create this Project.

 

Supplies

 

Hardware components

 

Raspberry Pi 3 Model B

Maxim Integrated MAX30102 High-Sensitivity Pulse Oximeter and Heart-Rate Sensor for Wearable Health

SparkFun MLX90614

Texas Instruments LM386

Speaker: 3W, 4 ohms

Adafruit RGB Backlight LCD - 16x2

Linear Regulator (7805)

Bridge Rectifier Diode, Single Phase

BP Sensor

TaydaElectronics DC POWER JACK 2.1MM BARREL-TYPE PCB MOUNT

 

Software apps and online services

 Raspberry Pi Raspbian

 

Hand tools and fabrication machines

 Soldering iron (generic)Solder Wire, Lead-FreeDrill / Driver, CordlessMultitool, Screwdriver

 

Get PCBs for Your Projects Manufactured

projectImage

You must check out PCBWAY for ordering PCBs online for cheap!

You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop.

 

Block Diagram Of the Project

projectImage

I will Explain How To Interface The Sensor With the Raspberry and How to Process to Display the Output. By following this blog You can find what are the libraries and Software settings need to configure for the project.

By using This project you can measure Blood Pressure, Non-Contact IR Temperature Measurement, and SpO2. All these results are displayed on LCD and the Results are Broadcast through Voice. Based on the Accent you required you can change your Voice Broadcast Accent.

 

Blood Pressure sensor Interfacing With Raspberry Pi

I have used Python 3 for writing code for this project. I have used Python Idle3 to write and Run The code. By default, Raspberry Pi Will have Thonny IDE. If you want to use the same IDE as mine you need to download it by typing the following command in the Raspberry Pi terminal.

sudo apt-get install idle3

The BP Sensor Exchanges the Data Over the UART Terminal in Half Duplex Mode. This sensor Communicates the Raspberry Pi by 9600 Baud Rate. To receive the data In the Raspberry Pi We need to Configure UART Channel in the Raspberry Pi.

 

Raspberry Pi UART

Raspberry Pi has two in-built UART which are as follows:

PL011 UARTmini UART

PL011 UART is an ARM-based UART. This UART has better throughput than mini UART. In Raspberry Pi 3, mini UART is used for Linux console output whereas PL011 is connected to the Onboard Bluetooth module. And in the other versions of Raspberry Pi, PL011 is used for Linux console output.

Mini UART uses the frequency which is linked to the core frequency of the GPU. So as the GPU core frequency changes, the frequency of UART will also change which in turn will change the baud rate for UART. This makes the mini UART unstable which may lead to data loss or corruption. To make mini UART stable, fix the core frequency. mini UART doesn’t have parity support.

The PL011 is a stable and high-performance UART. For better and more effective communication use PL011 UART instead of mini UART.

It is recommended to enable the UART of Raspberry Pi for serial communication. Otherwise, we cannot communicate serially as UART ports are used for Linux console output and Bluetooth module.

 

Raspberry Pi 3 UART Pins

projectImage

Configure UART on Raspberry Pi

In Raspberry Pi, enter the following command in the Terminal window to enable UART,

CODE
sudo raspi-config

Select -> Interfacing Options

projectImage

After selecting the Interfacing option, select the Serial option to enable UART

projectImage

Then it will ask for the login shell to be accessible over Serial, select No shown as follows.

projectImage

In the end, it will ask for enabling the Hardware Serial port, select Yes,

projectImage

Finally, our UART is enabled for Serial Communication on the RX and TX pins of Raspberry Pi

projectImage

Then, reboot the Raspberry Pi.

 

Serial Port for UART Communication

By default, mini UART is mapped to UART pins (TX and RX) while PL011 is connected to the onboard Bluetooth module on Raspberry Pi 3.

In the previous versions of Raspberry Pi models, PL011 is used for Linux Console output (mapped to UART pins) and no onboard Bluetooth module exists.

After making the above configuration, UART can be used at UART pins (GPIO14 and GPIO15).

To access mini UART in Raspberry Pi 3, the ttyS0 port is assigned. And to access PL011 in Raspberry Pi 3 ttyAMA0 port is assigned. But in other models of Raspberry Pi, there is only the ttyAMA0 port is accessible.

Hardware UART port i.e. GPIO14(TXD) and GPIO15 (RXD) is also known as serial0 while other UART port connected to the Bluetooth module is known as serial1. These names are created as serial aliases for Raspberry Pi version portability.

We can check which UART i.e. mini UART (ttyS0) or PL011 UART (ttyAMA0) is mapped to UART pins (GPIO14 and GPIO15). To check UART mapping, enter the following commands.

CODE
ls -l /dev

The UART mapping for /dev/ttyS0 and /dev/ttyAMA0 is shown below,

projectImage

After Enabling the UART we need to activate The Audio output channel. Then we have to Install gTTS (Google Text-to-Speech) to announce the BP Status in voice-over.

 

gTTS (Google Text-to-Speech )

gTTS (Google Text-to-Speech), a Python library and CLI tool to interface with Google Translate's text-to-speech API. Write spoken mp3 data to a file, a file-like object (byte string) for further audio manipulation, or stdout. Or simply pre-generate Google Translate TTS request URLs to feed to an external program.

Run The Below command in the Raspberry Pi terminal To download the gTTS.

CODE
pip install gTTS

To Know More About the gTTS Follow the Link https://gtts.readthedocs.io/en/latest/

after the successful installation of gTTS, we need to add a Manipulate audio with a simple and easy high-level interface, To Manipulate audio In this project, I am using pydub.

Run The Below command in the Raspberry Pi terminal To download the pydub.

CODE
pip install pydub

To Know More About the pydub Follow the Link https://pydub.com/

Once all the Mentioned Configurations are made we can Run the BP Sensor Interfacing Code.

The Output Of the BP Sensor Is saved in the Text Format In Below Figure. You can see the Results Image.

projectImage

IR Temperature (MLX90614)Sensor Interfacing With Raspberry Pi

 

To interface the IR temperature sensor we need to enable The I2C and we need to install a few modules.

Enter The command in the Raspberry pi Terminal

CODE
sudo apt-get install -y python-smbus 
sudo apt-get install -y i2c-tools

Install i2c support for the ARM core and Linux kernel. To enable I2C support, We need to enter the configuration Mode of raspberry By Running The Below command in the Raspberry Pi terminal

CODE
sudo raspi-config
projectImage

Select Interfacing Configurations

projectImage
In the Interfacing option, Select-> I2C
projectImage
projectImage

Select Yes when it asks to Reboot.

Now, after booting Raspberry Pi, we can check the user-mode I2C port by entering the following command.

CODE
ls /dev/*i2c*

then Pi will respond with the name of the i2c port.

projectImage

Test I2C device on Raspberry Pi

Once the configuration is done correctly Connect The MLX90614 IR Temperature sensor to the Raspberry Pi I2C Pins along with the power pins.

Now when you log in you can type the following command to see all the connected devices

CODE
sudo i2cdetect -y 1
projectImage

Once all the Mentioned Configurations are made we can Run the IR Temperature Sensor Interfacing With Raspberry Pi Code.

The Output Of the Temperature Sensor Is saved in the Text Format In Below Figure. You can see the Results Image.

 

SpO2 Sensor Interfacing With Raspberry Pi

To interface the SpO2 With the raspberry pi we use I2C Communication, Since We already Installed All the Required Configuration For I2C, LCD There is no need to enable Them Again. You Just Need To add the Library Called max30102, This Library is modified for the Raspberry Pi based on My requirements. you just need To add those files to the Folder.

The main code is in SpO2 Sensor Interfacing With Raspberry Pi file You need to run this to view the result on the LCD. Before running the code You need to save the hrcalc.py and hrdump.py and max30102.py codes to the folder location as same as the SpO2 Sensor Interfacing With Raspberry Pi code location folder.

In this project, all the above codes run individually you can modify the code to run through a single code.

License
All Rights
Reserved
licensBg
0