xBT Implant - Temperature Sensor via Arduino RFID


#1

Several Months ago I commenced a project to passively monitor health signals including body Temperature.
I focused around Arduino and hoped to scan one or more implant as I walk through a door-way.

After a fair bit or research and speaking with Amal Graafstra [Dangerous Things] he indicated no Arduino code had been created to read the xBT chip. Below is a usable sketch which hopefully save someone alot of time which Amal has encouraged me to now post.

FDX-B
To read such a chip requires a read capable of FDX-B protocol.
For this purpose of writing and testing I’ve chosen the RFIDRW-E-TTL chip from Priority1 (below).

SCANNER
The larger intent for this project is a doorway scanner which I’d adapt/build directly.
Its become apparent that the power output required to scan a 2*12mm chip from 1m is problematic, possibly dangerous. As such I am exploring alternatives to passive scanning…

SKETCH/CODE:

MINIMUM SKETCH (output in HEX format)

#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 9); // RX, TX
void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);
}
bool id=true;
void loop()
{
  if(mySerial.available()){
    int c=mySerial.read();
    if(c=='\r'){
      if(id){
        Serial.write("; ");
        mySerial.write("RAT\r");
      }else
        Serial.write("\r\n");
      id=!id;
    }else Serial.write(c);
  }
}

Buy Priority1 RFIDRW-E-TTL Reader:
http://www.priority1design.com.au/rfid_reader_modules.html

Spec for RFID Reader:
http://www.priority1design.com.au/rfidrw-e-ttl.pdf


#2

Awesome! Thanks so much for sharing!


#3

Hi,

I have tried this code and it gives back strange readings.
Sometimes zero and sometimes temperatures too high. Are you sure this is right?
I cannot find any information on the exact format used to store the temperatures and have tried converting to float/int/ short etc but nothing gives accurate results. I have tried with two RFID X-BT chips.

Any help would be appreciated.

Thanks,
Joseph.


#4

Hi Joseph,

Did you use the “minimum” version?
Remember: This has a HEX output which you’ll need to convert to DEC.

You can use a tool like this: https://www.binaryhexconverter.com/hex-to-decimal-converter to check your results.
That said, I’ve also had multiple issues with the chip if its outside relative body temperature. It also seems to have latency.

I’ll run the code again tonight and see if its work incase I posted something incorrect.


#5

Hi,
I used the bigger version with the strtol conversion:
long decTemp = strtol(temperatureBytes, &ptr, 16);
As I type it is reading 0 degrees.
It could be that it is outside body temperature(?) but it is supposed to handle a range of temperatures.
If you are sure the code is good then I can assume a hardware issue. Have you used the code on a working chip to get results?

Thanks,
Joseph.


#6

Hi,
Some questions about the implant. I am having difficulty getting information elsewhere.

  1. Is the temp definitely in Celsius?
  2. I have read various papers stating that the temperature is accurate to about 0.1/0.2 degrees. If the output is an integer then it will always be rounded to the nearest integer so could at best be accurate to 0.5 degrees!
    The Halo reader gives reading to one place of decimals so it cannot be reading an int?
    Sorry for the repeat questions but I cannot find the information elsewhere
    Thanks,

#7

I’d need to pull it all apart again to give you very accurate advice, however from memory it was a string.
like 888-444-222233233
The front part was region Id, then there is some other junk then the temperature.

Basically, 3233 would be 32.33 degree’s Celsius (it was something like this, not exact).

The above is an over simplification of what I saw, however hopefully helps a little bit.


#8

Also don’t forget that the thermal sensor in the chip only operates within a range… if the temp is too low - i.e. the chip is sitting on your cold desk, then it will not report or the value might be zero. I don’t know what it actually reports since I have not seen the raw data, but I know the commercial reader will simply omit temp data if the chip is too cold… so when testing on the bench I have to hold it in my hand for a while until it heats up to start getting readings again.


#9

OK,

Do you have information from the company stating what the exact format is? I am finding it difficult to get any information online. If you can find the format I will post code online that reads and decodes the temperature.
Even a contact email within the company that I can contact would help.
Thanks,
Joseph.


#10

Hi,

Some readings. They look like:
985_141001086691; 985_141001086691_1_0_EF40_00004C

Only the last 6 bytes change. This is where the temp must be stored. If you look at the readings below you will see that the 1 in the third last byte appears intermittently and with no discernible pattern to its appearance or disappearance.

