Ehealth with Mega 2560

I purchased an ehealth device from cooking-hacks and am attempting to interface it with an Arduino Mega 2560. The issue I am having is with the pulse ox sensor and getting a read-out from the serial monitor. All I receive are 0s in the monitor. I checked a few posts on their forums, but they do not have a working solution (working for me anyway). Has anyone had any success connecting one of the ehealth shields to an Arduino Mega 2560 with a working pulse ox?

cooking hacks link:
http://www.cooking-hacks.com/documentation/tutorials/ehealth-biometric-sensor-platform-arduino-raspberry-pi-medical

Any Assistance is Greatly Appreciated.

Does the pulse-oxisensor turn on and show values ?

The pulse-oxisensor uses pin 6 up to 13. The 3.3V signal is passed on with transistors to the Arduino board.
Pin 6 is set to a pin change interrupt, and pin 7 up to pin 13 are the data.

The Arduino Uno can do "Pin Change INTerrupt" (PCINT) on every pin.
The Arduino Mega can not.

https://code.google.com/p/arduino-pinchangeint/wiki/MEGA

It is this code line in the example : PCintPort::attachInterrupt(6, readPulsioximeter, RISING);
Note that the PCINT library has been updated for better support for the Arduino Mega 2560. So you have to replace those files with the newest version.
You can connect pin 6 to one of the pins on the Mega Board that does allow PCINT. For example analog pins A6 to A15. The other PCINT pins are in use or are the SPI bus or a Serial port.
So the shield pin 6 will be connected to both pin6 and (for example) A8 of the Arduino Mega.
I think you can do this: PCintPort::attachInterrupt(A8, readPulsioximeter, RISING);

I think you can even ignore the interrupt, and look at the level of pin 6 with polling. But I'm not sure how long the data on pin 7 to 13 is available. I can not find enough information for the pulse-oximeter itself.

Peter,
Thank you for the assistance. I found the issue I was having with the interrupts. I negated to delete the second library PinChangeInt located in the documents folder (I'm a new user) . The pulse oximeter shows values and I can get values now in the serial monitor. The issue now is finding which numbers they use in their .cpp file correspond to which numbers on the unit. What values did you use in the .cpp file for your output under void eHealthClass::readPulsioximeter? Below are the two sections from the .cpp file that correspond to the puseox.

/*
 void eHealthClass::readPulsioximeter(void)
	{
		uint8_t digito[6];

		uint8_t A = 0;
		uint8_t B = 0;
		uint8_t C = 0;
		uint8_t D = 0;
		uint8_t E = 0;
		uint8_t F = 0;
		uint8_t G = 0;

		for (int i = 0; i<6 ; i++) { // read all the led's of the module
			A = !digitalRead(13);
			B = !digitalRead(12);
			C = !digitalRead(11);
			D = !digitalRead(10);
			E = !digitalRead(9);
			F = !digitalRead(8);
			G = !digitalRead(7);
			
			digito[i] = segToNumber(A, B, C ,D ,E, F,G);    
			delayMicroseconds(300); //300 microseconds			
			
		}
		SPO2 = 10 * digito[5] + digito[4];
		BPM  = 100 * digito[2] + 10 * digito[1] + digito[0];              
	}

//! Converts from 7 segments to number.

	uint8_t eHealthClass::segToNumber(uint8_t A, uint8_t B, uint8_t C, uint8_t D, uint8_t E, uint8_t F, uint8_t G )
	{
		if ((A == 1) && (B == 1) && (C == 1) && (D == 0) && (E == 1) && (F == 1) && (G == 1)) {
			return 0;
	   
		} else if ((A == 0) && (B == 1) && (C == 0) && (D == 0) && (E == 1) && (F == 0) && (G == 0)) {  
			return 1;
		
		} else if ((A == 1) && (B == 1) && (C == 0) && (D == 1) && (E == 0) && (F == 1) && (G == 1)) { 
			return 2;
		
		} else if ((A == 1) && (B == 1) && (C == 0) && (D == 1) && (E == 1) && (F == 0) && (G == 1)) { 
			return 3;
		
		} else if ((A == 0) && (B == 1) && (C == 1) && (D == 1) && (E == 1) && (F == 0) && (G == 0)) { 
			return 4;
		
		} else if ((A == 1) && (B == 0) && (C == 1) && (D == 1) && (E == 1) && (F == 0) && (G == 1)) { 
			return 5;
		
		} else if ((A == 1) && (B == 0) && (C == 1) && (D == 1) && (E == 1) && (F == 1) && (G == 1)) { 
			return 6;
		
		} else if ((A == 1) && (B == 1) && (C == 0) && (D == 0) && (E == 1) && (F == 0) && (G == 0)) {
			return 7;  
		
		} else if ((A == 1) && (B == 1) && (C == 1) && (D == 1) && (E == 1) && (F == 1) && (G == 1)) { 
			return 8;
		
		} else if ((A == 1) && (B == 1) && (C == 1) && (D == 1) && (E == 1) && (F == 0) && (G == 1)) { 
			return 9;
			
		} else  {
			return 0;
		}
	}

Regards,
Tim

I don't have anything like that, I was only looking at the schematics and source code. :cold_sweat:
The code for the pins is a little weird, I didn't look at it. I assume that segToNumber converts it to a number.

Peter,
My apologies, I thought you had one of these units. Your comment did get me thinking and I finally got it figured out. I socketed the ehealth unit onto the mega and attached pin 6(ehealth) to pin A15(mega). I deleted the original pin change folder and added the new 2.19 beta to my library. I changed the void in the .cpp file to the following:

	void eHealthClass::readPulsioximeter(void)
	{
		uint8_t digito[41];

		uint8_t A = 0;
		uint8_t B = 0;
		uint8_t C = 0;
		uint8_t D = 0;
		uint8_t E = 0;
		uint8_t F = 0;
		uint8_t G = 0;

		for (int i = 0; i<41 ; i++) { // read all the led's of the module
			A = !digitalRead(13);
			B = !digitalRead(12);
			C = !digitalRead(11);
			D = !digitalRead(10);
			E = !digitalRead(9);
			F = !digitalRead(8);
			G = !digitalRead(7);
			
			digito[i] = segToNumber(A, B, C ,D ,E, F,G);    
			delayMicroseconds(300); //300 microseconds			
			
		}

			SPO2 = 10 * digito[24] + digito[20];
			BPM  = 100 * digito[18] + 10 * digito[2] + digito[0];
		
                         
	}

and used the following sketch.

#include <PinChangeInt.h>
#include <eHealth.h>

int cont = 0;

void setup() {
  Serial.begin(115200);  
  eHealth.initPulsioximeter();

  PCintPort::attachInterrupt(A15, &readPulsioximeter, RISING);
}

void loop() {

  Serial.print("    PRbpm : "); 
  Serial.print(eHealth.getBPM());

  Serial.print("    %SPo2 : ");
  Serial.print(eHealth.getOxygenSaturation());

  Serial.print("\n");  
  Serial.println("============================="); 
  delay(500);
}

//Include always this code when using the pulsioximeter sensor
//=========================================================================
void readPulsioximeter(){  

  cont ++;
  //Serial.println("ISR");
  if (cont == 50) { //Get only of one 50 measures to reduce the latency
    eHealth.readPulsioximeter();  
    cont = 0;
  }
}

This worked for me, every once in a while you get a delayed pulse but the output is pretty stable otherwise.

Thanks Again!

Well done.
I don't understand what you did with 'A' to 'G', but that part of code was confusing anyway.

I prefer something like this:

A = ( digitalRead(13) == HIGH ) ? 1 : 0;

what is 2.19 beta which you have used