name: inverse class: center, middle, inverse layout: true .header[.floatleft[.teal[Christopher Biggs] — Micromobility].floatright[.teal[@unixbigot@aus.social] .logo[accelerando.com.au]]] .footer[.floatleft[.hashtag[EverythingOpen] Apr 2024]] --- layout: true name: callout class: center, middle, italic, bulletul .header[.floatleft[.teal[Christopher Biggs] — Micromobility].floatright[.teal[@unixbigot@aus.social] .logo[accelerando.com.au]]] .footer[.floatleft[.hashtag[EverythingOpen] Apr 2024]] --- layout: true name: toply class: center, toply, italic, bulletul .header[.floatleft[.teal[Christopher Biggs] — Micromobility].floatright[.teal[@unixbigot@aus.social] .logo[accelerando.com.au]]] .footer[.floatleft[.hashtag[EverythingOpen] Apr 2024]] --- layout: true template: callout .header[.floatleft[.teal[Christopher Biggs] — Micromobility].floatright[.teal[@unixbigot@aus.social] .logo[accelerando.com.au]]] .footer[.floatleft[.hashtag[EverythingOpen] Apr 2024]] --- template: inverse # Open Source Micromobility ### Everything Open 2024 - Yallarm (Gladstone) .bottom.right[ Christopher Biggs, .logo[Accelerando Lab]
@unixbigot@aus.social .logo[accelerando.com.au] ] ??? Greetings Earthlings meat and metal, and anyone receiving this out there in the wider universe. My name is chris, and today I want to convince you that you should build yourself a micromobility vehicle and spend less time on cars or buses. --- layout: true template: toply .crumb[ # Intro ] --- # About Me ## Christopher Biggs — .teal[@unixbigot@aus.social] — .logo[accelerando.com.au] * Meanjin (Brisbane), Australia * Founder, .logo[Accelerando - Innovation Space and IoT consultants] * Convenor Brisbane Internet of Things interest group * 30 years in IT as developer, architect, manager * COVID has been hard, can has job, pls? --- # Prelude ??? Today I want to try and get you enthusiastic about Micromobility, which is a new term, invented in 2017 by horace dediu, for an old concept. You could define micromoblity as vehicles that don't have fossil fuel engines, travel about the speed of a cantering horse, and weigh no more than an ordinary riding horse. Now I put the horse before the cart there because the real definition is 25 kmh and five hundred kilos, which happens purely by coincidence to be pretty horsey. --- # Prelude * motivation/theory ??? I want to start out with some whys. Why this transportation segment is useful, and why, in just the last decade or less, is has suddenly become compelling. The hook for why I'm talking about this at everything open is the remarkable fact that as an open sourceror you have the ability to build something yourself that is far better than anything you could buy, and cheaper to boot. --- # Prelude * motivation/theory * motors and controls * batteries and chargers ??? After this we'll get into the nitty gritty of what terms and tools you are going to need. We'll look at each of the key components of an electric vehicle, and how you can mix and match commerical and open source parts. --- # Prelude * motivation/theory * motors * batteries and chargers * example builds * (bonus content) ??? Once we have our concepts and components summarized, we'll look at a bunch of examples - vehicles that I've built and am building, and how you can do this too. So if you're sitting comfortably, let's go for a ride. --- layout: true template: toply .crumb[ # Intro # Why ] --- # Motivation ??? Back about thirty years, or five apocalypses, ago my partner and I carefully selected a modest house that was well sited for the coming Peak Oil apocalypse. Peak Oil was the moment when global petroleum production peaked, as the curves of rising demand and falling reserves crossed over. The world was supposed to end, and we made sure that our house was within 500 metres of a supermarket, kindergarten, medical centre, a school, several parks, two major bus routes, and a bikeway that runs all the way to the CBD, so that our lives could continue in the suburban mad max goat-drawn future. --- # Motivation ??? Well peak oil is going to happen sometime in the next decade, and this has been true for the last four decades, we keep finding weirder ways to squeeze oil out of dinosaurs. We didn't get the predicted apocalypse so far. Or rather, your kabooms may vary. Thanks to a different apocalypse, I can't remember the last time I needed to go to the CBD for work; in fact work, food, doctors, school and goat feed can all be had home delivered if we choose, though we rarely do. --- # Motivation ??? Lets zoom in on two of those cases, work and food. When I worked in the CBD fifteen years ago, I commuted, a 20km round trip, on an electric bicycle. The batteries on this bike were lead acid, like you'd find in a petrol car's starter battery. Heavy as, well, lead obviously. You had to replace them every year, or even more often. The motor was a huge lump the size of a football, driving the rear wheel via a second chain on the opposite side to the pedal chain. The bike itself was a big heavy beast of a thing with a thick steel frame, made strong to carry all that weight. Even with all that strengthening, this bike would break spokes weekly and the design of dual gear rear wheel made replacing broken spokes damn near impossible, even for the best bike shops, so I gave up riding it. But using it for two years got me fit enough, coming back onto the road after a serious injury a few years prior, to continue to cycle 20km a day under my own power on an ordinary bike. --- # Motivation ??? So right here we've got a handful of reasons why an electric bike might be a good idea -- you have a handicap, you need to go a long way, you want to carry luggage, you are going to work and lycra is not appropriate workwear. Depending on the weather I could ride this bike in work clothes, or if not carry a change of clothes on its cargo rack. My commute in the naughties included a stretch along the brisbane river, which is the main freeway of brisbane's bikeway network. This route was crowded with joggers, cyclists, pram pushers and, as far as I ever saw, just two e-bikes. Me on my k-mart special, and one other poor guy who had an e-bike that owed a lot more of its genes to a motor scooter than a comfort cycle like mine. He had printed and laminated signs front and back saying "electric bicycle, legal on bikeway", I gather he copped a lot of abuse. --- # Law ??? Lets take a quick diversion to talk about the law here in queensland. To be exempt from licensing and registration, and permitted to ride off road on bikeways and footpaths, a vehicle must travel no faster than 25km/h under electric power. You're allowed to go faster but the motor has to stop helping past 25 k. Well the reality was I was pedaling as hard as I could to not obstruct the humans riding their titanium-unobtainium road bikes zooming past me at 30 to 40k. Besides holding up traffic, If I didn't pedal diligently I'd be out of battery before I got home, too. The law about micromobility vehicles has changed a bit since those early days, and it's gotten both better and worse. --- # MAMILs ??? I don't know if this is a global term, but in brisbane we call the recreational cyclists MAMILS. Middle Aged Men In Lycra. These MAMILS can be identified by their lycra bike clothes with fake sponsor logos, their ten thousand dollar bikes that weigh about a kilogram and have knife thin tires, and the complete lack of any cargo capacity. They ride through red lights because their clip-on shoes might cause them to land upside down like a stricken tortoise if they have to touch the earth like some kind of lower creature. --- # Motivation again ??? All right, lets jump to now -- when I go out on the bikeway today I see something completely different. Sure the occasional MAMIL but also men and women in ordinary work clothes zooming along on practical looking bikes, or on electric scooters. For just this one time we got a future I predicted and wanted. When I drive onto the freeway near my house, I spend about thirty seconds in sight of the adjacent bikeway and I almost always see at least one person on a scooter with a briefcase at their feet. --- # Motivation again ??? But why has this happened? What changed? Well, Everything changed. The electric bike of today has almost nothing in common with that tank that I rode two decades ago. And when electric scooters came on to the market in the mid naughties, they too were heavy, slow and underpowered. Many of them still are. But the good ones are likewise almost completely different from their ancestors. --- # Motivation again ??? The changes I'm talking about are different motors, different batteries, and different mechanicals - wheels, brakes and the rest. We're going to look at each of those areas in turn, but first I want to make sure we're all using our words the same way. --- layout: true template: toply .crumb[ # Intro # Why # Theory ] --- # Theory ??? Okay, this is going to be the nerdiest part of the talk, and a whole bunch of you will already know some or all of this, but for those who don't we're going to look at the special words that transport nerds use and abuse. We'll start with the ur-Nerd. Isaac Newton, and his laws of motion, which I am going to paraphrase in a slightly nonstandard way --- # Theory # First Law # Second Law # Third Law ??? 1. Objects at rest remain at rest. Objects in motion remain in uniform motion in a straight line. Unless, in either case, some force acts to disturb this. 2. every force that acts is opposed by an equal and opposite force. which is bullshit because I saw that movie and there were like hundreds of jedi and only two sith. and the acting was terrible at best. 3. A force applied to an object causes an acceleration inversely proportional to the mass of the object. --- # Theory ??? Taken together all three of those laws are about the interrelationship of mass and inertia. Objects like to do their own thing, and if you want them to do a different thing, you have to force them, and the heavier they are, the more force you need. Having said all that, why is it that cars and trucks get bigger and heavier year on year. Beats me. --- # Theory ??? In newton's day, lets say 1670, a typical cart had one horsepower. the horse. The car I drove up from brisbane has about 120 horsepower. And that's a mini. In the micromobility arena we are talking about way less than one horsepower - typically a quarter to a half a horsepower. The way we cope with that shitty ration is to keep the vehicle light. We don't even have a horse pulling us, we have a five year old seventeenth century street urchin named Timmy pushing us along, at least until the child labor laws catch up with us. --- # Theory ??? Now, what's force. Well, a force is something that produces an acceleration. It makes a stationary object move, or makes a moving object do something other than keep moving in a straight line at a fixed speed. Weight is a force you'd be familiar with. We measure force in units called Newtons. One newton of force makes a one kilogram object accelerate at one meter per second per second. That is, after one second it's moving at one meter per second, next second at two m/s, second after that at three. --- # Theory ??? Now work, which we also call energy, is defined as a force acting over a distance. If you apply one newton of force to move an object over one meter, you did one Joule of work. --- # Theory ??? If Timmy pushes us the width of this room on our scooter, with a combined mass of 100 kilograms, and at the end of this distance we roll out the door moving at 25kmh about 7m/s, then we can work out....well it depends on how fast he did it and this is why Newton had to invent calculus to make us all suffer. The concept of timmy getting all puffed out trying to get us up to bikeway speed in just a few seconds, but having far less of a problem doing it over the course of a minute feels familiar. What's different in these cases is power, which is the rate of doing work, and we measure power in watts. I'm going to stop talking about horsepower from here on, you might want to note that there's about 700 watts in a horsepower. I wont dob on you if you just treat kilowatts and horsepower as basically interchangeable within the margin of vendor lies when we're considering motor power and battery capacity. --- # Theory ??? All right, I won't dredge up any more horrors that you might remember from high school or later in life. My point is that all these quantites are related and if you know some of them you can work out the rest -- which will help us work out how to express "biglyness" to borrow a term from tangerine mussolini, when we come to consdier batteries and motors. I'll be throwing out some cheat notes of how to multiply or divide quantities in one unit to find some other quantity in a different unit. --- layout: true template: toply .crumb[ # Intro # Why # Theory # Motors ] --- # Motors ??? Right now that we have some words to smash together, lets talk about motors. --- # Motors ??? Wait, I need to fill you in about a little invention called the wheel. Dobbin, our cart horse, and Timmy our micro-horsepower cart boy did their work in a straight line. I reckon that the biggest single event in human civilization was the circle. Grain mills, water wheels, windmills, railways, bicycles, automobiles, jet turbines - its all just going in circles. The ability to turn grain into flour efficiently was the single innovation that allowed cities, and civilization and all its boons and bugbears to happen. --- # Motors ??? The wheels on a muscle drawn carriage just turn as the carriage itself moves, but the rest of our civilisation has the wheels as the source of power. Water power, wind power, treadmill power, steam power, electric power, they all use motion to turn wheels which turn other wheels which move the power to where it needs to go. Machines as a class of object are fundamentally mechanisms for manipulating and transferring forces, and the wheel is one of the machines that does the most for us. --- # Motors ??? Even today, in the electrified world, we have water or steam turning turbines, generating electricity, guiding that electricity along wires, and then operating machines at the far end the far end. The key quantity here is power, remember that's the rate of doing work, and the work is changing you from standing in your driveway, to moving along the road, or through the sky. Oh hey, remember how I said I was done dragging up nightmares from high school science. I lied. --- # Motors ??? Dobbin and Timmy are both a kind of complex machine. They eat plants, burn them up in a chemical reaction, and use the resulting energy to power muscles that exert force to do work. Let's release dobbin and timmy from their carriage forcing duties and get timmy off to school, dobbin to a nice grassy paddock, and talk about using electricity instead. Instead of one timmy pushing us around, we'll use electrons. Electrons are sort of tiny little machines too, give them some energy, and they can carry it from here to there, and do work with it. We measure the average energy per electron in Volts. We use a lot of electrons, quintillions of them at a time. The measurement of just how many electrons we push along per second we call electric current, and measure it in Amperes. And if we take these two weird quantities and multiply them together, we get power, which once again is watts. So power is our common measure that we can use to compare the output of an electric motor to a meat motor, and also, working backwards, we can work out the characteristics of the electric flow that we will need to deliver some amount of power--like force and mass, voltage and current can be traded off, we can deliver the same power with a small voltage and a big current, or a big voltage and a small current. --- # Motors ??? Now, I really didn't want to go into too much detail about physics, but it turns out that douglas adams and his character dirk gently were right. The fundamental interconnectedness of all things is a powerful effect. Like current and voltage, Electric charge and magnetism are another of those interrelated phenomena - a moving charge creates a magnetic field, and a magnetic field can interact with another magnetic field, or directly set charges in motion. When we wind a wire into a coil the magnetic field that is produced is very strong and concentrated, strong enough to do work. --- # Motors ??? Electric coils use those strong magnetic fields to shove things around. They can do it in a straight line, but the real benefit comes when we do it in a circle, with an electric motor. A huge part of our electric infrastructure can be thought of as moving forces around with wires and wheels. Gears and chains are just fancy kind of wheel deep down, a gearbox is a machine that transforms one kind of motive force into a different kind. Gearboxes expose us to another one of those interconnected tradeoffs, we can turn a weak force moving a long distance into a powerful force moving over a shorter distance. The amount of work remains the same but we are trading off the distance over which it performs work, which is interrelated with the time it takes to do it. --- # Motors ??? In theory, any motor can do any job. With the right gearbox, a tiny little motor the size of your pinky ought to be able to get your two ton millstone up to speed, provided you're patient as it takes a week to reach working speed, whereas a big powerful motor could get your twenty kilogram microvehicle moving at ludicrous speed in the blink of an eye. It's like the old saying that goes "in theory there's no difference between theory and practice, but in practice there is". --- # Motors ??? Why don't we just install a really powerful motor and be done with it. We'll because practical concerns mean that size and weight have to go up to get that increase in power. Cost goes up too. And then the law comes along to yuk our yum by placing upper limits on all sorts of things. --- # Motors ??? I'm still talking about motors here but I'm going to need to flash forward to batteries --- if an electric motor is our horse, then a battery is our bucket of oats. Once again in theory it doesn't matter if you feed dobbin one oat flake at a time all day, or give her a big tub for breakfast, but in practice it does. In the world of batteries we can in theory interchange voltage and current in any combination, but in practice there are limits. For reasons of safety and chemistry there are some upper limits on voltage, and some particular voltages that we are stuck with due to the way that the chemical reactions inside batteries work. Current has a lot to do with efficiency too -- for any given wire the waste heat increases in proportion to the square of the current, until the wire melts. --- # Motors ??? So for the moment I'm going to ask you to take it on faith that for micromobility we're pretty much stuck with voltages between three and fifty volts, and for a 300 watt motor that means an electric current of 100amps at three volts, or six amperes at fifty volts. The practicalities of melting wires are going to further restrict us. A wire that can carry 100 amps without melting is going to be as thick as your thumb. If we stick to ten amps we can use a wire about the size of a piece of spaghetti. --- # Motors ??? The power I want to give you today, pun totally intended, is to understand how to choose the right kind of motor, battery and what have you to create a vehicle that delivers the most fun per dollar. Right now that we have some words to smash together, lets talk about motors. --- # Motors ??? Oh goddess why did I propose this talk. There's so much to tell you just so I can give you a shopping list. No naughty skipping to the end now. As geoff said this morning, electricity went from curiosity to essential in the first quarter of the 19th century. The simplest kind of electric motor has been around for about two hundred years. --- # Motors ??? Oh heck, thats long enough to drop the spoiler warning. Heres what this talk is really about. A decent electric bike seems to sell for about four thousand dollars. A cheap one can be had for a grand. That lead powered relic that I rode two decades ago was four hundred bucks at k-mart. They stopped selling them pretty fast when the failure rate became apparent. Theres a thing that bicycle snobs call a BSO - a bicycle shaped object. By this they mean that the 99 dollar bikes from kmart are so compromised by cost cutting that they are not fit for purpose. They'll work for a while but they wear out quickly ways that often can't be fixed. If you own a mountain bike, check down near the pedals for a little sticker that says "Not for off road use", if you find that, you have a BSO, it means the frame is not strong enough to cope with anything outside a suburban cul-de-sac. --- # Motors ??? What I want you to learn today is that if you've got a dusty old bike under your house, or your neighbour puts one at for rubbish collection, or you fish one out of a canal, you can electrify it for about two hundred dollars with a spanner and maybe an allen key left over from your ikea cabinets, and end up with something that's stronger and faster and easier to fix than a new e-bike. --- # Motors ??? Alternatively, if somebody else dropped a few grand on an electric bike that broke down, its just so easy to replace any of the broken parts. There's only about four parts that can go wrong and the most expensive of them is about a hundred bucks. Off the shelf electric bikes are like macbooks, expensive, locked down, and hard to repair. But if you go open source on them all those problems go away. Two years ago my wife bought me an electric bike for two hundred bucks that was described as broken, wont charge. The parts to fix it were about twenty bucks. --- # Motors ??? Now, I know I've dropped a lot of science on you, but I don't want you to be scared. I want you to feel powerful, I want you to look back on five thousand years of human technology and feel like that you are standing at the point of a massive wedge, with all that ancestral wisdom behind you. I want you to take the point of that wedge and use it as a scalpel to divide the bicycles from the BSOs. --- # Motors [](https://en.wikipedia.org/wiki/File:Jedlik_motor.jpg) ??? SO Here's an electric motor that our ancestors made, this motor is coming up for its two hundredth birthday next year, and it still runs. An electric motor contains a bunch of wire coils, and some permanent magnets and it sets up a bunch of magnetic fields that push against each other, causing the center part, the rotor, to turn. But its only going to turn halfway because now the magnetic fields are lined up and are not pushing against each other any more. So we need to change the magnetic field to keep it turning. --- # Motors [](https://en.wikipedia.org/wiki/File:Electric_motor.gif) ??? We can do that in two ways -- by switching the electricity to a different coil, or by changing the direction of the electric flow inside the coil itself. The wire switchy approach turns on the really clever invention that as the rotor turns, the one coil gets turned off and a different one gets turned on. The electric supply is connected to electromagnets in the rotor, via some brushes, literally little bits of copper or carbon that brush against copper pads in the rotor in order to act as fast operating switches. So the motor turns halfway, then the field changes, and it turns another half way, and this process repeats until the brushes or the copper pads wear out. --- # Motors ??? And for our purposes, they're obsolete. If your micromobility vehicle has one of these then I'm sorry its probably a bicycle shaped object. If you've ever used a power tool and glimpsed sparks inside, thats the brushes making and breaking electrical content, and when they wear out your drill or grinder stops working. It probably came with a spare pair when you bought it, but do you know where they are three years later? --- # Motors ??? Here's today's descendent of that original motor from the museum, this one is from the cheapest and nastiest razor scooter that you could buy in 2003. My one was put out in the kerbside rubbish collection because every part but the frame had failed. The lead battery was end of life, the control circuitry was blown up, and the motor is comatose because its brushes wore out. --- # Motors ??? This one is the motor out of that K-mart bike, with a built in gearbox to turn fast and weak into slow and strong. Noisy as heck. But the thing is, all these parts are easy to replace, together or one by one, with their modern and vastly better descendents. --- # Motors ??? Earlier I said that a brushed motor utilises one of the two ways to produce electric motion, switching to different coils. The other way is to use the same coils but turn them on and off, or even reverse them. Traditionally we've done this by generating alternating current, the generators at power station powered by water or steam produce an electric current that reverses direction 100 times a second, and by constructing motors with various numbers of coils, we can create an electric motor that runs at a fixed speed, without any brushes, which means less noise, fewer moving parts and almost no noise or vibration. --- # Motors ??? But what about variable speed, it would suck to have a vehicle that can only move at 60 kilometers per hour. Thats where those old direct current brushed motors came in handy, by changing the voltage, we could change the speed, although losing power as a consequence. We can get the same variable speed effect without losing power by chopping the voltage up into short pulses, and changing the ratio of the length of the on pulse to the off pulse. But then were back to those switches that wear out, again. --- # Motors ??? So lets jump back to Geoff's keynote this morning. When he called out that list of things that Bell labs invented one of them was the transistor. It's been said that the transistor was the single most significant invention of the 20th century. A transistor is an efficient, fast, reliable and powerful electrical switch, with no moving parts. It replaced the relays and vacuum tubes in our computers, and then it replaced itself when we learned to put billions of transistors on a single wafer of siliicon, producing the integrated circuit, and you know how that turned out. --- # Motors ??? And transistors have quietly revolutionised the way we build motors. Instead of being stuck with alternating current at a fixed freqency, or using mechanical switches or brushes to chop up direct current, transistors let us build motors in which the only point of wear are the ball bearings that support the rotor. They can run ludicrously fast, too. In multicopters and some machine tools you will see these motors doing many tens of thousands of revolutions per minute. --- # Motors ??? We call these things Brushless DC Motors. The other way that BLDCs have revolutionised our machines is that they can be almost any shape. That brushed motor on my ancient bike, or on the razor scooter was pretty much restricted to being a short fat cylinder. The starter motor in a car is a cylinder the size of a soft drink bottle that sits beside a petrol engine and gets it started by means of a gear or a belt. The motor in older washing machines or tumble dryers is the size of a watermelon and sits down in one corner and drives the machinery via big rubber belt. The motor on EVs like my bike and the razer sits down near the back wheel, and drives the wheel via a chain or a belt. --- # Motors ??? So instead of being at the mercy of the watermelon mafia, we can put our motor INSIDE the machine it drives. A ceiling fan has the motor inside the spindle. Most modern washing machines have the motor in the drum. Most bike and even some cars have motors in the wheels. One of the upsides of this is we can motorise a scooter or a bicycle by just replacing one of the wheels. --- # Motors ??? Once again we hit one of those tradeoffs. This brushless motor is useless without those transistors, so we need a separate component called an electronic speed controller. But on the other hand with the right motor and ESC, weight for weight, a brushless system can be tens of times more powerful than the older generation for the same weight. I just want to take a moment here to shout out to radio control model nerds. Your enthusiasm for ludicrously powerful RC cars, and boats and particularly multicopters has showered us all with inventions that open sourcerors can use to build all manner of zany contraptions. --- # Motors ??? Here's a combination of a motor and the transistors to run it where each of the two is no larger than a matchbox, yet it could run our bicycle if only we could keep it cool and gear it down. There's somebody building a bicycle like this on hack a day right now just for the lulz. --- # Motors ??? This motor has three wires -- there are three coils connected in a triangle and the software and transistors take care of turning on the right coils. Bigger motors come with sensors to help understand where the motor is in its rotation cycle, so when you are shopping for a controller the first thing to look out for is pairing a sensorless motor with a sensorless controller, or vice versa. And heres somebody else, again for the lulz, putting a washing machine drive assembly on a bicycle --- # Motors ??? And finally FINALLY we get to the open source, in both hardware and software. These motors can connect to a controller box that implements all the personality of a vehicle, you connect a battery, a motor, a throttle and maybe a braking sensor and you're done, it will even monitor your pedaling and run your headlights. Who knows whats inside the box, it's all one lump. --- # Motors * https://vesc-project.com/Hardware * https://github.com/odriverobotics/ODrive * https://hackaday.com/2017/09/11/open-source-high-power-ev-motor-controller/ * https://endless-sphere.com/sphere/threads/opensource-ampler.111419/ * https://opensourceebike.github.io ??? This is the part that was busted on that $200 dead bike my wife got me, and I dropped 20 bucks on a new controller, and the hardest part of hooking it up was dealing with all the weird ass plugs. But also the easiest part because the weird ass plugs are about making it harder to hook up wrong. But there are open source replacements, either for the whole box and dice, or for just the control logic. --- # Motors ??? The approach I've taken for my scooter build is the middle ground. I use an off the shelf motor controller, but a really simple one -- it takes a digital signal to set the speed and gives me a digital output to tell me how fast it's turning. The processing of the throttle input, the brakes, and the speed display is all done using my own code and an ESP32. In theory this lets you use your phone as a diagnostics display, and I have confirmed that its legal to do that provided it is fixed to the handlebars, but yeah nah. --- layout: true template: toply .crumb[ # Intro # Why # Theory # Motors # Batteries ] --- # Batteries ??? Back in the day batteries were easy - you went to jaycar and you bought the right size of sealed lead acid battery and you liked it by damn. The dirty secret about lead batteries is they are only good for about 200 charges -- the starting battery in your car lasts a few years because it almost never goes flat, but if you're running a vehicle, doing what's called deep cycling, a lead battery is dead of old age inside a year. Also, lead. Back ten years ago a lithium ion battery pack cost around 500 dollars, plus or minus. Today it's under a hundred. --- # Batteries ??? Now technically a single battery is called a cell. The word battery comes from mining where a row of hammers would be driven by a rotating shaft to crush ore. An electric battery combines a number of cells to give us the voltage and current delivery characteristics that we need. We connect cells in parallel, that is positive to positive, to get more current without increasing the voltage. Then we can connect cells, or sets of cells in series to get the desired voltage. Really all of this is about getting the power to to motor in a way that won't melt the wires. When you see a battery described as something like 4s3p this means it has four sets of cells in series, and each set consists of 3 cells in parallel. You could do it the other way around, but don't. --- # Batteries ??? The thing about lithium ion cells is that they have decent lifetime, 500 cycles or more, and they ca n deliver a lot of energy FAST, that is they can deliver very high current. They're so good I'm not going to talk about anything else. Yes there are variants that are a few percent better here or there. The drawbacks are twofold, firstly that high current means big sparks if you screw up, and secondly they can be ruined if you run them too flat or charge them too high. --- # Batteries ??? So a lot of thought goes into battery management. That's a wee computer that makes sure the battery is charged properly, that the cells don't get unbalanced where one is flatter than the rest, and that the power gets cut off when they are too flat. --- # Batteries ??? You can design and build your own battery from cells, and its fun once, but you can also just buy them in whatever size you want. First you decided what voltage you want - a single lithium cell puts out 3.7volts on average, so if you have a motor and controller that expects 24 volts, you want a 6s pack. My scooter and bike both have 36volt motors so they are using 10s packs. The number of cells in parallel in each bank gives you two things, it gives you zoom factor, and it gives you range. So once you've decided the voltage, the cell count and thus the energy capacity depends mostly on your recklessness and your wallet. This scooter is a 2p, and by bike is a 3p. --- # Batteries ??? Now once again for battery management there are a number of open source projects that implement an all signing all dancing battery controller, or you can just buy a simple simple one and monitor it with your own code. By simple simple I mean you give it power from a power brick or a solar panel and it feeds the battery, and you draw power from it until it says nope nope and cuts you off. --- # Batteries ??? By measuring the voltage you can estimate the state of charge, because it will start at around 4.2 volts per cell, and decline to around 3 volts per cell when it's time to recharge. With some sensors and clever code you can measure how much power went in versus how much went out, apply some fudge factors, and predict your remaining range. But in practice, you just buy a battery big enough for your use case and recharge it at end of trip. --- # Batteries ??? You will see a lot of articles about how lithium batteries need a special kind of charger - most of this dates from the dirt ages where if you used a lead charger or nickel battery charger you would kill your lithiums. Nowadays lithium charging regulators are cheap and plentiful, they cost a few bucks. Ooh, its time to talk briefly about capacity. We measure capacity in amp hours.. thats amps times hours, not amps per hour. A 2ah cell can in theory deliver 2 amps for 1 hour, or 1 amp for 2 hours. Guess what, its complicated, but assuming a straight line relationship should get you close enough. --- # Batteries ??? If we multiply amp hours times the voltage we get watt hours. This is handy because it lets us compare the capacity of different shaped batteries. One point of warning: all battery capacity ratings are lies, some are worse than others. The little 18 by 65 millimeter cells that most batteries contain are going to have a capacity of 2 amp hours, give or take 50 percent. If you see them sold as six or ten amp hours, that's utter bullshit. --- # Batteries ??? Like flash memory drives, it pays to avoid shopping at the cheapest suppliers because they are selling junk. Now if you chose your battery size based on your motor and your desired range, you need to choose your charger based on how long you want to charge. Again its mostly math and a fudge factor, if we have a 36V battery rated at 12 amp hours, then a five amp power brick is going to charge it a little over two hours, plus a fudge factor of 25 percent or so. --- layout: true template: toply .crumb[ # Intro # Why # Theory # Motors # Batteries ] --- # Chargers ??? I'm just gonna talk briefly about chargers. Charging lithium cells is done using what's called constant current with constant voltage. A flat 36 volt battery is going to be maybe 30 volts, and when it's full as a goog it'll be 42 volts. The way we feed this sucker is we choose a maximum current, lets say 4 amps - typically the battery will be labelled with a recommendation - and then we deliver 42 volts at up to 4 amps. When the battery stops sucking current, it's full. --- # Chargers ??? You can buy an all in one charger that does this, but it needs to match your battery. Or you can build your own. The circuit board costs under a tenner and it comes with two knobs that set the voltage and the current limit, and maybe a third knob to let you set the current threshold at which the battery is considered full. You twiddle the knobs until you get what you want. If you spend a couple of bucks more you get one with a screen that tells you the voltage, and current. And hey, guess what, open source nerds can over design this component a LOT. Me I just use the one with the knobs. --- # Bicycles ??? Okay, lets look at a couple of real world examples. My k-mart junk bike. A 250 watt motor that wants 24 volts. Two 12 amp hour 12 volt batteries, thats 144 watt hours, so in a perfect world they would run that motor at full power for about 30 minutes. And that's about what I saw. My 20 minute commute would leave me with a battery that was half dead, depending on how hard I pedaled. I would typically charge at work, but if I needed to I could limp to work and back on one charge. --- # Bicycles ??? My facebook marketplace lithium bike - a 250w motor and a 36 volt 7ah battery - that ought to give me an hour of riding at full power. And that battery back is half the size and a fraction of the weight of that lead pack. If you've got a bike that you want to electrify, the simplest solution is to replace the front wheel with a 36 volt brushless hub motor, buy a controller that comes with a throttle grip, and a battery pack that goes on or under your luggage rack. A little over a hundred for the motor, a little under a hundred for the battery, twenty to fifty for the controller depending on whether you want a fancy screen. --- # Bicycles ??? The law here says the controller has to monitor the pedals and stop providing power if you stop pedaling. The all in one controller you buy can snitch on you like this. Or if you forget to connect that wire...it doesn't. --- Scooters ??? The law is different for scooters. No pedals to be paternalistic about. The law here just says max speed is 25kmh, or 10kmh in crowded areas. Pretty much every scooter you will see ignores all of that, although the rental scooters are very good at preventing you speeding through the mall or the public square. --- Scooters ??? You can buy front wheels or back wheels with their own motor, or you can buy back wheels with a cog for a belt, and fix one of those frighteningly powerful brushless motors. Those things are capable of thousands of watts if you choose, and so thats why the law talks about speed not power. And now that I think about it, that might be why scooters getting to be more popular than bikes This scooter that I've been building has a 350W motor and a 70wh battery pack, so it ought be good for somewhere around ten to fifteen minutes of hard riding - so suited to shorter trips out of the box unless you add more battery. --- Mobility ??? My son has a condition that causes leg weakness. And he's a gamer. So forget your wheelchairs, let's build a gamer wheelchair. The bottom part of an office chair is called a spider, and it typically has four to six legs, each with a swiveling castor - weird kind of spider if you ask me. --- Mobility ??? But what if we replace two of those wheels with fixed motorised wheels, then you could drive the chair around like a tank, straight line by driving motors at the same speed, or turning by driving at different speeds. Lol nope, practicality bites us again. Tiny differences in speed mean the chair won't go straight. But he's a gamer right, so fit it with a gamepad. Playstation one controllers are my favourite because they are plentiful and easy to interface. --- Mobility ??? Some of the newer wireless controllers are just bluetooth keyboards and those are easy to use and others are proprietary garbage and are not. Consult your nerd if pain persists. I also have a design that uses a single swiveling motor at the rear. This totally wont work right. Yeah, it needs a tiller like an outboard motor and then its a whole lot of fun. --- class: vtight .fig25[  ] # Peroration* .footnote[Yes, that's a word. Look it up.] .nolm[ * Store bought is okay, if you know what to buy * Open sourcery is better in almost every way * Motor go bzz * Battery go...nothing if you treat it right * Controls are where you have the real creative power * Lets go canal fishing! ] --- # Resources, Questions ## Related talks - [http://christopher.biggs.id.au/#talks](http://christopher.biggs.id.au/#talks) ## HIRE ME - Mastodon: .blue[@unixbigot@aus.social] - Email: .blue[christopher@biggs.id.au] - Accelerando - Innovation Space and IoT Consultants - https://accelerando.com.au/