If we assume that 1 is always there then the readings look much more regular with a much smaller variance between readings. I put the implant in warm water for the readings nearer the end and that stabilised the temperature readings somewhat.

Take the last two bytes and put a 1 in front of them (assume it is supposed to be there) if it is missing then convert from hex to decimal and you get a three digit number. Put a decimal point before the last digit (336 becomes 33.6) and the readings makes sense.

I am assuming that the 1 that is sometimes dropped should in fact always be present but can only back this up by saying there is no pattern to its occasional disappearance and that the numbers make sense only when it is present.

This is presently my best guess at how to read the sensor.
Does this make sense? We would still need to confirm the format is correct with the manufacturer if possible.

Joseph.

Reading from sensor in warm water (water cooling as readings continue)

985_141001086691; 985_141001086691_1_0_EF40_0001AC (42.8 degrees)
985_141001086691; 985_141001086691_1_0_EF40_0001A3 (41.9 degrees)
985_141001086691; 985_141001086691_1_0_EF40_0000A2
985_141001086691; 985_141001086691_1_0_EF40_00009E
985_141001086691; 985_141001086691_1_0_EF40_00019C
985_141001086691; 985_141001086691_1_0_EF40_000199
985_141001086691; 985_141001086691_1_0_EF40_00018E
985_141001086691; 985_141001086691_1_0_EF40_000086
985_141001086691; 985_141001086691_1_0_EF40_00007A
985_141001086691; 985_141001086691_1_0_EF40_00007A
985_141001086691; 985_141001086691_1_0_EF40_00016F
985_141001086691; 985_141001086691_1_0_EF40_000054
985_141001086691; 985_141001086691_1_0_EF40_000142
985_141001086691; 985_141001086691_1_0_EF40_000043
985_141001086691; 985_141001086691_1_0_EF40_00003E
985_141001086691; 985_141001086691_1_0_EF40_00003D
985_141001086691; 985_141001086691_1_0_EF40_000052 (33.8 degrees if we read as 152)


#11

Sorry - I’ve been a little limited in time and still not had a chance to review it all again.
However, what you have stated below seems to be correct.

I too had an issue with it dropping a 1 on occasion during testing.

Its my presumption that once the temperature is more stable it self resolves.
I’d guess this is a hardware limitation.


#12

Here is the code I am using based on those assumptions above. It seems to work but really we need confirmation from the manufacturer to be sure. Hope this helps out:

It is based on the code given at the top of this thread (thanks for that)
It works properly on an Arduino Uno
The code is actually indented properly-the indents are not showing up in post though :blush:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
}

bool id=true;
int count=0;
char sTemp[7];
long lTemp=123;
float fTemp=0.0;
char eptr;
//
*************************************************************************************
//Last six bytes of output contain temperature but first three are always 000
//Assumptions:
//1. Format is character string representing temp in hexidecimal e.g. ‘1E7’ == 487
//2. Last digit is after decimal point e…g. 487 == 48.7
//3. First of the three digits should always be one but is sometimes missing (not sure why)
//4. Temperature is given in Celsius
//
//All these should be checked with manufacturer
//**************************************************************************************

void loop()
{
if(mySerial.available()){
int c=mySerial.read();
if(c==’\r’){
if(id){//first carraige return indicates we have half data from request
Serial.write("; “);
mySerial.write(“RAT\r”);
}else//second carraige return indicates end of data
Serial.write(”\r\n");
id=!id;
}else{
Serial.write©;
if (c==’_’){//count number of underscores received
count++;
}
if (count==6){//temperature is output after sixth underscore
for(int i=0;i<6;++i){//next six bytes contains temperature read them into array here
while(!mySerial.available()){}
sTemp[i]=mySerial.read();
Serial.write(sTemp[i]);
}
//Add terminator character to array -required for strtol to work
//Any non hex character should work
sTemp[7]=‘Q’;
//temp is Hex characters so we convert from base 16 (hex) to decimal and put into long variable
lTemp=strtol(sTemp,&eptr,16);
if (lTemp<256)lTemp+=256;//If the first bit is missing add it back in (sometimes it is - not sure why)
fTemp=(float)lTemp/10;//convert to float and divide by 10
Serial.write(" Temp is: “);
Serial.print(fTemp);
Serial.write(” Celsius ");
count=0;
}
}
}
}