Final Project¶
For the whole report you can visit my partner site Mahdi
My part¶
Starting by using deferent types of microcontroller such as MKR1010 and connecting Max 30100 sensor to it to under stand how it works, from the max30100 library had the code ready to measure the heart rate and the SPO2 but needed some adjustments to work for a beginning with mohammed Bux .
Testing¶
The code:¶
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#define BLYNK_PRINT Serial
char auth[] = "G9nCH4W7AWUwviplzwpGLleH0fOdXF9_";
char ssid[] = "justdoelectronics";
char pass[] = "123456789";
PulseOximeter pox;
uint8_t DHTPin = 18;
float bodytemperature;
float BPM, SpO2;
uint32_t tsLastReport = 0;
void onBeatDetected() {
Serial.println("Beat Detected!");
}
void setup() {
Serial.begin(9600);
pinMode(19, OUTPUT);
pinMode(DHTPin, INPUT);
Serial.print("Initializing Pulse Oximeter..");
if (!pox.begin()) {
Serial.println("FAILED");
for (;;)
;
} else {
Serial.println("SUCCESS");
pox.setOnBeatDetectedCallback(onBeatDetected);
}
pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
}
void loop() {
pox.update();
BPM = pox.getHeartRate();
SpO2 = pox.getSpO2();
Serial.print("Heart rate:");
Serial.print(BPM);
Serial.print(" bpm / SpO2:");
Serial.print(SpO2);
Serial.println(" %");
tsLastReport = millis();
}
Of course we did not use the MKR1010 for the project but it was just the beginning because we used esp32 s3 lcd touch 1.28 which is a micro controller ready made clock shaped that can be coded using micropython, we used thonny for coding.
The result:¶
dimensional Designing¶
I must give credit to my partner Ahmed Mahdi that you can refer to his site for more details about the frame shape and design, he invested to much time to get the perfect measurements after so many attempts, and with my help we designed the perfect frame for the watch.
times we failed:¶
some which had human error and some which there was a printing errors but finally we managed to get the perfect shape:
Our success¶
You can find the design in Ahmed Mahdi site
Watch strap¶
The idea of watch strap was to chang the sensor location to increase sensor accuracy, so we got an idea to change the sensor location to the armrest pointing on the blood vains directly.
steps¶
we started by taking dimensions for the strap to make it fit, and by using fusion360 i created the shape of the strap but sadly it was not as good as we wanted it was a bit big and did not fit probably
We redesigned the strap again and by th help of the mechanical engineer Ahmed we got the perfect design, you will find detailed information about the strap.
the idea of the design is to get the DXF form so we can use it in laser machine to create a mould that we will pour silicon to get the caste so we can get the shape we wanted, we did use glue to hold the pieces to gether.
for the other side we used regular belt with soft and ruff side to make it adjustable
The bluetooth communication¶
Testing¶
our first task in this part was to use a regular esp32 kids iot to send and receive data from and to an application that with the help of mahdi was done using MIT app inventor which was successfully done by me and mahdi.
referring to the following code
########## DIGITAL MANUFACTURING ##########
# PIKACHU Project
# Authors: Miguel Angel Guzman
# Kadriye Nur Bakirci
###########################################
########## IMPORT REQUIRED LIBRARIES ##########
import bluetooth
from ble_uart_peripheral import BLEUART
from machine import Pin, ADC
import time
# Set up ADC for reading sensor value
sensor_pin = 34 # GPIO pin connected to the sensor
adc = ADC(Pin(sensor_pin)) # Initialize ADC on the sensor pin
adc.atten(ADC.ATTN_0DB) # Set attenuation to 0 dB (adjust if needed)
# Define a threshold for detecting if the sensor is connected
DISCONNECT_THRESHOLD = 10 # This is an example value; adjust based on your sensor
# Create BLE object
ble = bluetooth.BLE()
# Open UART session for BLE
uart = BLEUART(ble)
# Define ISR for UART input on BLE connection
def on_rx(data):
# Read UART string, AppInventor sends raw bytes
uart_in = data # read the message received from the Smartphone via Bluetooth
try:
message = uart_in.decode('utf-8') # decode bytes to string
except Exception as e:
print("Error decoding message:", e)
return
print("UART IN: ", message) # display the message received from the Smartphone on the Thonny console
# Example: Process message commands if needed
if message == 'READ_SENSOR':
send_sensor_value()
def send_sensor_value():
# Read the sensor value
sensor_value = adc.read() # Read the analog value from the sensor
# Check if the sensor value indicates a disconnection
if sensor_value < DISCONNECT_THRESHOLD:
# Send "NOT AVAILABLE" if the sensor value is below the threshold
uart.write('SENSOR_VALUE:NOT AVAILABLE\n')
else:
# Send the sensor value over UART
uart.write(f'SENSOR_VALUE:{sensor_value}\n') # Send the data in a readable format
# Map ISR to UART read interrupt
uart.irq(handler=on_rx)
# Main loop
while True:
# Periodically read and send sensor data
time.sleep(5) # Adjust the interval as needed
send_sensor_value()
The watch¶
for the watch we had few problems to connect them using bluetooth because the application could not recognize the watch, but mahdi did manage to make it read the data,
The final project¶
we finally did actually make the health monitoring device work and display th data and communicate with the application.
this project is to show the world that we can adjust monitoring devices and can use iot to collect data so the doctors can check for the patient states without the need of the patient attendance, this can minimize the large numbers of patients in health centers globally and can create new job opportunities by allowing simple manufacturing in hospitals to at least use the simple moulding and casting techniques t create suitable straps for the patients and connect other devices such as scales and glucose monitoring devices to one application that the doctor is following large numbers of multiple patients data every day.