Monitoring 2 SPO2 signals using module afe4490

I don't see any other alternative.

Fortunately for the electronics engineer who designed the output section of that device, I am not the CEO. If I were, that person would be looking for a new job today. Just my opinion.

I was hoping there would still be other alternatives, but if that's not the case then so be it. thank you so much for helping me along the way.

If not me, maybe somebody else will spot the software problem.
If you need help with the buffer, let me know.
Ensure to get one with the Output Enable (OE) active LOW. That way you can connect the CS line directly to OE.

okay, I'll look for the chip first

If the device conformed to the datasheet, we'd be done here.
If the device released the MISO line when CS is HIGH, we'd be done here.
At least we have the library seeing 2 different devices.
Now to keep them from fighting over the SPI bus.

Edit: If you decide on the hardware buffer, let me know and I'll build a library for you much faster than the one above.

yes, i decided to use tri-state buffer, and i just bought the chip and tried it earlier. well i will wait for your latest library

Does it work now with the current library?

Yes, its work

Great! We'll test first. open protocentral_afe44xx.cpp
Comment out the 4 function calls to afe44xxHiZ as below.

void AFE44XX :: afe44xxWrite (uint8_t address, uint32_t data, int cs)
{
  digitalWrite (cs, LOW); // enable device
//  afe44xxHiZ(false); // exit hi-z
  SPI.beginTransaction(SPI_SETTINGS);
  SPI.transfer (address); // send address to device
  SPI.transfer ((data >> 16) & 0xFF); // write top 8 bits
  SPI.transfer ((data >> 8) & 0xFF); // write middle 8 bits
  SPI.transfer (data & 0xFF); // write bottom 8 bits
  SPI.endTransaction();
//  afe44xxHiZ(true); // enter hi-z
  digitalWrite (cs, HIGH); // disable device
}

unsigned long AFE44XX :: afe44xxRead (uint8_t address, int cs)
{
  unsigned long data = 0;
  digitalWrite (cs, LOW); // enable device
//  afe44xxHiZ(false); //exit hi-z
  SPI.beginTransaction(SPI_SETTINGS);
  SPI.transfer (address); // send address to device
  data |= ((unsigned long)SPI.transfer (0) << 16); // read top 8 bits data
  data |= ((unsigned long)SPI.transfer (0) << 8); // read middle 8 bits  data
  data |= SPI.transfer (0); // read bottom 8 bits data
  SPI.endTransaction();
//  afe44xxHiZ(true); // enter hi-z
  digitalWrite (cs, HIGH); // disable device
  return data; // return with 24 bits of read data
}

okey, I'll give it a try

It should increase the speed. It will do only one read instead of a write, then read, then write.

thank you

@tesmontes Are you able to achieve Spo2 reading less than 90% with this library? I am using a Spo2 simulator to simulate Spo2 values less than 90% but I am always getting reading around 90 to 95%.
If you don't have a simulator, you can use breathe into a paper bag. After 10-15 breathes, your spo2 should start dropping. You can use a commercial Oximeter to validate your readings. And don't breathe in paper bag for longer duration.

PS: Sorry for asking question unrelated to the topic but since @tesmontes is currently working on this, so thought to ask it here.

I haven't tried using a simulator, but I once got a value of 79, meaning it can still be read. However, I will try again using Simjlator to be sure

this reading produces a spo2 value after 7 minutes, is there a solution so that the spo2 value reading can be faster??

I'm not sure. That value is calculated here. It uses a lookup table.

hi, I want to ask again. the results of the heart_rate value on these two AFE4490 modules produce the same value continuously, I have tried to modify the library but it hasn't worked, can you help me again?

Does one work correctly when connected by itself?

Yes, when you try one, it works well.

Can you help me??