Introduction: Body Composition Analyzer
This project was created by Ameen Farwana and Mikail Siddiki for our Biomedical Instrumentation class at Vanderbilt University. We were assigned to build a body fat composition circuit using arduino. We sent an electrical current that is used to measure a difference in impedance between people with different fat compositions. The circuit itself uses three op amps, an instrumentation amplifier and an AD5933 chip that interfaces with the arduino code to output a real and imaginary value that is converted to an impedance, which is then combined with height and weight information to give a final fat composition. It is very difficult to measure body fat even with today's technologies due to differing levels of bone and muscle mass between individuals. Some methods that exist now along with bioelectrical impedance analysis are underwater weighing, whole-body air displacement plethysmography, near-infrared interactance, body average density measurement, BMI, and other anthropometric methods. The largest obstacle in this process was ensuring that the current that ran through the body was comparable and safe with human tissue. We followed our professors great advice of "try to get as much current until you start feeling tingling!" We strongly suggest that our young engineers not attempt building a fat composition circuit without supervision. Overall, we enjoyed the process of learning how to use arduino as well as watching our circuit grow from stage to stage slowly but surely.
TL 072 Op Amps x2
INA 182 Instrumentation Amplifier
Resistors (100,000 ohms, 1000 ohms)
Arduino with Micro USB cable
4 Leads with Pads
Step 1: Construct Circuit
This was the most intensive part of this project because as previously stated there were serious health considerations that had to be taken into account. Each part that is external to the AD5933 chip was tested multiple times to ensure that a current was not being produced above 10 microAmps which we determined to be a reasonable voltage based on research that we had found online. We first built the High Pass Filter and Transconductance Amplifier seen in the circuit diagram above, using a Function Generator to provide the voltage instead of the AD5933. The high pass filter with buffer composed a voltage follower using a 10^5 pF capacitor with a 1000 ohm resistor that was connected to the positive terminal. The negative terminal ran to the output. All descriptions of the circuit can be visually conceptualized using the circuit diagram we have above.
Immediately following the filter we have a voltage to current converter, as a current is necessary to run through the body. We also placed a 100,000 Ohm resistor in place of the body. We calculated the value of Rcurrent that was necessary to turn the supplied voltage into a 10 microAmp current, determining that it should be approximately 200,000 Ohms which feeds into the negative terminal of the second op amp. The TL072 has two op amps integrated into it which is why there are only two op amps visible in the picture of our circuit below despite the fact that 3 functional op amps were used. The negative terminal is also connected to the body using a lead in addition to the Rprotective resistor. Our Rprotective is set to be x15 the resistance of the body resistance; we used a 1,500,000 ohm resistor based on the assumption of a 100,000 ohm resistance of the body which we chose from research on typical body impedances in this capacity. We also chose to use a frequency sweep from 1000 Hz to 10,000 Hz, using a sine wave with amplitude of 2 V peak to peak with an offset to keep it positive. All op amps were set with +/-10 V rails.
The instrumentation amplifier that followed the voltage to current converter required a reference voltage that was created with another TL072 op amp. This reference voltage needs to be half of the current that is being inputed into the circuit. In our case 5 V is being put into the circuit forcing Vref to be 2.5 V. We used simple nodal analysis to find that in order to create 2.5 reference voltage our two resistors feeding into the op amp had to be equal. This V ref is fed into the instrumentation amplifier which adds this reference with the input voltage coming in from the body. The output of the instrumentation amplifier is followed by a 1000 ohm resistor which feeds into Pin 5 of our AD5933. This node also has an external feedback resistor (RFB) of 1000 ohms which is attached to the RFB Pin 4.
Once all of the circuit had been built and tested we finally added the AD5933 chip and powered the circuit with the Arduino. Pin 6 of this chip is Vout, and produces a 5V voltage which is used to power the circuit. Pins 4 and 5 were where the Rfeedback and Resistor of the instrumentation amplifier fed in, respectively. Pins 9, 10 and 11 are attached to the 5V source of the Arduino, 12, 13 and 14 are attached to ground, and pins 15 and 16 are attached to A4 and A5 of the Arduino respectively. The circuit was then tested with the 100k resistor in place of the body to make sure an impedance is being measured and the current is still safe to run through the body.
Finally, the leads are attached. The body has 4 leads connected to it, two of which are for current and two for voltage. One current and one voltage electrode was placed on the hand, and the remaining two were placed on the foot. The locations can be seen in the attached picture; leads 1 and 2 are current electrodes while 3 and 4 are the voltage electrodes.
Step 2: Computer-Circuit Interface
The next step was to connect our code with our circuit. In order to do this we used an Arduino board that connected to our AD5933. The SCL Pin which is our I2C clock input ran through a 4700 ohm resistor into the AD5 port on Arduino board as our SDA, the I2C data input, also ran through a 4700 ohm resistor in to the AD4 port of our Arduino. These resistors were push up resistors, which don't allow for the resistors to float somewhere between 0 and its true resistance. The AD5933 uses the 5V from the Arduino as well as the ground which is connected to the ground of the circuit to make sure that all grounds are the same. The Arduino makes our interface quite simple. We now move on to the code.
Step 3: Code
The Arduino code for this project uses many steps to get the final goal of a real and imaginary output. This real and imaginary output will then be put through a series of equations to get a final impedance which can be combined with height and weight to find the body fat composition. The code begins by defining the master, slave and bins for the AD5933. The bins are where the data is stored as the programs runs. We then set up a frequency sweep from 1000 Hz to 10000 Hz in intervals of 100 Hz, so that the measurements will be taken over this range of frequencies. Three commands (A, B and C) will run the program once it is turned on. Case A is run first and is intended to register the program. Case B is then initiated to measure the temperature of the chip; this temperature should come out to approximately 25 degrees Celsius. Overheating of the chip can cause inaccurate outputs, thus this temperature test is necessary to make sure nothing is wrong with the chip. Finally, case C runs the actual frequency sweep and outputs a real and imaginary register once the impedance levels. The rest of the code is for writing the data and delaying measurements appropriately. All of this code has been attached, the only section that needs to be adjusted is the “start_freq”, “incre_freq” and the “incre_num” to set the starting frequency, the size of the intervals and the number of intervals.
Step 4: Conversion to Percentage
In order to convert our output to our percentage we had to figure out a unity gain. This unity gain is determined by using an impedance of a known voltage along with the output magnitude determined by the output of our Arduino code. The unity gain is the magnitude divided by our known impedance, which is simply the resistor value used in the circuit in place of the body. Once we have this unity gain factor we can find an impedance of any individual being tested by using the gain and output magnitude of the circuit. These two pieces of information are combined with the height and weight of the individual and run through a MATLAB sequence of equations that gives a final fat percentage. The Matlab code used is attached, one must simply input the average Magnitude (calculated once the values seem to level out after 7,000 Hz in the frequency sweep), Height and Weight and you will get your body fat percentage!
We have a be nice policy.
Please be positive and constructive.