We have been testing the Grove Heart rate sensor (http://www.seeedstudio.com/depot/Grove-Fingerclip-Heart-Rate-Sensor-with-shell-p-2420.html) with the GrovePi+ and have faced some problems when reading the data out of it. You can find the example code here: https://github.com/DexterInd/GrovePi/tree/master/Software/Python/grove_fingerclip_heart_sensor (Using this sensor would cause your GrovePi+ to stop working properly, but you can simply disconect the sensor and the problem goes away).
The sensor gives 1 byte of data when you read from it indicating the heart rate. When we used it with the Arduino, we were getting the data properly, even though the reading were jumping around a lot, but the bus was pretty stable (see heart_arduino.logicdata). But when we run it with the GrovePi, it takes down the whole I2C bus in a minute or so (hear_rate_I2C_collapse.logicdata). We then removed the GrovePi from the picture and directlu connected the sensor to the Raspberry Pi I2C pins with a 3.3V-5V level converter and saw the same issue.
The good data just has 2 bytes, one the read request and the other the data (good_data.jpg). In the bad data, it does look like the Pi requests for the data from the sensor and does not get anything back (bad_data_zoomed.jpg) after waiting for a while, the I2C bus crashes.
It would be great if any users out there who already have the sensor can try this out and let us know how it goes for them. If you were able to get the sensor working, it’ll be great if you can share the solution with us.
(Please use the saleae software to view the logic files: http://support.saleae.com/hc/en-us/articles/201589175).
Did you ever get this sensor working? One of our students is after HR on our grovepi boards, and it would be nice if they could use this.
Sorry we have still not been able to get the sensor working with the GrovePi.
Ok, thanks for that. I suspect from the description here and on another post that it is a bug in the STM firmware on the sensor, and I don’t have time to fight with yet another new microprocessor
We’ve got some arduino pulse sensors (pulse sensor amped), so I’m going to solder a grove cable onto those and add a firmware command to read them. Is that something that you guys would be interested in rolling into the main firmware if I do it?
Actually looking at the firmware code, there’s a load of improvements that could be done, I could stick them as tickets if it’s useful? For example there’s a bunch of things (encoder, flow sensor, dust sensor, ultrasonic read) which could all be on the global pinchange interrupt (PCINT2_vect), but aren’t (it’s only used for encoder). I can’t fix them because they’re mostly not sensors we have.
Yeah, it does look like a bug in the STM firmware on the chip.
I don;t think we would merge the code for the pulse sensor amped in the main GrovePi firmware source because we are trying to keep it clean and only add things which everyone needs just to make sure that it is not too complex or has bugs.
However it would be great if you could fork out repo and put the updated firmware in your repo and send us a link here. So that if anyone wants to use that sensor in the future, they can still go back and use it from your repo.
That for the information about the improvements to the firmware. Can you open an issue on GitHub for that and add a few more details. We’ll work on those the next time we are working on a new firmware version.