Jekyll2021-07-02T18:45:33+00:00http://metromotive.com/feed.xmlMetromotiveMetromotive BlogInertial Electric Assist2021-06-18T00:00:00+00:002021-06-18T00:00:00+00:00http://metromotive.com/blog/2021/06/18/Inertial-Electric-Assist<h2 id="motivation">Motivation</h2>
<p>I’m currently working on an ebike build, and <a href="https://www.bikepedia.com/QuickBike/BikeSpecs.aspx?item=16723">the bike that I’m using</a> has some quirks that make it difficult to fit a conventional bottom bracket torque sensor, or to add switches to the brake levers for activating regenerative braking (and such switches also only provide a single level of regenerative braking, rather than one that is proportional to the desired braking level).</p>
<p>Having done a lot of <a href="https://twitter.com/metromotive/status/1368745493912641540">thinking about acceleration in micromobility vehicles</a> recently, I came upon the idea of not actually measuring torque at all, but inferring it from other measurements. This was validated when a friend of mine mentioned a project that showed promising results from just such a scheme.</p>
<p>What follows is a combination of planning and specualtion for this build, but is also might generalizable to other vehicle types. If it works, it would provide a potentially cheaper alternative to conventional torque/force sensors while also providing proportional regenerative braking.</p>
<h2 id="background">Background</h2>
<p>An electric assist vehicle is one where an electric motor multiplies the effort of a human to propel the vehicle. That is to say it incorporates a controller that seeks to make \(F_{motor} = F_{human} \cdot gain\). This type of control scheme is extremely common for electric bicycles, as it provides a very intuitive way of controlling the motor’s output.</p>
<p>One of the difficulties in building an electric assist vehicle is measuring the human input in a way that is simple, reliable, and inexpensive. In the example of electric-assist bicycles, sensors typically measure pedal torque or chain tension, either directly or indirectly<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>. These sensors can be complicated—often requiring a rotating electrical signal to be connected to a non-rotating control system—and require careful calibration.</p>
<p>An alternative is to instead measure the acceleration of the vehicle using an inexpensive inertial measurement unit (IMU) circuit, and then measure, estimate, or be told the (gross) mass of the vehicle. Via Newton’s second law, we can arrive at the sum total of all of the forces acting on the vehicle. We then have to subtract all of the non-human forces applied to the vehicle to arrive at the human contribution to the propulsion force.</p>
<p>The forces acting on a typical vehicle will be force from the propulsion and braking system (\(F_p\)), resistance from friction (\(F_r\), proportional to the weight on the wheels), and resistance from whatever fluid the vehicle is moving through (\(F_d\), proportional to the square of velocity). The force of gravity also plays a role, but because an IMU measures gravity as part of the overall acceleration, we can ignore it for purposes of this discussion.</p>
<p>For an electric assist vehicle, we also want to decompose the propulsion force into the component provided by the motor (\(F_{motor}\)) and the part provided by the human (\(F_{human}\)), or requested by the human via their control over the friction brakes. So the overall equation is:</p>
\[am = F_{motor} + F_{human} + F_r + F_d\]
<p>Combining this with the basic equation of an electric assist vehicle, the desired force of the motor for the next time step can be calculated:</p>
\[F_{motor}' = gain \cdot (am - (F_r + F_d + F_{motor}))\]
<h2 id="variables-to-be-measured-or-estimated">Variables to be Measured or Estimated</h2>
<h3 id="acceleration">Acceleration</h3>
<p>The acceleration can be measured using an inexpensive IMU (inertial measurement unit) integrated circuit. These are available at single-digit-dollar prices and use a MEMS (micro electro-mechanical system) mechanism to measure the acceleration, typically on three orthogonal axes. More expensive units use gyroscopic devices to measure rotation rates, but that information may be unnecessary for our application.</p>
<p>The acceleration can also be measured by comparing successive measurements of speed from the vehicle’s motor controller. This provides a slightly different picture of acceleration, as gravitational acceleration doesn’t directly influence the measurement, which for this application is actually a bug rather than a feature.</p>
<h3 id="mass">Mass</h3>
<p>Measuring the mass of the vehicle is more complicated. On the one hand it is unlikely to change significantly over the course of a trip, and it may be acceptable to require the rider to manually input their mass (plus that of any cargo).</p>
<p>Another option is to instruct the user to briefly not apply any human input, and have the motor apply a known propulsion force while measuring the resulting acceleration.</p>
<p>Or the vehicle can be outfitted with strategically-placed load cells to measure the weight of the rider (along with that of some or all of the vehicle).</p>
<h3 id="motor-force">Motor Force</h3>
<p>Modern motor controllers as a matter of course measure (and sometimes control) the amount of current flowing to the motor. Using the motor current, the torque constant of the motor, and the radius of the wheel (along with any gear reduction), the force provided by the motor can be calculated very accurately.</p>
<h3 id="rolling-resistance-and-friction">Rolling Resistance and Friction</h3>
<p>The rolling resistance and friction present in a wheeled vehicle is fairly predictable, consisting of a coefficient multiplied by the normal force. The normal force, in turn is proportional to the mass (at least on a level surface—an angle measurement may be useful here).</p>
<h3 id="aerodynamic-drag">Aerodynamic Drag</h3>
<p>The aerodynamic drag of a vehicle is harder to predict, as it depends on the drag coefficient (which could vary based on the rider, their clothing, and their position), the local density of air, the wind speed and direction, and the square of vehicle speed relative to the wind.</p>
<p>Again, speed is straightforward to measure, and the apparent wind in the direction of travel can be measured by a relatively inexpensive anemometer, such as a Pitot tube connected to a differential pressure sensor. The local air density could potentially be measured as well (using a separate pressure absolute pressure sensor connected to the static port), but in practice it likely wouldn’t vary enough to matter.</p>
<p>The drag coefficient would likely have to be estimated at a fixed value, although it is possible that the vehicle could detect time periods when there is no human force input and calculate an estimate of the aerodynamic drag based on knowledge of the other forces acting on the vehicle.</p>
<h3 id="gravity">Gravity</h3>
<p>On level ground, gravity can be estimated to have zero effect, since it will be exactly cancelled out by the normal force from the ground.</p>
<p>However the force of gravity becomes significant when on an incline. Fortunately an IMU will capture gravitational acceleration as part of its overall acceleration measurement, so no additional calculation is required.</p>
<h3 id="human-inputs">Human Inputs</h3>
<p>What’s left are human-initiated force inputs. On an electric-assist vehicle, this will be something like pedaling or pushing along with braking using friction brakes.</p>
<p>Again, a number of systems exist to more directly measure human inputs, but it is also potentially feasible to calculate an estimate of human inputs by measuring acceleration and estimating and/or measuring all of the other forces acting on a vehicle along with its mass.</p>
<h2 id="the-control-loop">The Control Loop</h2>
<p>The controller for such as system should have inputs consisting of, at a minimum:</p>
<ul>
<li>A measurement of acceleration</li>
<li>An estimate or measurement of mass</li>
<li>The current passing through the motor</li>
<li>A desired gain factor for the amount of motor force to be applied for a given human force application</li>
</ul>
<p>This is sufficient to determine (at low speeds and on level ground) whether the motor current should be increased or decreased to keep the motor force equal to the human-input force multiplied by the desired gain.</p>
<p>The control loop can be enhanced with:</p>
<ul>
<li>An estimate of rolling friction (based on the mass)</li>
<li>An estimate of aerodynamic drag (based on the apparent wind speed, or the square of the motor speed assuming still air)</li>
</ul>
<p>On major enhancement would be the ability to detecting when the human force inputs are likely zero. For an electric-assist bicycle, the variation in torque due to the instantaneous pedal position could be detected when present, and thus when absent. Braking forces may be harder to detect since they don’t vary on a regular periodic basis, and thus it could be difficult to discriminate between an unknown braking force and an error in estimating one or more other variables. On the other hand, brake controls can be fitted with switches to detect when they are not being applied.</p>
<p>When the human force inputs are determined to be zero, the control system could detect which parameters are varying based on the speed versus the square of speed versus the (odometric and/or inertial) acceleration. This should allow estimates of friction, drag, and mass to be refined over time.</p>
<h2 id="vehicle-applications">Vehicle Applications</h2>
<p>The vehicle types this could be applied to are many:</p>
<ul>
<li>Pedal-assist (“Pedelec”) ebikes</li>
<li>Scooters</li>
<li>Skateboards (although braking would have to be considered)</li>
<li>Wheelchairs</li>
<li>Bike trailers</li>
<li>Dollies</li>
<li>Handtrucks</li>
<li>Wheelbarrows</li>
</ul>
<h2 id="prior-art">Prior Art</h2>
<ul>
<li>A similar principle is used in trailer brake controllers. When the towing vehicle applies its brakes, an accelerometer is used to measure the braking rate, and a proportional signal is used to apply the brakes of the trailer.</li>
<li>An accelerometer-based system for a pedal assist ebike is described <a href="https://ebikes.ca/learn/pedal-assist.html">here</a>.</li>
<li>An alternative torque-sensorless assist system is described <a href="https://www.jstage.jst.go.jp/article/ieejjia/6/2/6_124/_pdf">here</a>.</li>
</ul>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:1" role="doc-endnote">
<p>Less expensive options exist that measure the rider’s cadence (pedal speed) and vary the motor’s output accordingly, but they have a much less natural feel than systems based on a torque sensor. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>MotivationThe Unreasonable Efficiency of Micromobility2019-04-30T00:00:00+00:002019-04-30T00:00:00+00:00http://metromotive.com/blog/2019/04/30/Unreasonable-Efficiency<p>Over the last couple of decades, it’s become economical and practical to augment bikes, scooters, skateboards, and a number of other types of small vehicles with battery-powered electric motors.</p>
<p><a href="https://twitter.com/asymco">Horace Dediu</a> popularized the term “Micromobility” to refer to this class of vehicle: small (under 500 kg), usually electric, often shared, and used for utilitarian rather than recreational travel.</p>
<p>I’ve had <a href="https://metromotive.com/Hello-World/">some interest in this space for a while</a>, and I thought I had a pretty good intuition around the energy required to move these vehicles (and their riders) around.</p>
<p>But an <a href="https://www.vox.com/the-goods/2018/9/10/17631318/electric-scooters-bird-city-regulations-sustainability">article by Matthew Yglesias</a> on the advantages of electric scooters—in this case over a combination of walking and transit—got me doing some math, and underscored just how impressive their efficiency is.</p>
<p>My original conceit was to figure out how many avoided showers it would take before the direct energy use of the scooter was lower than a sweat-inducing alternative, but it depends on enough variables and assumptions that it’s not an especially useful argument to get into<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>.</p>
<p>But what <em>is</em> instructive is to take an activity (a hot shower) that most Americans do on a near-daily basis and compare its energy use to what it takes to charge our micromobility benchmark, the humble <a href="http://www.segway.com/products/consumer-lifestyle/es1-kickscooter">Segway ES1 electric kick scooter</a>.</p>
<p>Heating a liter of water from ground temperature (10°C) to a comfortable shower temperature (40°C) uses about 35 watt-hours of energy. A modern shower head has a flow rate of around 9 liters per minute, so a hot shower consumes about 315 Wh per minute<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup>.</p>
<p>At an electricity cost of 10 cents per kilowatt hour (which is a typical retail rate in my corner of the United States), a ten-minute shower costs a little over 30¢, leaving aside the cost of acquiring and disposing of the water.</p>
<p>A full charge on our scooter is something like 185 Wh, or roughly 200 Wh after accounting for the efficiency of the charger<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup>. Under typical use, that charge will be depleted in about 75 minutes. That leaves us with an energy consumption of about 2.7 Wh per minute.</p>
<p>So a 10-minute scooter ride costs only a bit more than a <em>quarter of a penny</em>. Because it’s difficult to reason about such a small number, it’s more useful to look at what it would cost in electricity to make that trip every day for a year: The result is less than one dollar.</p>
<p>Another interesting comparison is heating water for a hot beverage. A half-liter of water (Grandé in Starbucks parlance) heated from our local ground temperature to its boiling point uses around 50 watt hours, which is comparable to a 20-minute roundtrip on a scooter.</p>
<p>Initially I wasn’t sure if I was more impressed with the appalling wastefulness of heating water or the admirable thriftiness of moving a lightweight electric vehicle, but going a bit further I think there’s a good argument for it being the latter.</p>
<p>If we move from a small electric vehicle to a full-size car, we see that a <a href="https://forums.tesla.com/forum/forums/what-your-whmile">typical per-minute number</a> is in the high two hundreds (assuming a freeway pace of a minute per mile)<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">4</a></sup>.</p>
<p>It’s fair to point out that the car in question will cover about five times more ground over the course of each minute, but looking at only aerodynamic drag, you would expect to beat the car’s efficiency by around a factor of 25. Instead it’s around a factor of one hundred<sup id="fnref:5" role="doc-noteref"><a href="#fn:5" class="footnote" rel="footnote">5</a></sup>.</p>
<p>So it’s clear that shifting traffic from private cars and ride hailing services to small electric vehicles could have a huge impact on transportation energy use, while having a negligible impact on household energy use. And it might even pay for itself in avoided showers.</p>
<div class="footnotes" role="doc-endnotes">
<ol>
<li id="fn:1" role="doc-endnote">
<p>Reasonable answers seemed to range from one avoided shower per week to one avoided shower every few years. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:2" role="doc-endnote">
<p>Let me acknowledge that watt hours per minute is kind of a weird combination of units, so if you prefer watts, just multiply everything by 60. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:3" role="doc-endnote">
<p>Of course a scooter in a dockless shared system might use quite a bit more energy after accounting for charging- and rebalancing-related transportation. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:4" role="doc-endnote">
<p>Interestingly, a hot shower and a freeway drive in an efficient car use about the same amount of energy per minute. <a href="#fnref:4" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
<li id="fn:5" role="doc-endnote">
<p>This is mostly because it’s <em>not</em> all about aerodynamic drag (drag area is actually pretty much the same in this comparison). There’s some energy involved in climate-controlling the cabin, but it’s mostly a relative of the “tyranny of the rocket equation”, where the weight required to achieve and safely manage high speeds snowballs on itself. <a href="#fnref:5" class="reversefootnote" role="doc-backlink">↩</a></p>
</li>
</ol>
</div>Over the last couple of decades, it’s become economical and practical to augment bikes, scooters, skateboards, and a number of other types of small vehicles with battery-powered electric motors.Welcome2018-12-13T00:00:00+00:002018-12-13T00:00:00+00:00http://metromotive.com/blog/2018/12/13/Hello-World<p>About twenty years ago when I bought this domain I had some pretty ambitious plans for it: a worldwide empire selling high-end small electric vehicles. As is so often the case, reality intervened and I got sucked out of the field of electric mobility and into the considerably more booming field of web development. What can I say? It was 1999, I was happily stuck in an out-of-the-way college town, and I was trying to get while the getting was good.</p>
<p>But before that, in the spring of 1998, my friend Craig and I had put together a proof of concept of what I hoped could become a pretty cool transportation device. It would be easy now to <a href="https://en.wikipedia.org/wiki/Retroactive_continuity">ret-con</a> some higher purpose into its origin story, but the truth is it grew out of a desire for a cooler way to get to class at <a href="https://www.hmc.edu">the college we both had graduated from a year earlier</a>.</p>
<p>Still, electric bikes were starting to become a thing, and in fact <a href="http://www.electric-bikes.com/bikes/charger.html">the company we were working for had one on the market</a>. But they were—and mostly still are—too big to really carry around with you. That means they need to be locked up somewhere outdoors (introducing friction into your trip), racked on the outside of a bus or private vehicle (more friction) and the battery either needs to be removable or the whole bike needs to spend some quality time within reach of an electrical outlet (still more friction). Our vision was a compact and completely hands-free vehicle: an electric skateboard that responded to its rider shifting their weight fore and aft by accelerating and decelerating.</p>
<p>It’s been said that one of the worst mistakes when trying to make something people want is to <a href="https://medium.com/swlh/start-with-problems-not-solutions-8521c53264b2">start with a solution, rather than with a problem that said people are trying to solve</a>. So it’s worthwhile to state the problem, which is making trips that are a bit too long to walk, and a bit too short to drive. Running and biking are both alternatives, but there appears to be significant space for small motorized vehicles like electric bikes, electric scooters, and similar vehicles. That space is now attracting an increasing amount of attention, having been dubbed “micromobility”, and having spawned its own <a href="http://5by5.tv/micromobility">podcast</a> and <a href="https://micromobility.io">conference series</a>.</p>
<p>I’m still optimistic that a cleverly-built weight-sensing skateboard-like vehicle is a pretty compelling solution to the problem of micromobility. If prototypes getting randomly stolen is a proxy for market demand, my odds (2 out of 3) are pretty good. Still, it’s certainly not the only form factor I’m interested in exploring.</p>About twenty years ago when I bought this domain I had some pretty ambitious plans for it: a worldwide empire selling high-end small electric vehicles. As is so often the case, reality intervened and I got sucked out of the field of electric mobility and into the considerably more booming field of web development. What can I say? It was 1999, I was happily stuck in an out-of-the-way college town, and I was trying to get while the getting was good.