Ganglion use with Pulse Sensor / which analog pin?

edited July 2018 in Ganglion
Hi there
Would it be possible to input the pulse oximeter you offer on your shop to one of simblee's available analog inputs (A3, A4, A5, A6) ?
... as it would spare one of the MCP3912  4 channels...
Thanks !


  • wjcroftwjcroft Mount Shasta, CA
    Jeff, hi.

    The Pulse Sensor can be used with Ganglion, and exactly as you say using the analog input pin on the Simblee.

    In fact it HAS to use the Simblee pin because the reasons mentioned on this thread,

    There is a Pulse Sensor widget available in the GUI. It takes the analog pin input stream coming in on one of the Aux channels (corresponding to one of the analog pins), and detects the pulse wave. Then deriving the heart rate, which is shown in the widget.

    I'm not quite sure which pin to use however, which will line up with the correct Aux channel. Can you do some looking around yourself with the search results above and see if you find the answer and post it here? Also for reference this same ability is present with Cyton, and I believe there are previous forum threads which mention the Aux channel that the widget uses and Cyton analog pin. You would need to figure out the mapping of analog pins and Aux channels on the Ganglion.

    Also, for clarification, the Pulse Sensor is not using oximetry, that tech is for determining blood oxygen levels. Pulse Sensor uses PPG,

    Mentioning Joel Murphy @biomurph, the hardware designer of Pulse Sensor, Ganglion, Cyton, etc. 


  • biomurphbiomurph Brooklyn, NY
    @Jeff_B You can use the Ganglion to interface with the Pulse Sensor by accessing one of the Simblee analog pins.
    We have broken out analog pins A3, A4, A5, A6. Use any one of those.

    You will have to modify the sketch that you're using to make it work. Inside the setup() routine you need this line

    put the line
    ganglion.useAux = true;

    That will tell the library to put Auxiliary data into the data stream.

    Then, you need to tell the Ganglion to read the Pulse Sensor in the loop() 


    ganglion.auxData[0] = analogRead(A6);
    That 'should' work. Know that default sample rate for the auxData is ~10Hz, which is pretty slow for a Pulse Sensor... This could be increased but would take some messing around in the library...

    There is also a possible bug that I may have found. Mentioning @pushtheworld on this. AJ, looking at the processData function in the library, lines 177 to 189, it looks like the library will always do a 'compress19'. This might need to be fixed?

    @Jeff_B. Please try this out, and if you are having trouble with it it might be more direct and faster to open an issue in the Ganglion Library repo

  • William and Joel,
    Thank you for the useful information !  
    So we can read analog values and stream them in the Auxilliary data ( ganglion.useAux = true;  ganglion.auxData[0] = analogRead(Ax); x=3;4;5 or 6) and modify the sample rate.
    And it is similarily possible to set one of the Simblee available digital pins (D0,D1,D2,....) as an output & write on it ? (to control a feeback)(and push the written data in the streamed data ganglion.auxData[ ]).
    I have read somewhere in the suggested references that the sketch used by the Ganglion currently uses ~25% of Simblee's available memory ? 
  • Hi all, I'm also interested in pulling in data from the PulseSensor into the Ganglion. Has anybody gotten the above solution (from @biomurph) to work? I tried implementing it as written, and the line:

    ganglion.auxData[0] = analogRead(A6); 

    threw me an error that 'A6' was not declared in this scope. This may be an issue with a definition of the ports on the Simblee with respect to Arduino? If I instead put A6 in quotes, which I'm quite sure is wrong, the code compiled and I was able to do the OTA programming (super cool!). I then changed a line on the Processing side (line 231 in DataLogging.pde) to record the aux data in the text file that the GUI spits out, and saw all zeros where I was hoping there would be sensor data.

    Just wondering if I'm missing a very small thing here, or if there are other challenges on the horizon for pulling in the PulseSensor data.

  • wjcroftwjcroft Mount Shasta, CA
    edited May 2019
    Brian, hi.

    The auxData approach previously mentioned is is more realistic for Cyton; which has 16 bit samples at 250 Hz. Ganglion (with default firmware) can provide only 8 bit samples at 10 Hz. The Ganglion data stream is extremely constrained by the BLE bandwidth available, and the multiple compression schemes needed to cope with the 200 Hz sample rate.

    You could sacrifice one of the 4 Ganglion channels, and use a voltage divider on the Pulse Sensor output, to get the output in the microvolt range to be usable on the channel input.

    A final alternative: just use a tiny inexpensive Arduino and connect the Pulse Sensor to that. The output of your sketch can then be the numeric pulse rate, read on the computer's serial port by your app.



  • Thanks for getting back to me so quickly, Jeff! That is a shame, though. The PulseSensor webpage indicated that it could be interfaced with the Ganglion, and the Ganglion data format page indicated that aux data could be sent in place of accelerometer data. Oh well. The Arduino approach that you mention of course works-- I was just hoping to have the heart data synchronized with the neural data, and pulling it in through the Ganglion seemed like the best approach (now I know it isn't).
  • (oops, I meant to say "William" instead of "Jeff")
  • wjcroftwjcroft Mount Shasta, CA
    With Cyton, when it is setup to send analog or digital Aux data, it sends 3 * 16 bit values on every sample (250 Hz sample rate). So any one of these 16 bit Aux slots could hold an analog value from the Pulse Sensor.

    With Simblee, the accelerometer or Aux data, is only being sampled at 10 Hz. This would be too slow for decent ECG / PPG signal processing. Additionally the samples are only 8 bits, not 16.

    With some Simblee firmware changes it MIGHT be possible to up the sample rate somewhat. If you look at the Ganglion Data Format, the Aux or Accel data are stuffed into the ends of the 18 bit compression packets. Only one byte can be stuffed. While the Ganglion sample rate is 200 Hz, the packets are sent at half that rate. And the "raw uncompressed" format has no room for the extra byte to be stuffed.

    Would approximately 100 Hz, 8 bit samples provide enough bandwidth for ECG PPG signal processing? Questionable.
  • wjcroftwjcroft Mount Shasta, CA
    These pages suggest 100 Hz can work. However 8 bit samples would be crushing the Pulse Sensor data to a rather small range. The analog input pins on the Cyton (PIC32) produce 16 bit values at 250 Hz. I think Simblee analog pins also produce 16 bit samples. Of course you could use two 8 bit slots to stuff one 16 bit value. But then your sample rate is half, only 50 Hz.

    re: "... was just hoping to have the heart data synchronized with the neural data, and pulling it in through the Ganglion seemed like the best approach (now I know it isn't)..."

    Do note that generally heart rate monitors do not update the displayed heart rate at 200 or 100 Hz rates. They update more typically at 1 or 2 Hz.

    HRV measurements are of course much more fine grained, and measure IBI inter beat intervals in milliseconds.

    So I think bringing in your PPG signal via another Arduino device is not going to be THAT much out of sync with your Ganglion data.


  • Hi all,
    I've also tried using @biomurph 's solution for acquiring an analog input signal to the Ganglion, but got the same error message: 'A6' was not declared in this scope, as @Brian_A described. I searched a bit on the web and found a Simblee user guide with the following:

    So I tried changing 'A6' to just '6' on the code, and it compiled and I was able to upload it (the HW way, OTA not working for me for some reason).
    I then tried streaming some data on the gui, and input a 4V analog signal, lasting for 1 second each time, to A6 on the Ganglion (using the GNDA as ground reference).
    I checked the Recording data, but all accelerometer data columns had only zeros on them. So, bottom line - I guess it didn't work.
    Has anyone successfully input an analog signal to the Ganglion via the A3-6 inputs?
    Best Regards,

Sign In or Register to comment.