Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9868 Discussions

Setting up a heart pulse sensor on a Galileo

idata
Community Manager
3,190 Views

Hello there,

I recently bought a heart pulse sensor for an Arduino Uno board. Here it is http://pulsesensor.myshopify.com/pages/code-and-guide http://pulsesensor.myshopify.com/pages/code-and-guide

It is great and works fine with the Arduino Uno board but I would really like to get it working with a Galileo board. I am a complete newbie to Arduino and I have an interest in setting up medical related sensors on the Galileo (more so than the Arduino board). But I'm finding that a lot of projects and tutorials based on Arduino boards are not very compatible with the Galileo - I am right? But I am going to persist with the Galileo.

Anyway, there is a detailed walk through of the code for the pulse sensor available here http://pulsesensor.myshopify.com/pages/pulse-sensor-amped-arduino-v1dot1 http://pulsesensor.myshopify.com/pages/pulse-sensor-amped-arduino-v1dot1

I believe the issue is related to a Timer2 timer. This is used to get a high enough resolution to get reliable measurement of the timing between each beat. About half way down the page, there is a piece of code that defines the setting for the Timer2.

void interruptSetup(){ TCCR2A = 0x02; TCCR2B = 0x06; OCR2A = 0x7C; TIMSK2 = 0x02; sei(); }

Does the Galileo have Timer2 capabilities? Also, the Arduino and the Galileo have different clock speeds is this causing a problem.

Would anybody be able to help me to modify this code so that that it is works on a Galileo? It would be much appreciated.

 

Kind regards

John

Side note:

This is the error that I get when I run the code.lse

'void interruptSetup()': Interrupt.ino:17:3: error: 'TCCR2A' was not declared in this scope Interrupt.ino:18:3: error: 'TCCR2B' was not declared in this scope Interrupt.ino:19:3: error: 'OCR2A' was not declared in this scope Interrupt.ino:20:3: error: 'TIMSK2' was not declared in this scope Interrupt.ino:21:7: error: 'sei' was not declared in this scope Interrupt.ino: At global scope: Interrupt.ino:27:4: error: expected constructor, destructor, or type conversion before '(' token
1 Solution
LUIS_R_Intel1
Employee
498 Views

Hi Conor100,

Great project! Let me give you some information, as you have mentioned some projects are not fully compatible with the Galileo the reason is they use instructions designed for other processors than the Quark, as example

TCCR2A, TCCR2B, OCR2A and TIMSK2 are macros designed for the Atmega as mentioned in the this walkthrough http://pulsesensor.myshopify.com/pages/pulse-sensor-amped-arduino-v1dot1 http://pulsesensor.myshopify.com/pages/pulse-sensor-amped-arduino-v1dot1 , you will have to search a workaround perhaps creating a function to obtain the same result , also we need to do the same for the interrupSetup() at this time this is not validated for the Galileo, see post /message/218968 https://communities.intel.com/message/218968.

 

Regards,

View solution in original post

22 Replies
LUIS_R_Intel1
Employee
499 Views

Hi Conor100,

Great project! Let me give you some information, as you have mentioned some projects are not fully compatible with the Galileo the reason is they use instructions designed for other processors than the Quark, as example

TCCR2A, TCCR2B, OCR2A and TIMSK2 are macros designed for the Atmega as mentioned in the this walkthrough http://pulsesensor.myshopify.com/pages/pulse-sensor-amped-arduino-v1dot1 http://pulsesensor.myshopify.com/pages/pulse-sensor-amped-arduino-v1dot1 , you will have to search a workaround perhaps creating a function to obtain the same result , also we need to do the same for the interrupSetup() at this time this is not validated for the Galileo, see post /message/218968 https://communities.intel.com/message/218968.

 

Regards,

View solution in original post

idata
Community Manager
484 Views

Thanks for your reply and help,much appreciated.

idata
Community Manager
484 Views

Hi LDiego,

I was wondering if it would be possible to use this pulse sensor via I2C instead of the GPIO? If, so I was wondering you could point in the general direction? I haven't had much luck since.

Thanks

John

GSoma1
New Contributor I
484 Views

Hi

If you are still in need of a galileo compatible code for pulse sensor, I have written some for both Arduino IDE and using the IoT Dev Kit

You can download and try

https://github.com/gowrisomanath/gsArduinoPulseHeartRate https://github.com/gowrisomanath/gsArduinoPulseHeartRate

http://gowrisomanath.github.io/gsPulseHeartRate/ http://gowrisomanath.github.io/gsPulseHeartRate/

DKRIS5
Novice
484 Views

gowrisomanath Are you using the same pulse sensor from pulsesensor.com? I got one, but stuck with the interrupt part.

GSoma1
New Contributor I
484 Views

yes. i used the same.

sorry i dont understand what you mean by interrupt part. what are you refering to? something in my code?

DKRIS5
Novice
484 Views

gowrisomanath No. I have to try your code, may be tonight.

All this is new to me as I'm from web application development background. so the interruptSetup in Arduino code sample on pulsesensor.com was confusing me and just in the phase of learning it.

Meanwhile, do you have a javascript/node.js version of this?

GSoma1
New Contributor I
484 Views

