• There has been a recent cluster of spammers accessing BARFer accounts and posting spam. To safeguard your account, please consider changing your password. It would be even better to take the additional step of enabling 2 Factor Authentication (2FA) on your BARF account. Read more here.

Z3n's Project Barn

Z3n

Squid.
Joined
Feb 3, 2005
Location
Oakland, CA
Moto(s)
help me prove my commitment to Sparkle Motion.
Starting to document my builds more directly, so figured I'd spin up a thread here.

I've got a couple of things in the pipeline right now, so expect updates in the short term on my RC890 project (or as I lovingly refer to it, the wish.com RC8C):
F7pEU6b.jpg


Waiting for an exhaust from HP Corse, and some titanium from TiCon to start on it.

I've also got an electric enduro I'm in the process of building, retaining the clutch, transmission, and original crank. I've been through a few iterations in different frames, but the right call here ended up being converting my 2011 KTM 300 XC.
jmZyewv.jpg


Today I finally had the time and motivation to tear down the dirtbike:
s4TqXoH.jpg


And drop the bottom end into the bike:
xaJjF5h.jpg


I've got the rough mounting locations figured out:
ltP8GY2.jpg




Next steps: Split the cases, remove the conrod, weld up the crank so it can't rotate around itself, balance it to minimize vibration, weld a sprocket mount to the rotor (or just lazyweb and weld the sprocket directly), build the motor mounts and battery box. Then find a location for the controller, wire everything up, and it should be ready to go.

As to why I'm going through all this work, well:

1. The Brammo Empulse R taught me that a transmission on an electric bike actually rules. Having quick acceleration at low speeds and a high top speed is good! You don't need as many gears on an electric - a 3 speed would probably be fine, maybe 4, but a gearbox gives back much more in usable acceleration than it costs you. This goes double when you can run the motor in higher efficiency ranges because RPM isn't strictly linked to road speed. In the early days of cars, we compensated for a lack of transmission gears and quality with bigger motors, but packaging and motor availability is a problem on bikes.

2. A clutch and flywheel is critical for managing rapidly variable traction and aggressive power delivery. If you're on a motocross track that is groomed and has relatively consistent traction, you don't give up much. But for hard enduro, trials, and getting the most power to the ground when you need it, you can't ride the same way if you don't have a clutch/flywheel to store and deliver bursts of power to the ground. It also means you can modulate a much more aggressive power delivery, because when you need to reduce power you can just slip the clutch a bit.

There are a few transmission / clutch motors out there, but none with the flywheel mass I want or the power level I want, so here we are.

With 2.5kw of battery, I should be able to do about 20 miles with this at ~50mph, which is fine for our hard enduro days where we'll rarely see those speeds. There's space for plenty more battery. Weight should be equivalent to stock, but much lower CoG.

I've also got an 890 Adventure I want to design a new rally tower for, an aircooled ducati superbike build, the second endurance minimoto bike me and my buddy work together on, a bunch of flashing and ECU tuning stuff in the pipeline...no shortage of fun things to play with.
 
Last edited:
A lot of love right there.

Your pics did not link. I would like to see them!
 
Pictures should be fixed now. Titanium showed up today, but no time to work on the bike. Maybe I'll have the time to split the cases and do the welding tomorrow :)
 
Now that is what I am talking about :thumbup

Thank you... solidly thinking some love for 2 wheels!
 
Oh.. and super jelly of your shop!!!! :Port
 
Managed to make some good progress after work today!



Split the cases:

ZlzckPy.jpg


This Motion Pro crankcase splitter is very expensive but also a wonderful forever tool.

D00mOuf.jpg


No conrods allowed:

XHvgWtx.jpg


If you don't want to retrue the crank, just angle grinder the conrod off.

FyjkAkA.jpg


Welded the crank up, as a 2 stroke crank really is not designed to be driven off the rotor side:

Xr1s7Fv.jpg


And the bottom end back in the frame and ready for me to start on building the motor mount, battery box, and controller mount.
lDd3lHx.jpg


Not so far away now...
 
Last edited:
Things slowed down a bit, but still making forward progress. I did temporarily get the motor running just to make sure everything works, so a short clip of that is available on my Instagram if you'd like to see it.

This build is a bit more slapped together / rough, but I'm not entirely sure the concept is going to work, so it feels like investing time in doing proper fabrication work is wasted. If this works out, I'm going to want the next one to be a new model chassis anyways, so the goal is finished as quickly as possible, so I can start testing and see how I feel about the overall setup. Could ride it and have it be awful, after all.

With all the parts, it looks like it'll weigh around 245 pounds, which isn't too bad with a full tank of electrons. I've got a very basic battery retainer bent up:
ANUMVp9l.jpg


Need to similarly bend up some guards for the battery itself, and then it's wiring, a chain guard, mounting the controller in what once was the airbox, and reinstalling all the parts. Hopefully I'll have it finished up tomorrow, but we'll just have to see!
 
I got the cases sealed up, and the upper motor mount fabbed up:

J3auviil.jpg


Following that, I discovered something pretty disappointing - the placement of the electric motor + crank sprocket is such that I'm perfectly between the link sizes on the chain.

