can i display heart rate on 7 segments without using mcu?

Thread Starter

SLCJO

Joined Feb 11, 2019
2
Hi All,

i want to measure heart rate and display the value on 7 segment .

i am using pulse sensor as the following

pulse-sensor-copy.jpg

can i read the heart rate using this sensor without using MCU ?

Regards
 

Alec_t

Joined Sep 17, 2013
11,730
Welcome to AAC!
In general, anything you can do with an MCU you can do using discrete components, but it may involve quite complex circuitry.
Either way, you would need to know the spec of the sensor. Can you post that, or a link to it?
 

danadak

Joined Mar 10, 2018
4,057
This is easy and cost effective job with MCU. To take a pulse input and display.

Why do you want to avoid MCU ? Is this a one off design or something
in a production product ?


Regards, Dana.
 

Reloadron

Joined Jan 15, 2015
5,667
You may want to get familiar with your sensor. The sensor outputs pulses and is powered by 5 volts.
can i read the heart rate using this sensor without using MCU ?
Yes, you need to put together a pulse rate counter to count pulses / min. Using a 7 segment display you will need two displays or a single display capable of a heart or pulse rate count. Doing this using discreet components will involve displays, display drivers, and associated counter circuits.

Ron
 

jpanhalt

Joined Jan 18, 2008
10,461
@Reloadron Thanks for the link.

If the TS wants seeming simplicity, a simple RPM meter could be attached to that signal. A comparator might be needed to reduce noise. As an alternative, the signal could drive an LED and an RPM meter like this might be used: https://www.mpja.com/download/35588te.pdf Cheaper ones are available on the market. I don't known how low they go, and a single transistor amp may be necessary to drive the led. I got some low-current LED's (e.g., 1 mA) recently, and they work fine on even less than that.
 

Thread Starter

SLCJO

Joined Feb 11, 2019
2
I tried some codes(Arduino Codes) to read the sensor and display the heart rate ,,i got the same result..
1-I got values even no finger placed on pulse sensor .
2-when i place finger i got correct heart rate values for sometime but after a few moments i got high heart rate values(150,200,200>).
so i went to build a circuit which read heart Rate without using MCU.

the output signal of my sensor as in fig below..
pulsesignal.png

thank you all
 

Reloadron

Joined Jan 15, 2015
5,667
Using this code sample:
Code:
int sensor_pin = 0;               

int led_pin = 13;                 

volatile int heart_rate;         

volatile int analog_data;             

volatile int time_between_beats = 600;           

volatile boolean pulse_signal = false;   

volatile int beat[10];         //heartbeat values will be sotred in this array   

volatile int peak_value = 512;         

volatile int trough_value = 512;       

volatile int thresh = 525;             

volatile int amplitude = 100;                

volatile boolean first_heartpulse = true;     

volatile boolean second_heartpulse = false;   

volatile unsigned long samplecounter = 0;   //This counter will tell us the pulse timing

volatile unsigned long lastBeatTime = 0;



void setup()

{

  pinMode(led_pin,OUTPUT);       

  Serial.begin(9600);          

  interruptSetup();                 

}



void loop()

{

      Serial.print("BPM: ");

      Serial.println(heart_rate);

      delay(200); //  take a break

}



void interruptSetup()

{   

  TCCR2A = 0x02;  // This will disable the PWM on pin 3 and 11

  OCR2A = 0X7C;   // This will set the top of count to 124 for the 500Hz sample rate

  TCCR2B = 0x06;  // DON'T FORCE COMPARE, 256 PRESCALER

  TIMSK2 = 0x02;  // This will enable interrupt on match between OCR2A and Timer

  sei();          // This will make sure that the global interrupts are enable

}


ISR(TIMER2_COMPA_vect)

{

  cli();                                    

  analog_data = analogRead(sensor_pin);           

  samplecounter += 2;                       

  int N = samplecounter - lastBeatTime;     


  if(analog_data < thresh && N > (time_between_beats/5)*3)

    {    

      if (analog_data < trough_value)

      {                      

        trough_value = analog_data;

      }

    }


  if(analog_data > thresh && analog_data > peak_value)

    {       

      peak_value = analog_data;

    }                         



   if (N > 250)

  {                           

    if ( (analog_data > thresh) && (pulse_signal == false) && (N > (time_between_beats/5)*3) )

      {      

        pulse_signal = true;         

        digitalWrite(led_pin,HIGH);

        time_between_beats = samplecounter - lastBeatTime;

        lastBeatTime = samplecounter;    



       if(second_heartpulse)

        {                       

          second_heartpulse = false;  

          for(int i=0; i<=9; i++)   

          {           

            beat[i] = time_between_beats; //Filling the array with the heart beat values                   

          }

        }


        if(first_heartpulse)

        {                       

          first_heartpulse = false;

          second_heartpulse = true;

          sei();           

          return;          

        } 


      word runningTotal = 0; 


      for(int i=0; i<=8; i++)

        {              

          beat[i] = beat[i+1];

          runningTotal += beat[i];

        }


      beat[9] = time_between_beats;            

      runningTotal += beat[9];  

      runningTotal /= 10;       

      heart_rate = 60000/runningTotal;

    }                     

  }




  if (analog_data < thresh && pulse_signal == true)

    { 

      digitalWrite(led_pin,LOW);

      pulse_signal = false;            

      amplitude = peak_value - trough_value;

      thresh = amplitude/2 + trough_value;

      peak_value = thresh;          

      trough_value = thresh;

    }


  if (N > 2500)

    {                         

      thresh = 512;                    

      peak_value = 512;                

      trough_value = 512;              

      lastBeatTime = samplecounter;    

      first_heartpulse = true;                

      second_heartpulse = false;              

    }


  sei();                               

}
Taken from this location. Here is what I get:
Heart Rate.png

