rwaldron / johnny-five

JavaScript Robotics and IoT programming framework, developed at Bocoup.
http://johnny-five.io
Other
13.28k stars 1.76k forks source link

PulseSensor implementation or example? #328

Closed nmelin closed 10 years ago

nmelin commented 10 years ago

Hello, doing a bit of pre-emptive project research.

has support for this been implemented: PulseSensor Heart-Rate BPM for Arduino http://pulsesensor.myshopify.com/pages/code-and-guide

If not, do you think this would be implemented with a 'new five.Sensor()' function ?

soundanalogous commented 10 years ago

It could be possible using a custom Firmata implementation, however that would mean the only component you could use with johnny-five while running such firmware would be the PulseSensor. The reason is that the pulse sensor requires precise timing and therefore uses hardware interrupts which are not accessible through StandardFirmata (the firmware/sketch typically run on an Arduino when using johnny-five or other Firmata clients).

I have a simple proof of concept using a custom Firmata sketch that you could try. The corresponding JavaScript code is not for johnny-five but you could port it to J5's architecture.

The Arduino files are here: https://github.com/soundanalogous/breakout-experiments/tree/master/pulse_sensor/sketch/PulseSensorAmped_Firmata

And you'll find a js file here (again not for J5 so you'll have to change it to use the node-firmata / johnny-five architecture): https://github.com/soundanalogous/breakout-experiments/blob/master/pulse_sensor/PulseSensor.js Basically you access the raw sysex message data.

There is a Firmata plug-in architecture in the works as well (configurable firmata) that will make it possible to mix in custom functionality with standard functionality (analog and digital i/o, etc). But that is still a work in progress.

rwaldron commented 10 years ago

Thanks Jeff!

nakulcr7 commented 9 years ago

Hey,

Could you guys have a look at a similar problem that I'm having?

https://github.com/rwaldron/johnny-five/issues/788