The sample code on pulsesenor is not compatible with intel galileo or edison. they use interrupts specific to Arduino platforms.

Which is why i made my own arduino library for pulse sensor.

I only wrote the arduino and C++. I dont have JS versions.

DKRIS5
Novice
484 Views

I tried out your sample for heart rate sensor. I get this error while compiling,

In file included from /Users/******/Documents/Arduino/libraries/gsPulseHeartRate/gsPulseHeartRate.h:12:0,

from sketch_dec19a.ino:1:

/Users/*****/Documents/Arduino/libraries/gsPulseHeartRate/mraa/aio.hpp: In constructor 'mraa::Aio::Aio(unsigned int)':

/Users/******/Documents/Arduino/libraries/gsPulseHeartRate/mraa/aio.hpp:50:94: error: exception handling disabled, use -fexceptions to enable

throw std::invalid_argument("Invalid AIO pin specified - do you have an ADC?");

Any idea, what am I doing wrong here?

Also a request, please elaborate the readme.md file on Git, it will be very helpful for the first time users like me.

Thanks.

GOWRI_S_Intel
Employee
484 Views

The error is saying "("Invalid AIO pin specified - do you have an ADC?");"

So that means your analog pin number is incorrect.

I was working on The Galileo arduino board. It should also work with Edison arduino board.

What board are you using? I dont think it will work directly for the breakout board.

Also this code is for the Eclipse C++ IDE with IoT Dev kit. NOT for Arduino IDE.

For the Arduino IDE you need to use https://github.com/gowrisomanath/gsArduinoPulseHeartRate gowrisomanath/gsArduinoPulseHeartRate · GitHub

DKRIS5
Novice
484 Views

I have Intel Edison with Arduino breakout board, hence I was using custom Arduino IDE from Intel for programming. And I do have the Intel XDK-IoT, but was in an impression that it was for javascript programming only.

I got the error while verifying the code in the IDE itself. For sure I will try the code you share for Arduino IDE and will update you.

Thanks a lot for your time gowrisomanath, I'm sure over conversations will be useful for someone visiting this thread.

DKRIS5
Novice
484 Views

Hey Gowri, I had no luck in making your code on Edison. I tried the code here [https://github.com/gowrisomanath/gsArduinoPulseHeartRate gowrisomanath/gsArduinoPulseHeartRate · GitHub] with no luck yet. Initially I got an error PULSE_CHECK_TIME_GAP is not defined and I got that cleared. But now, there is no errors and there is no output. I get nothing when I call the function getPulseRate() to the serial monitor just to view the output from the sensor. Could you please help me out? Am I missing any configurations or something?

Thanks!

GOWRI_S_Intel
Employee
484 Views

I have provided a test sketch testPulse2.ino please refer to that for usage.

You are using the library wrong.

pkant2
Novice
484 Views

hey dipinkumar4u, i have same problem with error PULSE_CHECK_TIME_GAPE is not declared ....

so please can you help me how can i figure it out .........

thanks

idata
Community Manager
484 Views

gowrisomanath's helpful reply is exactly right. If you use her code with the Timer library that Dr. Monk has provided, the pulse sensor will indeed work on an Intel Galileo. As she says, you just have to put the folder in the right place. (As always with Arduino code!)

 

kshuk
Beginner
307 Views

Hey Gowri... I went through all the conversations... All of you really helped a lot... I tried this code... The error which I am getting is :

Arduino: 1.6.0 (Windows 7), Board: "Intel® Galileo Gen2"

heart4.ino: In function 'void setupPulse(int, int)':

heart4.ino:52:8: error: 'timer_obj' was not declared in this scope

heart4.ino: In function 'void setupPulse2(int, int, int)':

heart4.ino:66:5: error: 'timer_obj' was not declared in this scope

heart4.ino: In function 'void checkPulse()':

heart4.ino:80:5: error: 'timer_obj' was not declared in this scope

heart4.ino: In function 'void doHeartRateAgain()':

heart4.ino:94:5: error: 'timer_obj' was not declared in this scope

heart4.ino: In function 'void getHeart()':

heart4.ino:136:13: error: 'timer_obj' was not declared in this scope

heart4.ino: In function 'void writePulseData(int)':

heart4.ino:298:9: error: 'timer_obj' was not declared in this scope

Error compiling.

This report would have more information with

 

"Show verbose output during compilation"

 

enabled in File > Preferences.

Please tell me what I can do??

Its really very urgent... Please Help!!

MLuch
Beginner
484 Views

Can anyone post an example for pulse sensor signal acquisition, on Galileo Gen 1 ?

idata
Community Manager
484 Views

I am really glad you are trying to get this to work. Your code uses an include to "timer.h". Where does that file come from? Can you supply one that works? Whatever I try after I get an error message using your code hasn't worked. I am using an Intel Galileo Gen 2 and Arduino software 1.6.3. (the current) Thanks!

GSoma1
New Contributor I
484 Views

smamber

you can download the timer library for arduino from

http://www.doctormonk.com/2012/01/arduino-timer-library.html http://www.doctormonk.com/2012/01/arduino-timer-library.html

download and put the folder into the library subfolder of the IDE. then it will know where to link from for your sketches.

Reply