# Domotic - Help us hack the GR101

This post
explains from what, how, and why, I made the following Google spreadsheet.

The purpose of the spreadsheet is to help the community to find how to get
information as %water and %fat from the GR101 data packet.

For me, all is starting with this French post, discussing of the Oregon GR101 data packet. The Oregon GR101 is a scale measuring your weight but also the body fat percentage and body water percentage. It is possible to receive the data packet send by the scale to the screen with the RFXCOM. So it should be possible to automatically save the data on your computer… This point seems really domotic and exciting…. But it’s seems to be not so easy to get all working, as always. Everybody working on this packet seems only to be able to find how to get the Weight from it…. Not the % of Water and the % of Fat. (Note: as the time of this post writing I don’t have personally the GR101, but I am really thinking about this purchase…. And more and more if we are able to decode all the data from the gr101 packet!)

## All is Bioelectric Impedance Analysis.

After some research on Internet, I think that I found the formula that could be used by the Oregon gr101. In fact, the formula takes the same input that the Oregon console Screen: Stature, Age, Sex, and Resistance. The 3 first input are given by the user to the screen. The last one, the resistance should be the data send by the scale to the screen. The Bioelectric Impedance Analysis concept and this formula are well explained in the lesson 3 and the lesson 4 of this link: http://nutrition.uvm.edu/bodycomp/bia/bia-toc.html.

Here the formulas found in this website:

```
```**TBW** = 0.372(**S**²/**R**) + 3.05(**Sex**) + 0.142(**W**) - 0.069(**Age**)

TBW = Total Body Water (kg)

S = Stature (cm)

R = Resistance

W = Weights (kg)

Sex = 1 for men, 0 for Women

Age = age !

Fat Free Mass(kg): **FFM** = **TBW**/0.73

0.73 is the hydration constant of the Fat Free Mass

FAT MAS: **FM** = Weight - **FFM**

## Analyzing the GR101 data packet

To Get
data, we need to take the GR101 data packet octet in reverse order (little
endian <-> big endian problem ?).

For example, the packet** 4063F1C17509AAC430**
gives **30 C4 AA 09 75 C1 F1 63 40**.

Here, we are able to cut the different octet to find useful data:

- 30C : CRC ?
- 4AA0 : seems to be the data used to get the resistance
- 975C: this is the data used to get the weight.
- 1F1: ??? constant ???
- 63: cyclic constant ?
- 40: Length (in bits)

Maybe this cut is not correct (actually, the only ok section is the weight)

We think
that the resistance is at this place because DaRkYoda tried to put a wire
between the two electrodes of his scale. In this case, these four octets were
at 0, and Error was displaying on the screen….

For information to get the weight from the transmitted data, you need o know that
maximum weight is 163,5kg. This is the weight shows when FFFF is transmitted.
So the weight is computed with:

```
Weight = (decimal
transmitted value) * 163.5 / 65536
```

## The Spreadsheet

What you need to fill is only the yellow cell:

__Input information:__stature, sex, age.__Output information:__Weight, %fat, %Water, Data Packet received by RFXCOM.

The Other cells are computed from these one:

- Format
& Compute Output Section :
- TBW (Total Body Water) (kg) : = %Water * Weight / 100
- Fat % from TBW : used to check formula to get
Fat% from TBW, we should found the %Fat given by the GR101. The formula used is
:

`%Fat = ((Weight – (TBW/0.73))/Weight)*100`

- Res
to found: with the TBW formula in inverse order, calculate the corresponding
resistance... It is this one that should be found in the packet. The formula found
is:

`R = (0.372 * S²)/(TBW – 3.05(Sex) – 0.142(Weight) – 0.069(Age))`

- Inversed Packet Order (we need to inverse packet to work on... little endian <-> big endian problem)

- Data
Packets Section (the octet definition that we found in the inversed packet)
- CRC?: Maybe it is the CRC or something like that, need to find how to compute it from other octet
- Res?: Normally this is the four octets used to transit the data used to get the resistance. It is here that we got the four 0 when a wire was used between the electrode.
- Weight: The data used to get the weight and it is true!
- ?? : A constant?
- ?? : A cyclic number?
- Length : the length of the packet, in bit

- Decimal Value Section (Decimal value of the corresponding column of Data Packet Section)
- Compute
Section (Compute Decimal Value to get the final value)
- Res: we don't know yet how to get it.... this is the purpose of this document !
- Weight:
to get it, you need to know that the maximum weight for gr101 is 163,5kg. The
maximum number transmit in the packet is FFFF. So the weight is computing by:

`(decimal packet value) * 163.5 / 65535`