## Sunday, February 16, 2014

### Making It Easier For Heavy People To Pedal Up Hills

In bicycle racing, big guys win the sprints on the flat because they have more power and the slight increase in rolling resistance from the extra weight doesn't use much power. The climbers however, are always tiny because human power output doesn't increase proportionally with weight even when the extra weight is all muscle. For many non racers that extra weight is mainly fat which is always a hindrance. They may be able stay with their colleagues on the flat but on a hill they'll be dropped. The usual (and best) strategy is to lose the fat but another solution is to use some assist to carry the extra load up the hill. People sometimes spend thousands of dollars to carry just one or two kilos less bicycle weight up hills and a little assist would be a cheaper alternative.

The goal is to make hills as easy to climb for heavy people as light people or alternatively to make hills less steep even to the point of requiring the same effort as riding on the flat. Say you weigh 90 kg but your riding colleagues way 70 kg and have expensive bikes that are 3 kg lighter. You want enough extra power to carry 23 kg up the hill so you can keep up with them. If you add enough power to carry your weight plus the bike weight, perhaps 12 kg, equating to 102 kg in the example case, then riding up a hill will feel the same as riding on the flat.

The extra power to achieve this is supplied by a motor and to know how much power to request from the motor requires knowing the weight of the rider, the weight of the bike, the speed of the bike and the grade of the hill. Three of these parameters are easily determined but the grade is more difficult.

Barometers can measure height change without calibration using the hypsometric equation. Constant temperature can be assumed to remove the need for a temperature sensor. This increases error but eliminates error due to inaccurate temperature sensing. Air temperature sensing is difficult because the sun can heat the sensor housing. A change in sunlight levels from cloud or sun direction as the bike changes direction can cause the housing to change temperature while external air temperature remains the same.

Measuring grade requires the change in pressure to measure the height change plus the distance travelled between pressure measurements to get the grade. This is how the IpBike app estimates grade. Normally distance is measured using wheel revolutions but I think it will use GPS distance in the absence of wheel sensors. So a barometer would do the job except that you need a reasonable height change which takes a while on a grade. This would mean no help from the motor at the start of the hill and extra motor power after the hill had already passed.

Alternatively an accelerometer can measure the grade with a fast response. This overcomes the problems of the barometer but introduces more. An accelerometer will respond to changes in speed as well as grade. Braking will look like descending and reduce assist and accelerating will increase assist which is  good because the motor will also compensate for the heavier rider during acceleration. Longitudinal vibration will be sensed and may require a little low pass filtering. A single axis accelerometer has to be aligned with the direction of motion and be perpendicular to gravity but this is not practical to do. The readings from a three axis accelerometer can be rotated to match this alignment:-

$$$$Acceleration_T = a(A_x- K_a)+b(A_y- K_b)+c(A_z- K_z)$$$$ where $$$$\text{Acceleration_T}\\$$$$ is acceleration in the direction of travel, $$$$\text{K_a, K_b and K_z}\\$$$$are accelerations due to gravity in the particular axis direction, $$$$\text{A_x, A_y and A_z}\\$$$$ are measured accelerations and $$$$\text{a, b and c}\\$$$$ are the components of a unit vector in the direction of travel in the coordinate system of the accelerometer.
$$$$\text{K_a, K_b and K_z}\\$$$$ are calculated as the average of a three axis accelerometer over a long enough period while riding. They can be calculated as a moving average over a period of minutes while travelling faster than 10 km/h but will gradually rotate when climbing a hill to match the grade.

Lifting the front of the bike while stationary so that it rotates through about 30-45 degrees and sampling the accelerometers will give a second vector. Taking the cross product of this and the gravity vector defines an axis about which the bicycle rotates when it climbs a hill. This measurement and calculation should only need to be done once as a slight change in sensor rotation about the bike's vertical axis will produce only a small error in the final result. Taking the cross product of the rotation axis with the gravitational vector gives a third vector normal to the other two and therefore in the direction of travel. The scaler components of this vector after normalising provides the values $$$$\text{a, b and c.}\\$$$$ Using Newtons second law, the force required to counteract this acceleration along the grade produced by gravity is:-
$$$$F= m \times Acceleration_T$$$$ where $$$$\text{m}\\$$$$ is the mass we wish the motor to carry up the hill and the power required to do it is calculated as $$$$Power = F \times Speed$$$$ Motor power controlled with this sensor would give immediate help at the start of a grade but in a long hill the power would fade over time.

The barometer is slow to respond but more accurate over time and the accelerometer that self calibrates is responsive but inaccurate over time. Fusing the two sensor outputs gives the best result and this can be done with a simple complementary filter or kalman filter . The assumption that the measurements are corrupted by stationary white noise produces a stationary kalman filter that is identical in form to the complementary filter according to a comparison of complementary and kalman filtering for combining measurements of vertical acceleration and barometric vertical velocity to obtain an estimate of vertical velocity.

In inertial measurement units gyroscopes are often used for sensing rotation but for this case do not add useful grade information.