Image
image
image
image


Design Articles

Personal Training: 32 Bits at a Time

Thanks to GPS, multiple sensors and 32-bit MCUs, personal training devices are no longer just data loggers but onboard computers.

By Aaron GL Podbelski, Cypress Semiconductor Corp.

As 32-bit microcontrollers become more prevalent and affordable, device manufacturers are coming up with new means to utilize the added horsepower. An example of this is a personal training device that a runner can strap to their arm to determine the amount of calories expended, total distance traveled, and total vertical feet climbed. These devices have traditionally been data mining devices which relied on an application running on a personal computer to analyze the data and return the runnerís performance results. Now, by utilizing 32-bit microcontrollers designers are able to efficiently perform the necessary on-board calculations to give athleteís direct and immediate feedback to motivate and enhance the workout.

Sensor-Based Architecture

figure 1

Personal fitness devices are used by runners to track their performance, a function which requires the use of multiple sensors. Figure 1 shows a typical architecture for such a device. Utilizing a pressure sensor, heat flow sensors, and a GPS subsystem, a personal fitness device can accurately determine the total distance traveled, vertical feet traveled, incline angles, and calories burned during a run. An LCD screen can be used to supply an athlete with real time information, and audio cues can be given to announce progress. Finally, a USB connection allows the runner to connect and download information to a PC to track performance over a period of time.

When selecting the sensors, the designer has the choice of selecting analog or digital sensors. The trade-offs between analog and digital are that analog sensors are lower in cost but require the designer to perform signal conditioning, typically implemented with discrete components. Digital sensors, on the other hand, are higher in cost but allow a direct connection to an MCU. A third alternative is to use a processor with mixed-signal capabilities. Such processors allow for a direct connection to analog sensors by implementing signal conditioning in a programmable mixed-signal array. No additional external components are required, resulting in a smaller PCB and the ability to use lower cost sensors.

Once a sensor’s signal is quantified, the data must be massaged to provide the proper metrics for the runner, and this is where 32-bit microcontrollers outperform their 8-bit counterparts since the math required to transform raw sensor data into the metrics an athlete cares about are compute intensive. Traditional 8-bit MCUs are not designed to perform intensive calculations involving data that is 16 or 32 bit in length. They can perform such calculations by executing multiple, smaller calculations that also require the use of bulky libraries. These calculations take exponentially more cycles to perform, forcing the processor to must stay awake longer and, as a consequence, consume more power.

32-bit MCUs, like those utilizing a core such as a Cortex-M3, have specialized hardware that allows them to perform single-cycle 32-bit multiplication and 32-bit division in 2 to 12 cycles. While a 32-bit MCU does have a higher active current than an 8-bit MCU, it can more power efficiently come out of sleep mode to sample all the sensors and calculate the necessary data in a fraction of the time than an 8-bit MCU can, allowing a lower power design as shown in Figure 2.

figure 2

Transforming Sensor Data

Determining the number of calories a runner burns requires specialized sensors that measure the amount of heat a body gives off via conductive, radiant, convective, and evaporative means. Since during exercise a runner would lose heat primarily through sweating, we can assume most of the heat loss is done through evaporative means and therefore only a single sensor type is required.

The temperature in degrees above the normal body temperature is measured by the sensor which then outputs an analog mV signal proportional to temperature. This signal must be amplified by an OpAmp or a PGA, then quantified by a high-precision ADC. Using a 20-bit Delta Sigma ADC, for example, will provide more accurate results than the 8- or 10-bit ADC found on many microcontrollers.

