Hi,
I’ve got an old exercise bike (ergometer) that I’m trying to build a new interface for. The bike is an old Precor C846, it works ok, but it only displays a single metric at a time i.e. pedal speed, OR power OR distance OR time OR calories.
My interface is pretty simple, but it has a 2x20 LCD display that can show all the data at the same time. I haven’t actually hacked the old bike, I’ve just added my own hall probe to the flywheel (to pick up the pedal speed) and added a button to allow me to set the resistance level to match that of the bike. The power is calculated from a map() function to replicate that shown on the ergometer.
My problem is that I can get all my metrics to exactly match those of the exercise bike except for calories consumed. If I set the bike to ‘rpm’ then the figure matches what my unit gives, if I set the bike to ‘power’, the figure also matches my unit, and the same for time, distance and heartrate.
The difference comes with working out the total calories consumed in an exercise session.
I can work out the energy used (joules) from the following…
// work out the joules used so far. A joule is the work required to produce 1 watt for 1 second.
if ((millis() - ts5) >= millisBtwnJoule)
{
// power is an integer (typically 220 watts), joule is an long and millisBtwnJoule is an integer
joule = joule + long((long)((long)power*(long)millisBtwnJoule)/1000L);
//Serial.print("power=<");Serial.print(power);Serial.print(">, joule=<");Serial.print(joule);Serial.println(">");
ts5 = millis(); // timestamp the moment the Joules used was calculated.
}
The figure for joules seems to be exactly what I expect. 1 watt is one joule per second, so if I pedal at 200watts for 10 seconds I use 2000 joules.
There’s a simple conversion factor to get calories…
const float cf4 = 0.000239006; // conversion factor for converting joules to calories (1 joule = 0.000239006 kilocalories)
// for base unit's I'm sticking with SI units for power & energy (i.e. watts and Joules), for display
// purposes will use calories instead for comparison with the exercise bike
calories = (int)((float)joule*(float)cf4);
//Serial.print("calories=<");Serial.print(calories);Serial.println(">");
The problem is that I just can’t get my figure for calories to match that shown on the exercise bike. I can get an exact match for pedal speed and power, but the exercise bike shows me using nearly 4 times a many calories as my unit calculates. At this point I’m not asking for a code fix, I’m asking for a sanity check on my understanding of energy and power and the relationship between them. Is the principle of what I’m doing about right?
The calorie figures the exercise bike displays do seem to approximately match what I see on other bikes when I do a similar training session at the gym, so I don’t think there’s a problem with it. But I know my power matches the power the bike shows, and the relationship between power and calories should be so simple that I can’t figure where I can have gone wrong.