RF Module & Pulse Sensor

Hello, I am using an Arduino UNO and simulating a wireless network of three sensors: pulse sensor for heart rate, and two temperature/thermistor based sensors to measure breath rate and body temperature. The data is being sent by RF 433 MHz modules.

I have scrolled through a lot of forums trying to find suggestions for transmitter and receiver codes used with a pulse sensor - for a code including the pulse sensor playground library. The best I did was write this code based on the suggestions from other topics.

This is the transmitting code so far that is to be sent using RF 433Mhz modules. I don’t quite know how to fix the error that comes up and so any assistance would be really appreciated. My main goal is to be able to send the data from the three sensors individually to a network sink. My first step is combining the library used for pulse sensor and radio head. If the two are for some reason incompatible then is there any other way for me to send the beats per minute (bpm) reading wirelessly using the RF module?

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
#define USE_ARDUINO_INTERRUPTS true    // Set-up low-level interrupts for most acurate BPM math.
#include <PulseSensorPlayground.h>     // Includes the PulseSensorPlayground Library.   
#define RH_ASK_ARDUINO_USE_TIMER2
          
                               
PulseSensorPlayground pulseSensor; 

const int PulseWire = 0;       // PulseSensor PURPLE WIRE connected to ANALOG PIN 0
const int LED13 = 13;          // The on-board Arduino LED, close to PIN 13.
int Threshold = 550;           // Determine which Signal to "count as a beat" and which to ignore.
                               // Use the "Gettting Started Project" to fine-tune Threshold Value beyond default setting.
                               // Otherwise leave the default "550" value. 

RH_ASK driver;

// using struct to send data 
struct dataStruct{
 float bpm;
 unsigned long counter; }myData;

byte tx_buf[sizeof(myData)] = {0};

void setup()
{
    Serial.begin(9600);    // Debugging only
    
    if (!driver.init())
         Serial.println("init failed");

  // Configure the PulseSensor object, by assigning our variables to it. 
  pulseSensor.analogInput(PulseWire);   
  pulseSensor.blinkOnPulse(LED13);       //auto-magically blink Arduino's LED with heartbeat.
  pulseSensor.setThreshold(Threshold);   

  // Double-check the "pulseSensor" object was created and "began" seeing a signal. 
   if (pulseSensor.begin()) {
    Serial.println("We created a pulseSensor Object !");  //This prints one time at Arduino power-up,  or on Arduino reset.  
  } }

void loop()
{
float myBPM = pulseSensor.getBeatsPerMinute();  // Calls function on our pulseSensor object that returns BPM as an "int".
                                               // "myBPM" hold this BPM value now. 

if (pulseSensor.sawStartOfBeat()) {            // Constantly test to see if "a beat happened". 
 Serial.println("♥  A HeartBeat Happened ! "); // If test is "true", print a message "a heartbeat happened".
 Serial.print("BPM: ");                        // Print phrase "BPM: " 
 Serial.println(myBPM);                        // Print the value inside of myBPM. 
 myData.bpm=myBPM;                             // Assigning value of bpm to value that is to be sent 
}

  
   memcpy(tx_buf, &myData, sizeof(myData) ); //conversion 
   byte zize=sizeof(myData);  // determining byte size 

   driver.send((uint8_t *)tx_buf, zize);  // value to be sent 
   driver.waitPacketSent(); // waiting for it to be sent 
   myData.counter++; // increase in counter 
   delay(2000);
}

This is the error message it shows:
libraries/RadioHead/RH_ASK.cpp.o (symbol from plugin): In function RH_ASK::maxMessageLength()': (.text+0x0): multiple definition of __vector_11’
sketch/Forumtest.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Uno.

So the code won't even compile. It appears that there is an error within the RH_ASK library function. The first thing to check is if there is an updated library available.
S.

Have you considered the legal limits on the use of 433 mHz ISM frequencies is about 1 transmission per second?
Paul

433 mHz

I don't know of any restrictions on millihertz transmissions! (except perhaps planning permission for
the astronomically long antenna!)

MarkT:
I don't know of any restrictions on millihertz transmissions! (except perhaps planning permission for
the astronomically long antenna!)

Shift key broke!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.