Welcome, Guest

Author Topic: Hook up UEXT to Arduino uno to recieve heart beat signal (mod-pulse)  (Read 916 times)

rogernm001

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Hello,

Is it possible to run a wire from the UEXT straight to an Arduino Uno then write some code to interpret the signal its reading to turn on a series of lights whenever the pulse beats? I already hooked up the TX port from the UEXT to the analog on the Arduino and used the Arduino IDE sample code "ReadAnalogSerial" and modified it but was only receiving reading from a range of 0-4 every second. here is the code so far.

Code: [Select]
void setup() {
  // initialize serial communication at 9600 bits per second:
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop()
{
 
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
 
  // print out the value you read:
  if (sensorValue > 1)
  {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  }
  if (sensorValue < 1)
  {
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off (LOW is the voltage level)
  }
  Serial.print("Sensor Value = ");
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
}

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1812
  • Karma: +46/-2
Re: Hook up UEXT to Arduino uno to recieve heart beat signal (mod-pulse)
« Reply #1 on: September 19, 2017, 08:51:29 AM »
In your code you are not interpreting the data at all. Your LED only indicates when TX sends data (e.g. it works as TX activity LED).

I recommend you to take a look at this demo code that we have provided: https://www.olimex.com/Products/Modules/Biofeedback/MOD-PULSE/resources/MOD-PULSE-example.zip

First make sure to edit it and run it successfully without major modifications (only changing the responsible pins, etc). It would print data from MOD-PULSE over the serial monitor. Then you can modify the code to achieve your goals (e.g. compare the tmpstr[2] value with desired constant and set different blink rates for different thresholds).

Two important notices:

1. The code is made for OLIMEXINO-32u4 (Arduino Leonardo)! So the pins would be slightly different, you need to edit the code to fit your board!

2. MOD-PULSE is meant for 3.3V operation! Arduino UNO, as far as I'm aware works at 5V! You need to bring the 5V level signals to 3.3V.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex