RAK12022 (PT100 temperature sensor) not working with RUI3

Hi all,

I’m having trouble getting a RAK12022 PT100 temperature sensor module to work with my 4631 core module with the RUI3 firmware. The sensor and works fine when I use the Open Source firmware on the 4631 core, but not when using the RUI3 firmware. I find this surprising for several reasons, but the main one is that this should be a simple SPI interface and well supported. So I’m wondering what I’m doing wrong here?

Some details:

  • My core module is a 4631 running RUI3 v4.0.6
  • My base board is a RAK19007
  • My sensor module is a RAK12022 PT100 sensor with MAX31865 IC accessed over an SPI interface
  • My Arduino IDE is v2.2.1 and I’m developing on Windows 10
  • I’m using the RAK12022-MAX31865 v1.0.1 library installed via the Arduino Library Manager

To reproduce the issue:

  • Use WisToolBox to install the latest 4.0.6 RUI3 firmware on the 4630 module (AT+VER=? returns RUI_4.0.6_RAK4631)
  • Use the Arduino Board Manager to install the RAKwireless RUI nRF Boards v4.0.6 (or v4.1.0 - it gives the same problem), and select ‘WisBlock Core RAK4631 Board’ as the board type on the right COM port. Sidenote: in my opinion, RUI3 should be included in the board type name to distinguish it from the open source ‘WisBlock RAK4631’ board type!
  • Use the Arduino Library Manager to install the Install the RAK12022-MAX31865 library v1.0.1
  • Open the example sketch with File->Examples->RAK12022-MAX31865->RAK12022_Max31865_Example (version 0.1 is listed in the header comments for this sketch)
  • Change the PT100 probe type in line 35 with maxTemp.begin to match your probe (I have a 3 wire probe so select MAX31865_3WIRE)
  • Compile and upload.

The output I get is per below, and I am unable to get temperature readings:
RAK12022 Max31865 Test
MAX31865 is not connected, Please check your connections

With the same example sketch loaded, and changing the 4631 firmware to the open source firmware per the instructions at Device Firmware Upgrade | RAKwireless Documentation Center , and changing the board type to ‘WisBlock RAK4631’ in the Arduino IDE and compile->uploading, then I get the following successful output:

RAK12022 Max31865 Test
Found MAX31865
Resistance = 109.96 Ohms, Temperature = 25.50 °C, RTD Low Threshold
Resistance = 109.95 Ohms, Temperature = 25.47 °C, RTD Low Threshold
Resistance = 109.96 Ohms, Temperature = 25.50 °C, RTD Low Threshold
Resistance = 109.98 Ohms, Temperature = 25.53 °C, RTD Low Threshold

I’ve tried downgrading to 4.0.5 of the firmware and the Arduino Board type, with the same results

So my conclusion is that there’s something about RUI3 firmware (or the Arduino Board definition?) that prevents a simple SPI-based sensor working?

I do see that the quickstart guide for this sensor block under point 2 of the heading ‘Initial Test of the RAK12022 WisBlock Module’ specifically mentions using the package_rakwireless_index.json board installation package which implies that this sensor might only work with the open source firmware; but if its just SPI I don’t understand why?

I will kick myself if this turns out to be some simple or obvious thing that I should have quickly seen, but I’m a bit stumped and not sure how to troubleshoot further - some insights or assistance would be appreciated!

Thanks in advance.

As a quick sidenote: what would be nice during development is some little breakout board that could sandwich in between the 24 and 40 pin connectors and break the pins out where they would be easier to get to with an oscilloscope (I was initially trying to confirm power was reaching the sensor module and that I could see SPI signals, but this was tricky given the tiny size of all the components)

Here’s the code from the example sketch in case that is useful:

/**

   @file RAK12022_Max31865_Example.ino

   @author rakwireless.com

   @brief  This code is designed to get the sensor data

   @version 0.1

   @date 2022-02-10

   @copyright Copyright (c) 2022

**/

#include "RAK12022_MAX31865.h"     //http://librarymanager/All#RAK12022-MAX31865

// use hardware SPI,just pass in the CS pin

