386 points · by mooreds · 2y ago · 192 comments
This approach is so much harder than it seems. "once everything works then it'll be straightforward to remove what's left and dramatically reduce the rats nest qualities of this setup" We thought the same initially, it turns out the system depends on many more components than you would think.
I imagined the EV system to be like an onion where you can take layers off, not so!It is much more like an egg, once you smash it, you have a few shards that you can re-use but you end up with a mess due to high connectivity between systems. (Leaf refused to turn on without original power steering and wipers connected).
Surprisingly what is more straightforward is putting together your own drivetrain with something like https://openinverter.org and building it back up from first principles. Or you isolate the inverter and motor and make them believe they are still in the original vehicle by replaying CAN messages, ZombieVerter is a project with that approach. Both of these are open source projects.
Happy tinkering!
Appreciate the heads-up from someone who has been there before! Like you I was a bit surprised by how much the integration bled across subsystems. I like the egg analogy.
> isolate the inverter and motor and make them believe they are still in the original vehicle by replaying CAN messages, ZombieVerter is a project with that approach
For sure, great tips. This is what I've been working towards - at the time of that post I was spoofing the minimum number of CAN messages (still quite a lot), but in the months since I've been gradually replacing modules with spoofed signals by reversing them one at a time. Some of the follow-up blog posts have details about this.
I'm approaching the point of only needing the original motor stack (inverter, charger, etc), the original BMS, and all other modules spoofed out via CAN messages and a few discrete wired signals. The OEM BMS might turn out to be too hard to re-integrate once the battery pack gets split apart, but can cross that bridge when I come to it.
More blog posts (and open hardware & software) to come, I hope!
*rumor has it, that most of the software out there is still written like that.
Got a bug to fix or a feature to implement on a program? Modify the source code, run the build system, use the newly built artifact and discard the old one. Lose this process and you're screwed because the tooling for modifying an extant program is still in the Dark Ages. It's not just about proprietary software that has reached its end of support, given enough time almost any source code tree will bitrot past the point where rebuilding it will require a major overhaul.
When you need to fix or customize a physical artifact like a coffee machine, you usually don't go inside the factory to change the blueprints and manufacture a new one. You just modify the one you have with standardized tools. It also doesn't matter how old the artifact is, even if it's decades out of production it can still usually be disassembled and put back together as if it was fresh out of the assembly line.
The more software bleeds into electro-mechanical systems, the less repairable, versatile and hackable they become.
"But it was working!"
"Sure, 10 years ago, now I can't even find a version of Visual Studio that will install that can even open the project, let alone compile it."
Sounds much more like they are trying to work with a production system without the source code, the debugers, the compilers, the datasheets, and the documentation.
Plus many of the things they want go directly against the wishes and good judgement of the engineers who made the system. They want to start the car without the steering component. I bet that someone at the manufacturer spent extra energy that you can’t do that. Why? Because under production circumstances if the steering components are not answering that means that something is terribly wrong with the car and it would be dangerous to turn on and accelerate.
Same with the keyless entry component. I bet that there were at least an effort done to make circumventing that hard.
Never attribute to intelligence what can easily be explained by good old stupidity.
I know the automotive industry from inside. It is a miracle that cars work at all.
(/s, just in case)
I popped my cherry on VAX silicon, where stack frames were baked into the silicon. This meant that regardless of language, the stack architecture was a target for the compiler not something it constructed. I fell into the middle of things: VAX silicon was new, and people wrote in e.g. COBOL, FORTRAN, BASIC, Pascal, C because they'd successfully done so before and had libraries and practices which had stood the test of time and had made the jump to successfully infect a new species of silicon.
The successful colonizer libraries and practices had certain rules. "You can't manage heap in BASIC" for example, or that modular compilation units all had to be written in the same language. This is not and never was strictly true, and the people writing code knew it; but it was true enough for code which jumped silicon.
I on the other hand knew about the silicon stack, and could implicitly understand some of the more esoteric compiler pragmas for dealing with that stack (intended for cross-language linking support) and so by disabling certain linker checks and abusing compiler pragmas I could do e.g. memory management in BASIC by isolating the compilation unit where "memory is an array" from the one where "a memory address is an integer" and explicitly telling different lies with compiler pragmas in each.
Fast forward a few years and everybody had learned HTML and then I'm confronted with somebody wanting me to fix a steaming basket of soup machine gun sprayed into different files all with "(c) Macromedia" in them. "Where's your no-code tool which generated this?" I innocently ask. "Wuuut?" is the response. Yea well when you find it, let me know. Let's just say the people who have to fix things like that probably get paid good money and the solves they come up with are comparatively fragile, that code will not (and did not) survive; any more than my silicon-aware hacks (which I was paid quite well for) for VAX will work on modern silicon. Where's all of that shitty VB Wizard code spew? Thankfully gone.
Some of these integrations will not be fixable, but some of the subsystems will survive, and it might be simply because there is no security and it's possible to replay CANbus reliably as a result.
Your hypothesis is basically correct. Since the motor is under no load, it will appear to spin out of control even with the smallest torque application, but in reality the torque being applied is very small… probably around 5Nm.
Trust me if it was truly spinning out of control with no load you’d know… it would reach max speed in 0.1 seconds and probably start tearing through the floor.
Most likely what’s happening is that the creep torque is applying a constant small torque and the wheel sensors are reading 0 continuously, so it continues to apply a constant small torque.
I appreciate the insight from someone who's worked on this kind of thing formally, thanks.
> Most likely what’s happening is that the creep torque is applying a constant small torque and the wheel sensors are reading 0 continuously, so it continues to apply a constant small torque.
This was also my hypothesis at the time of the post. Turned out it's less constrained than this, a fully operational car with the drive wheels off the ground will also run away to high rpm (even in Neutral): https://www.projectgus.com/2024/04/unremarkable/#on-car-test...
There's still minimal torque, as you say, so a small press on the car's brake pedal is all it takes to stop. However I think if a driveshaft broke on a real car then it'd be spinning fast for a minute or two... It kind of makes sense that the control loop is tuned for a heavy car with a fixed drive ratio, though.
I am still hopeful there will be a way to stop this behaviour via a control signal (rather than pulling the safety interlock and slamming the contactors open). Have left the problem aside until I have a mechanical brake to use for testing! If that doesn't work out then it's still usable I think, provided any EV conversion is single speed fixed gear just like the Kona.
If you have any other insights on this then I'd be very interested to hear them, though.
If the ABS is properly plugged in it will detect a fault with the sensors (which probably causes the creep to stop) however it won’t detect a mechanical fault with the encoder wheel (such as sensor not bolted to wheel) — such a fault is indistinguishable from the wheel not spinning, thus zero speed.
I think you were emulating the ABS module right? In that case, the spinning out of control is actually probably your fault. If you had not emulated this, the system would realise there is an ABS fault (from the messages not being present) and not use the ABS reported speed. It might even fall back to motor speed automatically.
Re: shaft scenario, if the motor shaft is broken the safety risk is pretty minimal because the torque wont actually cause the car to move.
I guess this is what they arrived to in the FMEA.
That's a reasonable expectation, and this got left out of the follow-up post I linked, but in the "full car with wheels off the ground" tests we actually tried unplugging the brake module of an otherwise working car and it didn't change anything (including the gradual constant rpm increase in Neutral). If anything the behaviour might have gotten a little more aggressive with the brake module missing.
Have now observed similar behaviour for all three of "spoofed brake messages with 0 wheel speeds and emulated checksums", "fully operational car with wheels off the ground", and "car with wheels off the ground and ABS/brake module unplugged". ¯\_(ツ)_/¯
> Re: shaft scenario, if the motor shaft is broken the safety risk is pretty minimal because the torque wont actually cause the car to move. > > I guess this is what they arrived to in the FMEA.
Fair enough, that makes sense. I guess if that's the case then the other behaviour is outside of the scope of what they need to care about.
If the ABS unit getting stuck causes that kind of acceleration then I'm going to point most of the fault at the control logic.
There should be some sort inertia estimation turning off the motor if the inertia don't include the wheels or whatever.
There should also be some check that output axis speed (abs sensors) and motor speeds match.
The behaviour sounds kinda dangerous and not up to ECU standards.
Tangent: creep is an artifact of how an idling ICE interacts with a torque converter. Simulating it on EVs seems like a mistake to me, serving only to make them feel more familiar to a subset of first-time EV drivers.
Source: My mother's 2024 Subaru that I help set up for her.
Standard/Manual/Stick transmissions don't have creep.
[1] https://www.yolegroup.com/technology-outlook/whats-in-the-bo...
Modular car design is nothing new and almost all carmakers thesedays do this.
Third party E-axles are mostly for trucks, where power trains and truck bodies come from different manufacturers. Heavy trucks can be maintained for decades, and that market wants repair parts available. For a car, the powertrain bearings tend to outlast the useful life of most cars.
Repair ability is a design attribute that is planned for.
Let's be real, their prices are lower because Chinese labor is cheaper. US companies have to pay US rates and import as much as they can rather than having it all made in the US.
But one thing that's hard to deny is that US and European car manufacturers are still building on top of previous iterations of their vehicles, swapping out a ICE with an electric system but keeping the existing systems, frankensteining the two together. The article itself makes note of it:
> More than five separate CAN buses, ten or more kilograms of low voltage wiring, probably over one hundred electronic modules (most with their own CPU and firmware), etc.
I don't know cars, granted, nor legislation, but surely a car engineered from scratch would be much simpler and thus cheaper to build? How does Tesla do this?
Worth noting that the car in the article isn't from a US or European car manufacturer, though Hyundai is certainly fairly well-established at this point.
But also, a lot of the stuff going on/wiring+subsystem count is not solely a factor of "making a motor assembly from scratch". For instance the steering wheel lock sensors in the article. Or all the safety-related sensors and subsystems, let alone all the infotainment stuff and related "features" in a modern car... Is BYD doing any better at reducing all that sprawl?
Compare that to US workers making about $30 per hour: https://www.bls.gov/iag/tgs/iagauto.htm
As for the engineering costs: I think reusing existing designs is a way of cutting costs for US companies. Chinese companies and Tesla designed very different stuff from scratch because they had no choice I think. Remember, existing designs are proven over potentially decades, comply with various laws, etc.
I know someone will chime in and talk about subsidies and IP theft, and while that may be true, the Chinese manufacturers are also incredibly willing to take risks and innovate, and that seems to be a reality that we do not want to confront in the west.
Let me put it another way. It is literally cheaper to ship basic materials like wood to China and have them send us back popsicle sticks. Does that sound like a cutting-edge efficiency problem, or is it a wage problem?? The same can be said about all kinds of things from food to pig iron. We're not talking about tech in any sense. The US mastered every single industry it sent to China with great efficiency, but the exchange rate situation and low wages there make it very difficult for a US company to compete.
Also, China protects its markets much better than we do. In order to sell in China you have to set up a 51% Chinese-owned outfit just to do that. Meanwhile they dump all their products on the world market with very few reciprocal relationships. Imagine how different things would be if we required Chinese companies to do the 51% US-owned franchise thing here. We could even require them to build factories here. Of course, there is no point doing that. If they did it, the goods would be just as expensive as 100% American companies. That's why we don't bother. They on the other hand do it mainly to swipe whatever knowledge they can from foreign companies. I've seen many accounts of this from US companies. You can get the Chinese to make lots of things, but if you send your design there then you risk knockoffs putting you out of business in only a few years.
Labor prices matter, but 14 years of dithering matters more.
Right. Try to register an ICE car in Beijing.[1]
[1] https://www.electrive.com/2024/07/25/beijing-increases-nev-q...
https://www.bls.gov/iag/tgs/iagauto.htm
https://www.reuters.com/business/autos-transportation/chinas...
Thus when they tried to test it they thought they requested a stately 5m/s, but the vehicle thought they were asking it to exceed the speed of sound. Which of course it wasn’t designed to be able to do, but it still tried.
That’s why i prefer to have nice hardware e-stops on prototype vehicles.
"According to the NTSB's preliminary report, customers in the accident area received gas from a low-pressure (0.5 psi) distribution network which, in turn, was fed from a high-pressure (75 psi) main pipeline via regulators controlled by sensors measuring pressure in the low-pressure pipes. At the time of the accident, workers were replacing some of the low-pressure piping, but the procedure set out by Columbia Gas for doing this failed to include transfer of a regulator's pressure sensor from the old, disused piping to the new. As a result, when the old pipe was depressurized, the regulator sensed zero pressure on the low-pressure side and opened completely, feeding the main pipeline's full pressure into the local distribution network."
In the mean time, that costs money, and since no one managed to kill people by being dumb in this particular way before….
Yeah, I kind of wonder if lawsuits/regulation might be the way to get those.
Because there will always be some sort of cost with that kind of thing.
I'm pretty sure a major reason garage doors have limit and occlusion sensors is because of regulation. (and even those suck - it is common for garage doors to incorrectly sense occlusion in bright sunlight)
I’m talking about prototype cars. The solution there to have an e-stop is to ask your technicians to put it on. No lawsuit or regulation is necessary for that.
If you are thinking about mandating e-stops on production vehicles then I don’t think that is the right thing to do. It is a complicated analysis but it boils down to that the cases where it would help should be vanishingly small, and even in those people not trained for it would forget to use them.
> there will always be some sort of cost with that kind of thing
Absolutely. And the cost of the switch is not the major component. Where i work forgetting to reset the e-stop is so common that it is the first thing we ask about when something is weird. And the people forgetting them are skilled engineers with known prototype cars. I imagine the cost of support/service calls would be huge in prod.
So wheel speed sensors drop out and the car will accelerate uncontrollably? I love EVs, but with all this complexity I wish there's some kind of mechanical disconnect or a big red STOP button somewhere.
https://x.com/PicturesFoIder/status/1832940173400699255
(apologies -- not sure of the best Twitter passthrough to use)
If not, what's stopping a "traditional" (ICE) car from (mis)behaving in a similar fashion in some catastrophic circumstance that would damage its computer?
An ecu has a far more complicated control algorithm than a electric motor controller. If it were suddenly damaged it’s more like that the engine would fail to run at all then run out of control because the ecu needs to control the airflow, fuel and spark position for the engine to run, if any of those fail to work, or stop firing at the right the exact time they are required the engine will just stop or run very poorly. I actually think this is true of electric vehicles too, it’s far more likely to stop the motor working than to have it run out of control, unless a wheel speed sensor is damaged or something.
A petrol car can be placed into neutral if all else fails, the engine will run out of control but the car wont. Also the gearbox controller is typically a different computer from the ecu.
The brakes on any car should be able to over power the engine. This is not a challenge for 99% of petrol cars because the torque they output is tiny compared to what a brake system can apply to the wheels. If you slam on the brakes the engine doesn’t even come close. Idk about other countries but in Australia this also applies to electric cars that are road legal, it’s a requirement.
the ecu is usually located in the passenger cabin or sometimes next to the battery quite deep inside the engine bay.
The only thing that would cause a petrol engine to really go out of control would be if it was fly by wire throttle and that throttle position sensor was broken in the particular way that it’s reading as full throttle. Idk if manufacturers do this but it wouldn’t be hard to design a fly by wire throttle that when it fails the ecu will see it as closed not open.
Anyway I don’t think it’s much of a concern for electric cars either tbh.
Same for the steering. BMW for example has a method where the steering wheel is physically connected but the computer can add corrections to it via a clever set of gears. See here: https://en.wikipedia.org/wiki/Active_steering
If the computer (or electric steering motor) fails the steering wheel still works.
No, I don't think any of my bench tests suggest that for this car. The torque is minimal throughout, so if the motor was pushing an actual car then it might not move at all. If it did move, even a light touch on the (mechanical) brake pedal would stop it.
My problem is that I had a bench setup with no load on the motor and no mechanical brake. I could have pulled the safety interlock (all EVs have these for emergency first responders) but this stops the motor at all costs - wasn't sure of potential damage to the motor controller circuitry from back EMF.
However, most relevant regulation (IEC61508, ISO26262, DO-178X) requires that systems controlling machines in automotive, rail or aerospace have a possibility of dangerous faults lower than 10^-9 (over the expected lifespan).
Many critical control systems like this are formally verified and/or extremely well-tested and have redundancy in both software and hardware.
https://en.wikipedia.org/wiki/2009–2011_Toyota_vehicle_recal...
'Michael Barr of the Barr Group testified[30] that NASA had not been able to complete its examination of Toyota's ETCS and that Toyota did not follow best practices for real time life-critical software, and that a single bit flip which can be caused by cosmic rays could cause unintended acceleration. "
If you've driven rattletrap manuals for most of your life, and have worked on cars, rebuilt engines, replaced clutches, rewired things that failed, yeah. That's an obvious conclusion, and I expect some people without doing that will have enough sense of what's going on to consider a drop to neutral (and letting the rev limiter handle keeping the engine intact).
But go ask most people, even in technical fields, about the details of a car, and you'll struggle to get much beyond "I press the gas and it goes." You run into this constantly if you're a "car guy" and people ask you questions about why their car isn't going. "It turns over but doesn't start!" can mean anything from "the lights are barely on and nothing happens" to "the starter relay clicks but nothing happens" to what I would consider that to mean, "the engine is rotating under the starter's power but is not engaging in sustained internal combustion."
Neutral isn't a thing most people even think about, unfortunately. Park, Drive, Reverse, and some oddball other positions that you don't want to end up in accidentally. Yes, they're useful, and yes, they solve problems, but it's not something that a lot of people would consider. Neither do they seem to consider "Stand on the brakes until the car comes to a stop. No, really, stand on them!" - because I've yet to meet a moderately well maintained vehicle that can't come to a stop with the gas floored and the brakes applied firmly (yes, I've tried, it's a standard test of mine after brake work). But if you only apply partial brake pressure, or have a vacuum brake booster, you only get a few attempts before the booster has lost vacuum (won't get any more, because wide open throttle), and if you've heated up your brakes trying without succeeding, you may very well have no usable brakes left. Passenger car brakes are adequate, but you can easily overheat them and fade them if you try, or boil the fluid, or... etc. Again, not something you'll find many people aware of these days.
I wish it were different, but "magic box I put gas into and it goes" is closer to the reality of how many people consider cars these days.
Car starts accelerating out of control? You have several options that you can try in no particular order (except the first one, which should always be tried first).
Lift your primary foot to confirm you're not accidentally pressing the accelerator instead of the brake (this is surprisingly common). Dump the clutch with the other foot at the same time.
If the engine is still going nuts, shift to neutral and/or turn the ignition off (DON'T remove the key yet; that will lock the steering wheel, which is a bad idea when you're still moving). Coast to a stop somewhere safe; your brakes will also still work for a while. You won't have power steering, but you won't need it. Remove the key -- this WILL kill the engine (if you didn't already switch off). You're done.
My driving instructor did this to me in an empty supermarket car park. Then he did it again until I got the hang of it. It's a valuable learning experience.
At the time this was in the news, I was never able to find a coherent explanation of whether any such bit-flip affecting some piece of software on some module, would also inhibit the interpretation and implementation of a neutral drive mode selection.
You need training to guarantee correct reaction when things go wrong.
Here's an anecdote: I used to drive a car with a standard transmission in Los Angeles. In quite a few places, the parking spots have a "trench" in the front for drainage. So, you can place your car in reverse, release the brake and have your car roll forward quite a bit (the trench makes an even stronger downward slope on a hill that is already pointing downward) before the clutch engages. A bit surprising but nothing that weird for someone who drives a stick.
Now, have that sequence happen to someone driving a car with an automatic transmission. They shifted to reverse, the car is rolling forward more than they expect and is on a hill, they hit the gas to arrest the roll, the transmission engages and the car shoots in reverse. Pray that there isn't anything close behind them or they're going to run over a pedestrian, put their car through a wall, etc.
2) Because the majority of the people who had "uncontrolled acceleration" were old.
The vast majority of the cases were very likely driver error by older drivers who had incorrect habits ingrained. Toyota probably would have won the case if this was the only issue.
Alas, Toyota lost the case because their processes for safety were such a complete shitshow that they were going to get destroyed in court.
High end brushless motors like EV traction motors are "vector" controlled and instructed by desired torque, not in sinusoidal phase shifts and desired RPM. Back EMF voltages are measured at output terminals of drivers, and errors between expected vs measured voltages is fed back to the driver thereby achieving requested torque, somewhat disconnected from RPM.
This means motor RPM always diverges into +/- infinity with any non-zero torque request under no-load condition.
There is another quirk of note, that some EV motors seem to jump into an open-loop mode when BEMF or rotor phase detection reports failure, and that might also result in unintended acceleration, but that's probably not it.
Part 1 https://www.projectgus.com/2023/03/ev-conversion-one/
Part 2 https://www.projectgus.com/2023/03/ev-conversion-two/
Part 3 https://www.projectgus.com/2023/10/kona-can-decoding/
...and the follow-up posts:
Part 5 https://www.projectgus.com/2024/04/unremarkable/
Part 6 https://www.projectgus.com/2024/10/simplifying-bench-kona/
This is just sad for electric cars.
With an electric car, the control of the motor is DEAD simple, and you already have your electrical power. You really need like 2 modules/computers at most. Motor controller that takes DC power and converts it to the phase power to drive the motor, and the "main" computer that includes a PDU and manages the systems of the car.
Optionally a 3d entertainment cluster, but honestly, you can just include a slot for a tablet with a USBc plug from the main computer, and an app, and that would be better than whatever manufacturers are doing now.
- EVs need significant volume for batteries. The only places available in a combustion vehicle are the engine bay and the gas tank. If you put batteries in the engine bay, you'll mess up the weight distribution. The volume occupied by the gas tank isn't nearly large enough to house a battery for decent range.
- The extra weight of the batteries requires changes to the suspension and tires.
- EV motors have lots of torque. If you use the original transmission, you'll need to limit torque based on which gear it's in. Any replacement transmission will need to be designed for that car chassis. It's not easily adapted to other models.
- Combustion vehicles are designed with an accessory belt in mind. The air conditioning, power steering, and many other components are run off of these belts. An EV motor doesn't spin while idling. These components will need another power source, or they'll have to be replaced with EV-specific components.
- Combustion vehicles use waste heat from the engine to heat the cabin. Unless you live in a mild climate, a retrofit will need electric heating coils (or a heat pump for maximum efficiency).
And after making all of these modifications, you'll need to deal with regulations around making sure the vehicle is street legal. Those can differ greatly based on the state and the model year of the vehicle you're converting. Considering all that, it's unlikely that you'd save money by converting an existing vehicle.
An EV kit car might make more sense, but the market for those is quite small.
It's just mostly based on salvaged Tesla motors and batteries as far as I can tell.
(I think Jaguar and Ford talked about selling EV crate engines for their older models but I've not heard about that for a while)
Frankly, if it’s common in Classic Cars, it’s probably not a good idea to do it in a production vehicle/practical situation.
You're forgetting: exhaust and transmission tunnel (for RWD/AWD cars). Just those two areas alone are a substantial amount of space. Add in space in the sub-trunk area (that might have a spare tire, or just free space)... and you can cobble together quite a bit of capacity.
> EV motors have lots of torque. If you use the original transmission, you'll need to limit torque based on which gear it's in. Any replacement transmission will need to be designed for that car chassis. It's not easily adapted to other models.
Why would you use the existing transmission? Just use the transmission built into the EV motor... they all have them.
- extra weight: see above, and removing engine and other components
- yes the EV motor will need to be aware, that's a control issue not some physical issue
- another power source.... like, a battery bank?
- waste heat for AC: heat pumps
Yeah, I know I am massively handwaving. It's a really hard problem, but some EV retrofit for "incumbent" cars (eventually to be "classic") would save a lot of carbon.
But it's not going to happen, it's too labor and skill intensive. Capital hates everything that is labor/skill dependent. It might be able to be assembly lined to some degree: common car platforms of major manufactures would help. The engine lift isn't THAT bad for many platforms, the hood removal - bolt loosen - engine lift could be done in 3-4 "disassembly line" steps.
EV motors are pretty compact from what I can tell, so the engine compartment can probably accommodate enough high-density (sulfur chemistry in 5-8 years) batteries to get a 150-200 mile range.
The REALLY OPTIMAL conversion target should probably be a swapout with a hybrid drivetrain, if we could get a compact rotary recharge engine developed combined with a compact EV motor. The transmission interface is still a PITA, but the heat excess and other things might be conserved better, and there might be room left over for 50 miles of all-electric range.
That would deliver 90% all-electric trips in-city, regen braking, but keep ICE power for all the legacy accessories.
We should have been working collectively on hybrids within a couple years of the Prius being released in the late 1990s. We should have forced all auto manufacturers to have hybrids for all cars in 10 years (regen braking and city efficiency would have been 20% gas savings right there, maybe more).
Then 10 years after that have forced plugin hybrids with increasing thresholds for all-electric range.