A Black Box For A Motorcycle


[Lukusz] has a new motorcycle – a Yamaha XJ6SA – and since it hasn’t been in an accident yet, he thought building a black box to record telemetry from the last 30 minutes of riding would be a good idea. While the project isn’t complete yet, he’s already reading data coming straight from the engine control unit.

After figuring out most of the pinout for his bike’s ECU connector, [Lukasz] found one wire that didn’t actually do anything. This was his ECU’s K line, a serial output that is able to relay the state of the gauges to external devices. The electronic spec of the K line is a bit weird, though, but luckily after finding a chip to convert the signal into something a logic analyzer can understand.

With a logic analyzer connected to the K line – and setting it to receive on at 16064 baud – [Lukasz] was able to get a whole lot of data directly from his bike. In the future he plans to pass data such as speed, indicator lights, RPMs, and the current gear to a Raspberry Pi for logging.

34 thoughts on “A Black Box For A Motorcycle

  1. Why? the telemetry in a black box is 100% useless in a crash. a dash cam showing the dumb blonde in the Giant SUV suddenly cutting over and smashing the motorcycle into the railing is far more important to having the victims family sue the SUV owner into oblivion for damages and loss of life. Any of the cheap china $60.00 dash cams will do a lot more for recording what actually happened than a black box recording throttle position,rpm,speed,etc ever will.

    Now recording data for racing or for analysis later? Yes. but you need more than 30 minutes in a loop for that. Memory is cheap, dump to a 4gb card and record an entire day at the track and couple it with GPS information so you can see that you are not approaching the turns right, or that the bike is leaning out when you are in a very hard lean.

    1. I’m guessing you didn’t read the source article, since he specifically indicates he is going to include footage from a dash camera. The point of logging all the other data is to overlay it on the video feed, thus not only showing what was happening around him, but proving that he wasn’t being an idiot himself.

      Anyone can mount a dash cam and record the video. The neat stuff with this is logging the data from the bike itself as well and combining it into a single feed.

  2. kinda unrelated (and yeah i agree this is USELESS)
    but in my 2011 ninja 1000 i found in the central computer a UART header … connecting to it (3.3v uart-usb 9600baud) and hitting ? brings up a menu you can use to simply get feedback (speed, pressure, rev exc)
    this was one of the earliest models so they might have changed it

    1. Whoa that is awesome, I also have a 2011 Ninja 1000 and this makes me want to go play with it a bit.

      Do you happen to know if the 1000 has a gear position sensor and if the interface provides that information by any chance?

      1. yeah it does … G gives you the gear number and N tells you if you are in neutral … G wont tell you if you are in neutral tho …
        i want to use this to make a video overlay for my onboard camera XP

        but also as i said i have a very very early model the boards/firmware might have changed! also (tho i doubt it … but i do notice clear differences on the innards between it and later 2011 models …)

        1. And a little correction of mr Brian Benchoff post : my bike does not have a gear position sensor. You can only tell if it’s neutral or not. I want to log only the velocity, RPM, temp, turnlights and brakes activity.

          1. If you have speed and RPM, you can infer gear position if you know the ratios.
            RacingMeter for Torque on Android does this. You put in your speed at 2000RPM in each gear, and it will calculate your gear ratios and infer gear position based on that. It works fairly well, although it could use a filter for some erroneous position reporting at low RPMs.

  3. I think you guys are missing the point of hack-a-day. The question to ask is not “Why?” it’s “Why not?”. Many of the hacks featured on this site are useless, except for the learning involved and because someone wanted to see if it could be done.

    Bravo to the OP for doing something just because he could.

    1. I certainly will put a sticker with your comment (a bright red one) on the cover so my kid could find it on the crash site. He is only 1.5 yrs old, but he’d love it! Thanks!

  4. Hi guys. a “black box” is only a name – as you pointed out, not especially fortunate one (same goes to telemetry – I guess I lack some English vocabulary – my apologies for that). But you’ve got the idea with one exception : as I’ve stated in my post, this acquisition stuff will be hooked to a PI with camera module, and in the end it will give me nice video with velocity and RPM in overlay. If you saw MotoGP, you get the idea. Regs.

    1. Sounds cool. Maybe you could use a POV RC plane HUD to immediately overlay video? Use a standard camera, plug it into the hud, and record it’s output with a dedicated recorder. Perhaps such huds exist for ground vehicles or with custom content?

  5. Hi guys. a “black box” is only a name – as you pointed out, not especially fortunate one (same goes to telemetry – I guess I lack some English vocabulary – my apologies for that). But you’ve got the idea with one exception : as I’ve stated in my post this acquisition stuff will be hooked to a PI with camera module, and in the end it will give me nice video with velocity and RPM in overlay. If you saw MotoGP, you get the idea. Regs.

    1. I was wanting to mount my Pi in my vehicle as a dash/security cam. I found that the USB port was too slow for HD video. I’ve got a camera module on order. I was wanting to overlay GPS info on the motion stream, but Motion only has settings for date/time. Would love to hear if you find a way to overlay the data.

      1. I went exactly the same way as you. My webcam is covered in dust on the shelf now, as I discovered that RasPi has serious problems with fast asychronous USB transfers. It heavilly dropped frames, or even freezed. Wandering onver Internet revealed that many had the same problem, and it is because of buggy USB drivers in RasPI. In my opinion nothing could be done but use the new camera module.

  6. @SpiralBrain : I found it somewhere on the net and it was cheap (~$1). We’ve got a nice search engine here in Poland which gathers info from electronic stores over the country (elecena.pl). I bet you have something like that as well.

  7. Saw a hack awhile back where someone added a function to a mostly unused buttin theur bike via can bus. Uc monitored can bus for button iD plus press/release pattern. Seems you are half way there. ..

  8. Nice commuter bike. I wouldn’t mind being able to log that information when I’m out riding. Anyone that does not see the usefulness of this is clearly not a motorcycle owner.

  9. Years ago I took a bus to yamaha with sniffer which make the algorithm get immobilizer. If you want more information about commands etc let me know. The conversion to ttl can be done simply with one transistor and one diode. I do not think that’s right post immobilizer algorithm because that will allow you to boot any yamaha since the immobilizer and the ecu are not paired and works for any yamaha. Last detail bus communication speed is 15625 Regards

    1. Hi. I would definitely love to learn more about those commands. I know only one of them (0x01), but maybe there is somethin else I could use. As of baud rate : I suspected that it has to be 15625 but in my bike it apparently drifted to little higher value (about 3% higher). I guess this is the reason why every data frame has a checksum at the end thus devices can discard malformed packets. Could you post me some more info about those commands you know here in another commend, or under my blog post? Or write me a priv if you wish. (lukasz dot iwaszkiewicz AT gmail)

    2. Everytime i search about how to communicate with ecu, reading bike data. i ended up here :D

      Hi iwasz, still working on this?

      Hi Pipo, can you share info about those commands?
      i can send a byte (0x1, 0x2, etc) to ecu and get some response just like this post.
      how to enter diagnostic mode? i’m tryng to make an FI tools. you can send me email to: hardie19 AT gmail DOT com


  10. This is awesome, I’m going to connect this up to my bike. there surely must be a way to access the other sensors connected to the ECU ( mainly as the FI diagnostic tool connects to the same line and can measure fuel rates, air flow mixture etc). Meaning you could perform engine profiling, fuel consumption rates, link it up with a GPS enabled AVR and you could have the whole whammy. Find out which routes to work use the most fuel and what points during the ride the engine is under most strain. by looking at the FI tool you could even make it so you set two modes AVR sent to the ECU using the K-Line, one for performance and one for Efficiency. This also could be used to create a new digital instrument panel. I don’t see why he is hoping to use a PI though. Why not do it all on the Arduino/AVR?

  11. Looks interesting. I believed all motorcycle vendors put the data coming from various sensors behind a layer of encryption or obfuscation at very least in order to discourage hacking. Anyone know of sources for information about reading data on different brand motorcycles?

    1. Don’t know much about other brands, but I doubt the data is obfuscated / encrypted in other bikes. ECU (main computer) in my moto has a mitsubishi logo on it, so I suppose Yamaha has used something that was already available in the industry (and possible implementing some standards). Maybe others does the same? Also I’ve read somewhere, that other popular brand of ECU’s is DENSO.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.