Figure 3 shows the signal conditioning required to capture the signal from a mV output sensor. Using a programmable mixed-signal array, rather than working with a fixed set of digital peripherals, developers can configure Universal Digital Blocks (UDBs) into a wide range of digital peripherals, including PWMs, counters, timers, look-up tables, and state machines, as well as communications such as UART, SPI, I2S, I2C, etc. Analog components can be configured into many configurable peripherals such as a 20-bit Delta Sigma ADC, SAR ADCs, DACs, OpAmps, and comparators as well as programmable analog blocks which can be configured into PGAs, TIAs, mixers, and sample and hold circuits. These analog and digital blocks are wrapped by a MUX which allow peripherals to connect to each other in any manner, as well as allow any signal to be routed to any GPIO pin. Configuration can be done using preconfigured components laid out using a graphical schematic tool.

Depending on how noisy the signal is, filtering may also be required. Once the data is quantified, it is converted into calories using the following equation:

q = mcΔT
where q: energy
m: mass
c: specific heat
ΔT: change in temperature

This calculation requires several >16-bit multiplications.

figure 3

The GPS sensor in a personal fitness device is used to track the runner’s path and total distance traveled. By providing the runner’s coordinates and correlating them over time, the runner’s velocity and total distance traveled can be calculated. As all GPS sensors output digital data rather than an analog signal, the sensor interfaces with the controller via SPI or I2C. Thus, the microcontroller will need to be able to support both analog and digital inputs. The controller can have dedicated inputs or, in the case of a mixed-signal array, have configurable inputs which can be either analog or digital as required. In addition, components in the array can be selected to support the appropriate communication protocol (SPI, I2C, or other interface).

As the data is received, the device needs to calculate the distance between the previous and current coordinates. This is done using the Haversine formula:

d = 2R arcsin(√(sin2((\varphi \,1-\varphi \,2 )/2)+cos(\varphi \,1)cos(\varphi \,2) sin2((Δλ)/2)
where d: distance
R: radius of Earth
\varphi \,1: lattitude 1
\varphi \,2: lattitude 2
Δλ: change in longitude

The calculations required by the Haversine formula are multiplicatively heavy, and require floating point arithmetic, something 32-bit devices can perform well. An 8-bit MCU would require too much time and power to calculate distance, rendering it infeasible for the design.

GPS-based distance calculations do have a limitation, however, as they are only accurate as long as the terrain is flat. By using an absolute pressure sensor in conjunction with a GPS, the device can measure the amount of vertical feet traveled and therefore more accurately determine the total distance traveled.

To achieve this, an analog pressure sensor outputs a mV signal similar to the heat flow sensor. The signal conditioning circuit will be identical to Figure 3 although the settings for the OpAmp/PGA and filter will be different based on the sensor model chosen. Once the data is qualified, the pressure needs to be converted to an altitude using the following formula:

Altitude = (1-(P/atm)^( γR/g))C
P: pressure
Atm: standard atmospheric pressure at sea level
γ: lapse rate
R: gas constant
g: gravity
C: 145366.45

Again, the calculations required to calculate the altitude in feet (vertical feet traveled) are multiplication and division heavy, requiring the efficiency of a 32-bit MCU. The vertical feet traveled can be correlated with the horizontal distance calculated from the GPS sensor and the actual distance can be calculated. This is done by calculating the hypotenuse as shown in Figure 4 using the Pythagorean Theorem.

figure 4

Personal fitness devices using 8-bit MCUs work just fine as data mining devices that track an athlete’s workout, but they can only be passive devices that collect limited data and must be connected to a computer to calculate any metrics. By using 32-bit MCUs, personal fitness devices can operate in real time, providing an athlete running updates during a workout. Such direct and immediate feedback allows an athlete to push him or herself harder and get more out of the workout. In addition, by selecting a processor with programmable mixed-signal capabilities, applications can use low-cost analog sensors for integrated signal conditioning while also flexibly supporting digital sensors. In this way, designers can design devices that are robust, compact, significant reduce power consumption, and are ultimately more efficient and less expensive.

Cypress Semiconductor
San Jose, CA
(408) 943-2600
www.cypress.com

Bookmark and Share


Insert your comment

Author Name(required):

Author Web Site:

Author email address(required):

Comment(required):

Please Introduce Secure Code:


image
image