Making a smartband with an arduino nano

Hi guys! I'm new here and i want to ask. Can you guide me in making a smartband that detects vital signs(heart rate,body temperature and blood oxygen level). And it alarms a buzzer(active buzzer) when it detects an abnormal readings in the vital signs(even just one abnormal vital sign). I needed it for my research innovation but our school doesnt teach us about robotics or programming related subject so I'm completely a greenhorn about this subject.

Well, then your first task would be to learn how to program with the Arduino.
This is a good place to start:
https://docs.arduino.cc/learn/

1 Like

Yup, read. Have you searched this forum for similar projects?

1 Like

Yeah, but most of them dont have enough information and some post are nog being entertain

Thanks i already have my code but im not confident that it will work because i just learn programming for not even a month and im also worried about the cost since im just a high schooler

#include <Wire.h>
#include <U8g2lib.h>
#include <MAX30100_PulseOximeter.h>

#define BUZZER_PIN 8 // Replace with the actual pin connected to the buzzer
#define BUTTON_PIN 7 // Replace with the actual pin connected to the manual override switch
#define LM35_PIN A0 // Analog input pin for LM35
#define LOW_BATTERY_THRESHOLD 3.5 // Adjust this threshold based on your battery specifications

MAX30100_PulseOximeter pox;
unsigned long previousMillis = 0;
const long interval = 60000; // 1 minute
const long buzzerDuration = 180000; // 3 minutes
const long sleepDelay = 60000; // 1 minute of inactivity before entering sleep mode

bool isBuzzerActivated = false;

void setup() {
Serial.begin(9600);
pinMode(BUZZER_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT_PULLUP); // Using internal pull-up resistor

if (!pox.begin()) while (1);
}

void loop() {
unsigned long currentMillis = millis();

// Check manual override switch
if (digitalRead(BUTTON_PIN) == LOW) {
deactivateBuzzer();
isBuzzerActivated = false;
}

if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
pox.update();

// Check for abnormal heart rate or oxygen levels
if (pox.getHeartRate() > 100 || pox.getSpO2() < 95) {
  if (!isBuzzerActivated) {
    activateBuzzer();
    isBuzzerActivated = true;
  }
  alertUser("Abnormal heart rate or oxygen level!");
} else {
  if (isBuzzerActivated) {
    deactivateBuzzer();
    isBuzzerActivated = false;
  }
}

// Check for abnormal temperature (replace with LM35 code)
float temperature = readTemperatureFromLM35();
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println("°C");

if (temperature > 38.0) {
  if (!isBuzzerActivated) {
    activateBuzzer();
    isBuzzerActivated = true;
  }
  alertUser("Abnormal body temperature!");
} else {
  if (isBuzzerActivated) {
    deactivateBuzzer();
    isBuzzerActivated = false;
  }
}

// Check for low battery
float batteryVoltage = readBatteryVoltage();
if (batteryVoltage < LOW_BATTERY_THRESHOLD) {
  if (!isBuzzerActivated) {
    activateBuzzer();
    isBuzzerActivated = true;
  }
  alertUser("Low battery warning!");
} else {
  if (isBuzzerActivated) {
    deactivateBuzzer();
    isBuzzerActivated = false;
  }
}

}

// Check for inactivity to enter sleep mode
if (currentMillis - previousMillis >= sleepDelay) {
enterSleepMode();
}
}

void alertUser(const char* message) {
Serial.println(message);
// Add code to display the message on the OLED or take other appropriate actions
}

void activateBuzzer() {
digitalWrite(BUZZER_PIN, HIGH);
}

void deactivateBuzzer() {
digitalWrite(BUZZER_PIN, LOW);
}

void enterSleepMode() {
(set to low battery consumption) // Code to prepare for sleep (e.g., turn off components, set pins to low)
// Add any additional preparation steps here...

// Enter sleep mode
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();

// Attach an interrupt to wake up the Arduino on button press
attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), wakeUp, LOW);

// Put the Arduino to sleep
sleep_mode();

// Upon waking up, disable sleep and detach the interrupt
sleep_disable();
detachInterrupt(digitalPinToInterrupt(BUTTON_PIN));
}

void wakeUp() {
// This function will be called when the interrupt occurs (button press)
}
This is my code. Can you tell me if it is correct or is there any mistake. This is my code for my research project the smartband

Hi, @arc_29
Welcome to the forum.

Try it, see what happens, if it doesn't work then do some trouble shooting and get back to us.

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

We need to know what hardware and how it is connected.

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

Either you can afford the parts or not.
If you can't, then you need to find another project that costs less

I dont have the things you want we to send. I literally learned all my knowledge in youtube and internet. And are teacher is still pushing us to do it even without having a single knowledge about it

Hi,
What is the class subject?
What education level?

Tom... :grinning: :+1: :coffee: :australia:

The subject is practical research and Im a grade 12 student

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.