const int Max_CS = SS;

MAX31865 maxTemp;

void setup() {

  pinMode(WB_IO2, OUTPUT);

  digitalWrite(WB_IO2, HIGH);

  delay(300);

  time_t timeout = millis();

  Serial.begin(115200);

  while (!Serial)

  {

    if ((millis() - timeout) < 5000)

    {

      delay(100);

    }

    else

    {

      break;

    }

  }

  Serial.println("RAK12022 Max31865 Test");

  // configure rtd sensor

  if (maxTemp.begin(Max_CS, MAX31865_3WIRE, MAX31865_PT100)) //if use 2-wire,choose MAX31865_2WIRE (MAX31865_2WIRE,MAX31865_3WIRE,MAX31865_4WIRE)

  {

    Serial.println("Found MAX31865");

  } else {

    Serial.println("MAX31865 is not connected, Please check your connections\r\n");

    while (1)

    {

      delay(500);

    }

  }

  maxTemp.MAX31865_SetLowFaultThreshold(29);  // Set the low fault threshold to 29 degrees C

  maxTemp.MAX31865_SetHighFaultThreshold(34); // Set the high fault threshold to 34 degrees C

  delay(1000);

}

void loop()

{

  float mTemp, mResistance;

  uint8_t mStatus = 0;

  maxTemp.MAX31865_GetTemperatureAndStatus(mTemp, mResistance, mStatus);

  Serial.print("Resistance = ");

  Serial.print(mResistance);

  Serial.print(" Ohms,   ");

  Serial.print("Temperature = ");

  Serial.print(mTemp);

  Serial.print(" °C,   ");

  if (mStatus)

  {

    if (mStatus & MAX31865_FAULT_TEMP_HIGH)

    {

      Serial.print("RTD High Threshold");

    }

    if (mStatus & MAX31865_FAULT_TEMP_LOW)

    {

      Serial.print("RTD Low Threshold");

    }

    if (mStatus & MAX31865_FAULT_REFIN_HIGH)

    {

      Serial.print("REFIN- > 0.85 x Bias");

    }

    if (mStatus & MAX31865_FAULT_REFIN_LOW_OPEN)

    {

      Serial.print("REFIN- < 0.85 x Bias - FORCE- open");

    }

    if (mStatus & MAX31865_FAULT_RTDIN_LOW_OPEN)

    {

      Serial.print("RTDIN- < 0.85 x Bias - FORCE- open");

    }

    if (mStatus & MAX31865_FAULT_VOLTAGE_OOR)

    {

      Serial.print("Voltage out of range fault");

    }

  }

  Serial.println();

  delay(500);

}

Welcome to the forum @Seethe

Instead of downgrading, did you try to upgrade to the latest RUI3 version 4,1,1

RUI3 V4.1.1 is still in staging. It can be installed by using the Arduino BSP JSON file for the staging version from
https://raw.githubusercontent.com/RAKWireless/RAKwireless-Arduino-BSP-Index/staging/RUI_4.1.1_266/package_rakwireless_com_rui_index.json
in the Additional Boards Manager URLs setting in ArduinoIDE.

For the breakout board, we have the RAK13002 with all signals on pin headers ==> RAK13002 IO Module | 8 Pin Module | Signal Pin Header – RAKwireless Store

Thanks for the quick reply.

No, I didn’t manage to try the staging version as yet. I’ll give it a whirl later today and feedback.

That breakout board looks like exactly the thing I needed, thanks!

Alas, no. I get the same result using 4.1.1 from the staging RUI BSP, and using the RAK12022_Max31865 example sketch per the output below:

RAK12022 Max31865 Test
MAX31865 is not connected, Please check your connections
AT+VER=?
AT+VER=RUI_4.1.1_RAK4631
OK

I see the source code for this sensor library is available from GitHub - RAKWireless/RAK12022-MAX31865: RAKWireless library for the RAK12022-MAX31865 with the latest commit being to make it RUI3 compatible; so I’ll try make some time to dabble with the source and try troubleshoot further with judicious use of Serial.print() inside the library to try narrow down where the problem lies :-D.