xoEqeJ5l.jpg



Need a half link in 428, because I welded on the lower sprocket, the upper sprockets for my particular QS138 configuration only seem to be available in 520. Don't have enough space to significantly move the motor, or have enough space to fill the slack of a longer chain with a tensioner assembly. Half links that don't use a cotter pin assembly seem to be pretty exclusively available from overseas dealers. So it goes!


I've got halflinks on order, but I'll probably get impatient and just fit the QS120 I have instead. I designed everything to be pretty modular, so it's just 3 parts (upper and left / right side brackets) to swap motors. That'll drop me to about 50% of the power I had intended, but it will be a bit more power than my electric motion trials bike with the option for much shorter gearing, so maybe it'll all work out.
 
Last edited:
I've got a fully enclosed chainrun with delrin sliders now - swapped the QS120 on, remade motor mounts. Might need to go to a 520 instead of the 428 that it came with. That'd also open up some other options for gearing. I can adapt the delrin setup to have a spring loaded tensioner on it, although given that there's no major movement in the assembly, I'm inclined to just let it run as is loose. Very short run, after all.
eUhZfwml.jpg


Unfortunately, I didn't have a 520 chain floating around that was long enough to fit, so have to wait until that shows up.
2qnvO4Zl.jpg


Starting to come together though - I'll need to hack up the gas tank to make space for the battery, and still need to bend up a battery box and I want some rubber inside that box to make sure there's a little extra flex should I pitch the thing into a rock. Also need to seal the battery box so that the battery doesn't get exposed to water in the rainy PNW.
SWqKyj0l.jpg


Weight as it sits with the smaller motor and controller was 238 pounds. It'd be lighter still if I made proper engine mounts and brackets, but that'll come with time. Probably can sneak under 250 pounds for v1, and maybe a bit lighter for V2.
 
Transmission is splash lubricated and still sealed, so nothing changes there.

On the crank side it's normally lubed by premix, so adding 200ml or so of normal oil / premix will probably keep everything happy. I can suck it out and replace it regularly, and the bearings will see a lot less stress due to the lower power and RPM, plus less spike loading from combustion events. Should be fine, or at least, no worse than the most of the rest of the sins I'm doing :laughing
 
Drive chain showed up today, and I did a quick spin on it. The electric motor configuration is too soft off the bottom when you have a clutch, it doesn't feel very responsive. Also probably want to turn down the regen. It needs the bigger motor for sure, although aggressive clutch use works okay at low speed. The shifter is also sticking slightly, despite everything moving cleanly when the cases were originally assembled - I think something is binding in the clutch cover. I need to more carefully balance the crank, install the larger motor. It's also loud, kinda thinking about running a belt rather than a sprocket. But it's an initial success, so can't complain! Pictures and video to come when it's assembled.

Also, all of my ECU flashing stuff showed up and got activated, so time to tune out the flat spot on the 790 Adventure R.
 
Following your ECU stuff closely.
I am in the process of putting an Ixil decat pipe on my 23 890r adv, excited to hear and ride it, hope it's not an ugly sound with the stock pipe, also hope no oddities with fueling. Ran great in my opinion stock, just wanted to lose weight and heat.
 
Yeah, seems like sometimes the decats make the stalling a bit worse, sometimes they don't.

If you'd like to see the E-moto in action:
https://www.instagram.com/p/CyWjQrOSrAv/

I'm feeling a bit tired of working on the E-moto and I have some parts I'd like to have arrive before I make more progress, so will probably spend the next few days instead focusing on cleaning up ECU maps and getting my ECU flashing process all sorted. I've got...3 X90 platform bikes to set up, and 2 waiting in the wings, so getting that done will really help a bunch of things move forward. Also, hopefully my muffler shows up soon, and I'm getting eager to make some progress on the RC890 airbox, subframe, and fairings. If I can get the tuning on the x90 platforms all sorted out, that opens up the chance to make the exhausts I really want to make, which are titanium rally pipes, trackbike pipes, and the matching intakes.

Plus I still have the forged carbon rally tower stuff floating around in my head - too many projects, not enough hours in the day!
 
Last edited:
There are a lot of ways to help a motor run better - I’m a big fan of keeping things as close to OEM as possible, as the OEM systems often have significantly more capability tucked away in them than is exposed to the consumer, and piggyback units tend to fail in annoying ways over time, as you’re often tapping wires, installing wiring harnesses that aren’t built to the OEM standards, don’t have the same vibration / anti-chafing attachment points, etc. The less complexity you can add to a system to achieve your goal, the better. 

Also, modern ECUs are significantly more powerful than most people give them credit for. The OEMs have to tune their systems not just to address the variability present in mass production, but the broad variety of international emissions controls, a massive range of riding conditions, gas quality, etc, all while being reliable for an extended period of time and in conditions of neglect. I also come from a roadracing background, where the race ECUs are commonly available and often used, and where companies like Woolich and others will reflash the ECU to add capabilities like quickshifters and the like. As KTM uses a more modern canbus system, with separate control system for the ABS (Bosch), motor control(Bosch), Gauges(KTM proprietary), immobilizer, headlight (KTM proprietary), etc, it’s important to make sure you’re changing the right parts of the system. It’s all one system to the rider, but when you get into the weeds, it’s much more complex than that. 

