Chamal Ayesh Wickramanayaka
Published © Apache-2.0

Heart beat, SPO2 and body temperature remote patient monitor

Measuring the body vitals are not hard but keep track of them very difficult. This device can measure body vitals easily.

AdvancedFull instructions providedOver 10 days2,542
Heart beat, SPO2 and body temperature remote patient monitor

Things used in this project

Hardware components

nRF5340 Development Kit
Nordic Semiconductor nRF5340 Development Kit
×1
Adafruit 2.8" TFT Touch Shield for Arduino w/Capacitive Touch
×1
Molex MLX90614 IR temperature sensor
×1
ProtoCentral Pulse Oximeter & Heart Rate Sensor based on MAX30100
ProtoCentral Electronics ProtoCentral Pulse Oximeter & Heart Rate Sensor based on MAX30100
×1

Software apps and online services

nRF Connect SDK
Nordic Semiconductor nRF Connect SDK

Story

Read more

Schematics

Wiring diagram

Basic wiring diagram

Code

main.c

C/C++
This is main C file for the project
/*
 * Copyright (c) 2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>
#include <drivers/i2c.h>

/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS   1000

/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)

#if DT_NODE_HAS_STATUS(LED0_NODE, okay)
#define LED0	DT_GPIO_LABEL(LED0_NODE, gpios)
#define PIN	DT_GPIO_PIN(LED0_NODE, gpios)
#define FLAGS	DT_GPIO_FLAGS(LED0_NODE, gpios)
#else
/* A build error here means your board isn't set up to blink an LED. */
#error "Unsupported board: led0 devicetree alias is not defined"
#define LED0	""
#define PIN	0
#define FLAGS	0
#endif

void main(void)
{
	const struct device *dev;
	bool led_is_on = true;
	int ret;

	dev = device_get_binding(LED0);
	if (dev == NULL) {
		return;
	}

	ret = gpio_pin_configure(dev, PIN, GPIO_OUTPUT_ACTIVE | FLAGS);
	if (ret < 0) {
		return;
	}
        printk("System has been booted");

        const struct device *dev_i2c = device_get_binding("I2C_1");
        if (dev_i2c == NULL) {
		printk("Error");
	}

        //for(uint8_t i2c_addr = 0x01; i2c_addr < 128; i2c_addr++)
        //{
        //  uint8_t i2c_cmd = 1;
        //  int error = i2c_write(dev_i2c, &i2c_cmd, 1, i2c_addr);
        //  if(error==0)
        //  {
        //    printk("Address %x\n", i2c_addr);
        //  }
        //}

	while (1) {

        uint8_t cmd = 0x07;
        uint16_t i2c_data;

        int error = i2c_write_read(dev_i2c,0x5a,&cmd,1,&i2c_data,1);
        if(error==0)
        {
          float temp = ((260 - (i2c_data*0.02))-32)*5/9;
          printk("Body Temperature: %i\n",(int16_t)temp);

        }

		gpio_pin_set(dev, PIN, (int)led_is_on);
		led_is_on = !led_is_on;

		k_msleep(SLEEP_TIME_MS);
	}
}

prj.conf

Plain text
This is the project configuration file
CONFIG_GPIO=y

CONFIG_I2C=y

Credits

Chamal Ayesh Wickramanayaka

Chamal Ayesh Wickramanayaka

23 projects • 25 followers
Experienced software engineer with a passion for AI, IoT, and innovation, continuously seeking to learn and embrace new technologies.

Comments