Oregon Scientific GR101

From MiOS
(Difference between revisions)
Jump to: navigation, search
m (Limitations)
 
(9 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
[[Category:Hardware]]
 
'''Before jumping on the bandwagon, PLEASE read the section 'Limitations'.'''
 
'''Before jumping on the bandwagon, PLEASE read the section 'Limitations'.'''
  
Line 92: Line 93:
 
== Limitations ==
 
== Limitations ==
  
RFXCOM claims that the RFXtrx does support the GR101 (weight only), but at least for my GR101 my RFXtrx (firmware v50) doesn't get the weight right.  
+
<strike>RFXCOM claims that the RFXtrx does support the GR101 (weight only), but at least for my GR101 my RFXtrx (firmware v50) doesn't get the weight right (I'm not the only one: http://board.homeseer.com/showpost.php?p=1021084&postcount=5).  
Workaround: None - please request a bugfix from FRXtrx if affected.
+
Workaround: None - please request a bugfix from FRXtrx if affected.</strike> Fixed according to http://www.rfxcom.com/RFXtrx433.htm
  
RFXCOM's RFXtrx currently (firmware v50) does not support the decoding of the impedance.
+
RFXCOM's RFXtrx currently (firmware v51) does not support the decoding of the impedance. Therefore, the GR101 plugin cannot currently calculate percentage body fat and percentage body water. Workaround: None - please request it as a feature from RFXCOM if interested.
Workaround: None - please request it as a feature from RFXCOM if interested.
+
  
 
Tanita's formulas might be patented. Therefore, the plugin for the GR101 is only available as DIY-ware: You have to insert the  formulas of your choice into the plugin yourself ...
 
Tanita's formulas might be patented. Therefore, the plugin for the GR101 is only available as DIY-ware: You have to insert the  formulas of your choice into the plugin yourself ...
Line 121: Line 121:
 
GR101 DIY plugin (in I_GR101.xml, modify the two lines containing ****** ):
 
GR101 DIY plugin (in I_GR101.xml, modify the two lines containing ****** ):
  
https://docs.google.com/open?id=0Bz4omZm4gYcsTGpIZ2c3ekNBd1U
+
https://docs.google.com/file/d/0Bz4omZm4gYcsSTBQRmZSb2U2dEU/edit?usp=sharing
 
+
  
 
== Installation ==
 
== Installation ==
 +
 +
<source lang="text">
 +
Variables to configure:
 +
 +
ScaleSensorID            device id of RFX Weight WT device to watch
 +
TriggerOnWeightChange    1: watch for weight changes instead of impedance changes
 +
WeightMin         only watch for weights in [ WeightMin .. WeightMax ]
 +
WeightMax only watch for weights in [ WeightMin .. WeightMax ]
 +
Height         your height
 +
Sex         your sex (0: female, 1: male)
 +
Asian         1: Asian (affects BMI_HUF only)
 +
AfricanAmerican 1: AfricanAmerican (if set to 1, results may differ from the values on the remote display)
 +
BirthYear your year of birth (YYYY)
 +
BirthMonth your month of birth (1-12)
 +
BirthDay your day of birth (1-31)
 +
 +
Output variables:
 +
 +
LastUpdate last update of variables (Unix timestamp)
 +
Weight         measurement
 +
BMI         Body Mass Index
 +
BMI_HUF         Body Mass Index Human Understandable Format (HUF) (adults only)
 +
Fat         percentage body fat
 +
Fat_HUF         percentage body fat HUF (adults only)
 +
Water         percentage body water
 +
Water_HUF                percentage body water HUF
 +
 +
</source>
 +
  
 
[[File:GUI1.jpg]]
 
[[File:GUI1.jpg]]
  
[[File:GUI2.jpg]]
+
[[File:GUI2.jpg|400px]]
 +
 
 +
[[File:GUI3.jpg|400px]]
 +
 
 +
[[File:GUI4.jpg|400px]]
 +
 
 +
== Let your scale talk to you ==
 +
 
 +
<source lang=text>
 +
 
 +
Additional requirements:
 +
Logitech Media Server and player
 +
 
 +
Installation:
 +
Create a new scene with trigger 'Weight goes above 0' for your RFX device (not for the GR101 device)
 +
and copy the following Luup code into the Luup window of your scene and adjust
 +
LMS_adress, LMS_port, player_MAC and RFX_scale_device_id (don't foget to Save the Luup code):
 +
 
 +
local player_MAC = '00:04:20:xx:xx:xx'
 +
local LMS_port = 9090
 +
local LMS_address = '192.168.x.y'
 +
 
 +
local RFX_scale_device_id = 204
 +
 
 +
local weight = luup.variable_get( 'urn:micasaverde-com:serviceId:ScaleSensor1', 'Weight', RFX_scale_device_id )
 +
 
 +
function SBS_Say( SBS_ip          ,  -- IP address of SBS
 +
                  SBS_port        ,  -- CLI Port of SBS (default: 9090)
 +
                  player_id      ,  -- MAC address of player
 +
                  message1        ,  -- line 1
 +
                  message2        ,  -- line 2
 +
                  message_duration,  -- in seconds
 +
                  file            ,  -- audio announcement
 +
                  file_duration  ,  -- duration of announcement in seconds
 +
                  repeats          ) -- number of announcements
 +
 
 +
local socket=require('socket')
 +
local client = socket.connect( SBS_ip, SBS_port )
 +
 
 +
function SBS_CLI( cmd )
 +
 
 +
  client:send( cmd .. '\n' )
 +
  return client:receive()
 +
 
 +
end -- SBS_CLI
 +
 
 +
if ( message1 ~= '' ) and ( message1 ~= nil )
 +
  then
 +
 
 +
  SBS_CLI( player_id .. ' display ' .. tostring(message1) .. ' ' .. tostring(message2) .. ' ' .. tostring( message_duration ) )
 +
  luup.sleep( message_duration * 1000 )
 +
  end
 +
 
 +
if ( file ~= '' ) and ( file ~= nil )
 +
  then
 +
 
 +
  -- Save current state of player
 +
 
 +
  local cur_power    = SBS_CLI( player_id .. ' power ?'            )
 +
  local cur_track    = SBS_CLI( player_id .. ' playlist index ?'  )
 +
  local cur_offset    = SBS_CLI( player_id .. ' time ?'            )
 +
  local cur_mode      = SBS_CLI( player_id .. ' mode ?'            )
 +
 
 +
  -- Add announcement file to playlist
 +
 
 +
  local playlist_add = SBS_CLI( player_id .. ' playlist add ' .. file )
 +
  local tracks      = SBS_CLI( player_id .. ' playlist tracks ?'            )
 +
 
 +
  tracks = tonumber( string.match( tracks, '%s(%d+)' ) )
 +
 
 +
  -- Play announcement
 +
 
 +
  for i = 1,repeats
 +
    do
 +
    local playlist_set = SBS_CLI( player_id .. ' playlist index ' .. tracks-1 )
 +
    luup.sleep( file_duration * 1000 )
 +
    end
 +
 
 +
  -- Restore previous state of player
 +
 
 +
  local playlist_del = SBS_CLI( player_id .. ' playlist delete ' .. tracks-1 )
 +
  local playlist_set = SBS_CLI( cur_track  )
 +
  local time_set    = SBS_CLI( cur_offset  )
 +
  local mode_set    = SBS_CLI( cur_mode    )
 +
  local power_set    = SBS_CLI( cur_power  )
 +
 
 +
  end
 +
 
 +
client:close()
 +
 
 +
end -- SBS_Say
 +
 
 +
SBS_Say( LMS_address              ,
 +
        LMS_port                ,
 +
        player_MAC              ,
 +
        'Weight'                ,
 +
        tostring(weight)..'%20kg',
 +
        2                        ,
 +
        'http://translate.google.com/translate_tts?tl=en&q=Your+weight+is+'..tostring(weight)..'+kg',
 +
        5                        ,
 +
        1                          )
  
[[File:GUI3.jpg]]
+
function zero()
 +
luup.variable_set( 'urn:micasaverde-com:serviceId:ScaleSensor1', 'Weight', '0', RFX_scale_device_id )
 +
end
  
[[File:GUI4.jpg]]
+
luup.call_delay( 'zero', 10, '' )
 +
</source>
  
 
== Further reading ==
 
== Further reading ==
  
 
tbc
 
tbc

Latest revision as of 03:15, 15 June 2013

Before jumping on the bandwagon, PLEASE read the section 'Limitations'.

Disclaimer: DO NOT BASE YOUR DECISIONS ON DATA FROM THIS PLUGIN! IF IN DOUBT ABOUT YOUR HEALTH STATE, CONSULT YOUR PHYSICIAN.

Contents

[edit] Product information

http://au.oregonscientific.com/cat-Sports-and-Health-sub-Body-Weight-Scales-prod-Digital-Scale-with-Body-Mass-Index-and-Remote-Display-unit.html

[edit] Manual

http://au.oregonscientific.com/ulimages/manuals2/GR101.pdf

[edit] Research

 Hacking the GR101 revisited (see [0]) or: 
 How to convert the raw impedance reading from a GR101 to percentage body fat and percentage body water - by Ap15e
 
 
 Definitions:
 
 raw_impedance: data from GR101
 BD           : Body Density [kg/m^3]
 FFM          : Fat Free Mass [kg]
 Wt           : Weight [kg]
 Ht           : Height [cm]
 Z            : Impedance [ohm]
 %fat         : percentage body fat [%]
 %water       : percentage body water [%]
 
 
 Constants (best fit to formulas for data from a spreadsheet publicly available, see [1])
 
 impedance_factor = 39.198
 hydration        = 0.728895
 
 
 Formulas for males and females
 
 Z = raw_impedance / impedance_factor
 %water = ( Wt - %fat / 100 x Wt ) x hydration / Wt x 100
 
 
 Formulas for males
 
 BD = 1.100696 - 0.107903 x Wt x Z/Ht^2 + 0.00017 x Z [Tanita Corporation, see [2]]
 %fat = ( 4.57 / BD - 4.142 ) x 100                   [Brozek, see [3]]
 
 Additional formulas for percent body fat:
 
 %fat = ( 4.95  / BD - 4.5   ) x 100                  [Siri, see [3]]
 %fat = ( 4.374 / BD - 3.928 ) x 100                  [Schutte; for African-Americans, see [3]]
 %fat = ( 4.86  / BD – 4.39  ) x 100                  [Wagner]
 
 
 Formulas for females
 
 FFM = 13.96674 + 0.348613 x Ht^2/Z + 0.168998 x Wt   [Tanita Corporation, see [2]]
 %fat = ( Wt - FFM ) / Wt x 100
 
 
 Notes
 
 The formulas for males (Brozek) match the values on the remote display to a high degree 
 (error is < 0.5% for %fat and < 0.3% for %water for the data from the spreadsheet).
 
 The formulas for females yield higher errors. There is insufficient data in the spreadsheet 
 for further analysis.
 
 
 References
 
 [0] http://www.fabienletort.com/blog/2008/domotic-help-us-hack-the-gr101.html
 
 [1] http://spreadsheets.google.com/ccc?key=pQy-b-0ho4QdU4ecNy0TLLg&hl=fr
 
 [2] Jebb SA, Cole TJ, Doman D, Murgatroyd PR, Prentice AM.
     Evaluation of the novel Tanita body-fat analyser to measure body composition by comparison with a four-compartment model.
     Br J Nutr. 2000 Feb;83(2):115-22.
     PMID:10743490
     Abstract: http://www.ncbi.nlm.nih.gov/pubmed/10743490
     Full text: http://journals.cambridge.org/abstract_S0007114500000155
     NOTE: The unit of measure for the height in the formula for body density is cm, not m.
 
 [3] The Process of Physical Fitness Standards Development 
     Full text: http://www.dtic.mil/cgi-bin/GetTRDoc?AD=ADA495349


[edit] Limitations

RFXCOM claims that the RFXtrx does support the GR101 (weight only), but at least for my GR101 my RFXtrx (firmware v50) doesn't get the weight right (I'm not the only one: http://board.homeseer.com/showpost.php?p=1021084&postcount=5). Workaround: None - please request a bugfix from FRXtrx if affected. Fixed according to http://www.rfxcom.com/RFXtrx433.htm

RFXCOM's RFXtrx currently (firmware v51) does not support the decoding of the impedance. Therefore, the GR101 plugin cannot currently calculate percentage body fat and percentage body water. Workaround: None - please request it as a feature from RFXCOM if interested.

Tanita's formulas might be patented. Therefore, the plugin for the GR101 is only available as DIY-ware: You have to insert the formulas of your choice into the plugin yourself ...

[edit] Requirements

[edit] Hardware

Vera (UI5)

RFXtrx433

Oregon Scientific GR101

[edit] Software

RFXtrx Gateway plugin (rev. >= 39): http://code.mios.com/trac/mios_rfxtrx

GR101 DIY plugin


[edit] Downloads

GR101 DIY plugin (in I_GR101.xml, modify the two lines containing ****** ):

https://docs.google.com/file/d/0Bz4omZm4gYcsSTBQRmZSb2U2dEU/edit?usp=sharing

[edit] Installation

Variables to configure:
 
ScaleSensorID            device id of RFX Weight WT device to watch
TriggerOnWeightChange    1: watch for weight changes instead of impedance changes
WeightMin	         only watch for weights in [ WeightMin .. WeightMax ]
WeightMax		 only watch for weights in [ WeightMin .. WeightMax ]
Height		         your height
Sex		         your sex (0: female, 1: male)
Asian		         1: Asian (affects BMI_HUF only)
AfricanAmerican		 1: AfricanAmerican (if set to 1, results may differ from the values on the remote display)
BirthYear		 your year of birth (YYYY)
BirthMonth		 your month of birth (1-12)
BirthDay		 your day of birth (1-31)
 
Output variables:
 
LastUpdate		 last update of variables (Unix timestamp)
Weight		         measurement
BMI		         Body Mass Index
BMI_HUF		         Body Mass Index Human Understandable Format (HUF) (adults only)
Fat		         percentage body fat
Fat_HUF		         percentage body fat HUF (adults only)
Water		         percentage body water
Water_HUF                percentage body water HUF


GUI1.jpg

GUI2.jpg

GUI3.jpg

GUI4.jpg

[edit] Let your scale talk to you

Additional requirements:
Logitech Media Server and player
 
Installation:
Create a new scene with trigger 'Weight goes above 0' for your RFX device (not for the GR101 device)
and copy the following Luup code into the Luup window of your scene and adjust 
LMS_adress, LMS_port, player_MAC and RFX_scale_device_id (don't foget to Save the Luup code):
 
local player_MAC = '00:04:20:xx:xx:xx'
local LMS_port = 9090
local LMS_address = '192.168.x.y'
 
local RFX_scale_device_id = 204
 
local weight = luup.variable_get( 'urn:micasaverde-com:serviceId:ScaleSensor1', 'Weight', RFX_scale_device_id )
 
function SBS_Say( SBS_ip          ,   -- IP address of SBS 
                  SBS_port        ,   -- CLI Port of SBS (default: 9090)
                  player_id       ,   -- MAC address of player
                  message1        ,   -- line 1
                  message2        ,   -- line 2
                  message_duration,   -- in seconds
                  file            ,   -- audio announcement
                  file_duration   ,   -- duration of announcement in seconds
                  repeats           ) -- number of announcements
 
 local socket=require('socket')
 local client = socket.connect( SBS_ip, SBS_port )
 
 function SBS_CLI( cmd )
 
  client:send( cmd .. '\n' )
  return client:receive()
 
 end -- SBS_CLI
 
 if ( message1 ~= '' ) and ( message1 ~= nil )
  then
 
   SBS_CLI( player_id .. ' display ' .. tostring(message1) .. ' ' .. tostring(message2) .. ' ' .. tostring( message_duration ) )
   luup.sleep( message_duration * 1000 )
  end
 
 if ( file ~= '' ) and ( file ~= nil )
  then
 
   -- Save current state of player
 
   local cur_power     = SBS_CLI( player_id .. ' power ?'            )
   local cur_track     = SBS_CLI( player_id .. ' playlist index ?'   )
   local cur_offset    = SBS_CLI( player_id .. ' time ?'             )
   local cur_mode      = SBS_CLI( player_id .. ' mode ?'             )
 
   -- Add announcement file to playlist
 
   local playlist_add = SBS_CLI( player_id .. ' playlist add ' .. file )
   local tracks       = SBS_CLI( player_id .. ' playlist tracks ?'            )
 
   tracks = tonumber( string.match( tracks, '%s(%d+)' ) )
 
   -- Play announcement
 
   for i = 1,repeats
    do 
     local playlist_set = SBS_CLI( player_id .. ' playlist index ' .. tracks-1 )
     luup.sleep( file_duration * 1000 )
    end
 
   -- Restore previous state of player 
 
   local playlist_del = SBS_CLI( player_id .. ' playlist delete ' .. tracks-1 )
   local playlist_set = SBS_CLI( cur_track   )
   local time_set     = SBS_CLI( cur_offset  )
   local mode_set     = SBS_CLI( cur_mode    )
   local power_set    = SBS_CLI( cur_power   )
 
  end
 
 client:close()
 
 end -- SBS_Say
 
SBS_Say( LMS_address              , 
         LMS_port                 , 
         player_MAC               , 
         'Weight'                 , 
         tostring(weight)..'%20kg', 
         2                        , 
         'http://translate.google.com/translate_tts?tl=en&q=Your+weight+is+'..tostring(weight)..'+kg',
         5                        ,
         1                          )
 
function zero()
 luup.variable_set( 'urn:micasaverde-com:serviceId:ScaleSensor1', 'Weight', '0', RFX_scale_device_id )
end
 
luup.call_delay( 'zero', 10, '' )

[edit] Further reading

tbc

Personal tools