Since I do not have the sensor I am applying a 5 Volt Peak to Peak sine wave from a signal generator to pin A0 of an Arduino Uno. I am applying 1.0 Hz which is 60 BPM.

I have no idea what code you are using but the code I just presented works fine. Additionally the original sample code used a baud rate other than 9600 so I did, for my system, change the baud rate to 9600.

Ron
 

JohnInTX

Joined Jun 26, 2012
4,338
You'd be much better off doing this with some computing power as @Reloadron shows. The problems you say you are having show that your software doesn't read the sensor very well but that's fixable with better software. Whatever the poor software isn't compensating for in getting a good beat signal from the raw sensor will still be there in a hardware solution.

Also, to get BPM in hardware you'll have to accumulate beats over a relatively long time or measure period and calculate heart rate. The software solutions measure the period between beats using a peak detector algorithm and calculate BPM from that period allowing the BPM display to be updated on each beat.. That is much easier than counting beats over full minute or computing BPM = K* 1/period in hardware.

Here's more on the sensor:
https://pulsesensor.com/

Good luck!
 

dendad

Joined Feb 20, 2016
3,610
The simple way is to use a micro processor of some sort. Discrete logic is not simple.
A processor allows you to change the operation easily. And process the data to get a better result. I see no advantage at all to get rid of the processor. It will be a lot cheaper and smaller to use a micro as well.
 

Reloadron

Joined Jan 15, 2015
5,667
While I have no idea what code you were using you may want to take a good look at the code sample I posted. Notice in the example code the input to the Arduino is an analog channel (A0). Take a good look at your signal as in your picture I am not sure what we are looking at. The Arduino uses a 5 volt reference and a 10 bit (2^10) A/D conversion so 0 to 5 volts = 0 to 1023 bits. Now look at the code and see how the A0 input is handled. Pay attention to this part:
Code:
volatile int peak_value = 512;       
volatile int trough_value = 512;     
volatile int thresh = 525;
512 bits is 1/2 of 1024 bits or simply put 2.5 volts. Depending on exactly what your sensor output looks like you can, as necessary, tailor your code.

Even if you try and do the using all discreet components you are going to have to signal condition your sensor output so it works. You will also need to understand what is going on be it discrete component or a micro-controller.

Ron
 

sghioto

Joined Dec 31, 2017
1,553
From what I've read the sensor is already amplified and conditioned for direct connection to arduino inputs. However it is possible to use discrete IC's. Basically it's done using a sawtooth generator controlled by the pulse from the sensor. An average voltage is obtained between beats and sent to a VFC which then goes to a digital counter with display.
SG
 

Reloadron

Joined Jan 15, 2015
5,667
Of course you can build a heart or pulse rate monitor using discrete components. Everyone agrees to that. You could even use an analog meter to display the rate, much like an old automotive tachometer. There is no shortage of circuits which can be used. If you feel using all discreet components is how you want to go about it then have at it. To answer your original question:
"can i display heart rate on 7 segments without using mcu"?
Yes, absolutely without a doubt. That's how it was done before a MCU became popular.

Ron
 

MisterBill2

Joined Jan 23, 2018
7,232
You can also have an analog display using an LM2917 tachometer IC. OR a 4 digit counter IC plus a time base. Not trivial but the circuits are widely published. You can also write the program in basic and connect that sensor to your sound input and read the rate on your PC. But that only works if you have a PC.
 

DNA Robotics

Joined Jun 13, 2014
588
when i place finger i got correct heart rate values for sometime but after a few moments i got high heart rate values(150,200,200>).
so i went to build a circuit which read heart Rate without using MCU.
I played with that sensor and an Arduino with a Processing program that had a graph like scope pattern. The placement and pressure of the sensor on your finger or ear lobe determines how good a signal you get. They said if you exert just enough pressure to keep the scope pattern within a certain range, you could trust the BPM.
 

Reloadron

Joined Jan 15, 2015
5,667
I played with that sensor and an Arduino with a Processing program that had a graph like scope pattern. The placement and pressure of the sensor on your finger or ear lobe determines how good a signal you get. They said if you exert just enough pressure to keep the scope pattern within a certain range, you could trust the BPM.
Thanks for sharing that. All I have here to simulate a signal is an old function generator. :( I did decide to use an LCD display so I added that. Works fine using an Arduino Uno serial to the LCD. Again, thanks for sharing that information.

Ron
 

Reloadron

Joined Jan 15, 2015
5,667
You can also have an analog display using an LM2917 tachometer IC. OR a 4 digit counter IC plus a time base. Not trivial but the circuits are widely published. You can also write the program in basic and connect that sensor to your sound input and read the rate on your PC. But that only works if you have a PC.
That would likely work well using Audacity which would allow you to record the data to a PC. Pretty cool.

Ron
 
Top