WorldFamousElectronics / PulseSensorPlayground

A PulseSensor library (for Arduino) that collects our most popular projects in one place.
https://PulseSensor.com
MIT License
200 stars 97 forks source link

Connect PulseSensor to nRF51822 #63

Closed francesco98 closed 6 years ago

francesco98 commented 6 years ago

Hi,

I want to connect the Pulse Sensor to nRF51822. Is it possible?

Thank you

biomurph commented 6 years ago

I have not used the nRF51822 directly, however I have used the Simblee and RFduino made by RFDigital (now bought up by someone else). Both of those are built on the nRF51822 glass. There should be no problem connecting the Pulse Sensor to one of the analog pins. You will likely want to use the BPM_Alternative code example if you are going to run BLE or Gazelle stack, as the radio will stomp on your interrupts (in my experience). I don't see any issue with using either BLE or Gazelle to send the data over air. What you will have to do is buffer the samples (BLE allows 20 bytes per radio packet, Gazelle allows 32 bytes per radio packet). Pulse Sensor samples at 500Hz, 2mS, so you should be fine if you collect samples to fill the packet, and then send over air. On the other side, you will have to unpack, but that's trivial.

francesco98 commented 6 years ago

Thanks for your support. I'm using the alternative code, but I'm receiving these errors:

How can I resolve? Thanks.

biomurph commented 6 years ago

Ah, ok. Are you using the Arduino IDE? If so, what board are you targeting?

francesco98 commented 6 years ago

The target is: Generic nRF1

biomurph commented 6 years ago

Can you link me to the json for the board cores?

francesco98 commented 6 years ago

Where can I find it? I'm using this: https://github.com/sandeepmistry/arduino-nRF5

biomurph commented 6 years ago

OK, I just added support for the nRF5 architecture. Please download the library from this repo, and replace the one you have in your libraries folder. I don't have any nRF boards in house, but it does compile on my machine.

LMK if you get it to work on your board.

francesco98 commented 6 years ago

Ok thanks, but I have another problem.. I'm connecting the pulse sensor to ATTiny85, but I'm receiving this error: PulseSensorPlayground.cpp:28: undefined reference tooperator new[](unsigned int)'`

Sorry for my many question..

biomurph commented 6 years ago

That seems a strange error. I am able to compile targeting a Gemma board. What board are you using? ATTiny85 don't have any hardware serial port, so you need to use the Software Serial Demo example code to get started.

francesco98 commented 6 years ago

I have solved by replacing new PulseSensor[SensorCount] with (PulseSensor*) malloc(SensorCount * sizeof(PulseSensor))

biomurph commented 6 years ago

Great! We'll look into rolling that change in the next release.