With all of that said, this is primarily focused on KTM Bosch ME17.9.21 ECUs, with some correlaries to other ECUs. I wasn’t able to find a primer on these specific ECU systems anywhere online, so I figured I’d write one and hopefully sharing that knowledge will come back to me in some way in the future. I’d really appreciate insight from anyone who understands more authoritatively what the sub-maps are for in the KTM systems, as this is all reverse engineering, and reverse engineering is fraught with assumptions. I’ll lay out my assumptions, which areas I’m confident in, and which areas still need additional exploring. 

Terminology

  • ECU: This is the processor / brain of the unit. It contains a few types of memory, but we’re primarily concerned with the Flash memory, which contains the specific programming for that ECU for a given use case. An ECU is generic until it is programmed - KTM uses the same Bosch ECU as Hyundai uses on their EU i20 1.2l 4 cylinder motors. 
  • Flashing/Chiptuning: This is the process to change the programming on an ECU.
  • Binary: When you dump the contents of an ECU, you’re dumping the physical ones and zeros stored in memory into a binary file. That binary file can then be modified and reflashed into the ECU to change specific settings. 
  • Maps: There are a large number of maps in the ECU that help the ECU understand what to do during driving. The ones we’ll primarily talk about will be: Volumetric Efficiency, Manifold Air Pressure, Driver Wish/Throttle Request Maps, Lambda Maps, Torque Monitoring maps. Naming on all of these maps is incredibly inconsistent between ECU flashing software, and there’s a large degree of inference around each one. 
  • CANBUS: How the raw communications are done between control systems on the bike - ie, the ABS needs to talk to the gauges, which talks to the ECU - they use CANBUS to communicate via the bike’s wiring harness. 
  • OBD2: An industry standard interface for datalogging/error reporting - polls from CANBUS systems. 
  • J2534: A communication protocol for communicating with with ECUs - used to dump and reflash binaries. 
  • Checksums / validation: The ECU checks before it runs that the code hasn’t been corrupted. We are effectively “corrupting” the ECU maps when we change them away from OEM specifications, so depending on design, you may need to generate a new checksum.
 

The process for tuning an ECU: 

Dump the binary from the ECU.

Identify the relevant parts of the ECU memory for your use case, and adjust them to achieve your tuning goal. 

Reflash the modified binary into the ECU. 

Dumping the Binary

There are a number of ways to do this, but for the Bosch ECUs, the easiest way is what is called a “bench flash”, where you provide power to the ECU, and then dump the binary from the ECU via manually connecting to the CANBUS and GPT pins on the ECU. 

I’m using Scanmatik 2 with the Bench cable as a J2534 interface, PCM Flash with Module 71 for Bosch ECUs to dump and reflash the binary, a Rigol power supply, and a custom built bench cable from a compatible wiring harness. You can see my labels on the ECU connector wires that show which wires are which. 

All that leads to this:
NjDpjIsl.jpg


I’ve also used AlienTech’s KSS v3 to dump binaries, it works fine but I prefer this setup as it is a fair bit simpler. However, they provide a lot of the relevant information, including pinouts, and a lot of process support for people doing it for the first time. It is also pretty expensive, and requires an ongoing subscription, although they are constantly releasing new stuff. 

Tuning

I’m using a combination of TunerPro, WinOLS, and ECM Titanium. TunerPro has a much more straightforward interface, but WinOLS is much, much more powerful, and very useful for identifying and tagging maps. ECM Titanium is much more constrained, but also a lot less intuitive for me. While these systems allow you to interact with the binary, you need a separate definition file (TunerPro calls this an XDF, WinOLS calls this a OSLX) to understand which maps mean what. ECM Titanium includes the definition files, and you can reach out to AlienTech for support. 

I’m a fan of OldSkullTuning, who makes TunerPro and sells definition files for TunerPro and WinOLS, so I use their XDFs - reverse engineering isn’t an easy thing and they provide a good baseline. 

Reflashing

This goes back to the PCMFLash setup, where you take the binary you modified in step 2, and write to the ECU instead of reading to it. 

I purchased my tuning software and hardware through ecutools.eu, and have been quite happy with them. Power supply is a Rigol supply, as I expect to be doing some additional software / hardware development in the future. Anything that can provide 13.8-ish volts to the barrel connector on the bench harness for the Scanmatik 2 will do, though. They have a cigarette lighter adapter, so they expect you to use Scanmatik primarily for OBD2/CANBUS monitoring - I just cut that off and wired the leads into my power supply banana plugs. 

Following the reflash, either using a dyno, datalogging while riding, or other monitoring tools, you can go and validate if your changes were successful. 

Okay, now that we’ve got all this laid out, the next step is to actually change the binary and test the changes!

My apologies - the formatting isn't great here, but there's also a copy of this post here:
https://ttconstructs.com/tuning-ktm-790-890-bosch-ecus/
 
Back
Top