Thank you for coming to reverse engineering marine engines. How to make powerboats do your evil bidding. Your bidding may not be evil, but that's really up to you. What we're going to talk about is different types of boats, different type of propulsion systems. It's going to start with a broad overview. It may be repetitive for some of you, and then we'll move on to like the best architecture and how to make this work properly, or how I've made it make it work properly. So a quick overview. So major outboard OEMs, and that's an outboard motor for those of you who haven't seen them before. That's actually four of them from Mercury. The major OEMs are Mercury, who's owned by Brunswick. We're going to come back to them a bunch. No specific malice against them, but we're going to come back to them a bunch. Yamaha, same people who make the pianos, make a lot of jet skis and jet boats. Honda, Suzuki, those are the outboard manufacturers. So let's talk outboards for a second. So there's significant consolidation in the outboard market. They're really only the four or five manufacturers that I mentioned when you get above about 150 horsepower. And when you start to see, you know, bigger engines that are more expensive. Most OEMs are pretty locked down. And we're going to get into that later. They do not want you messing with their engines. The answer that I've had from Mercury when they sent me a nasty letter was, we don't want the legal liability for this. So, you know, fine, but we're at DEF CON, so all that goes out the window. As we can see here, that's a Yamaha. So see that giant sort of thermos looking thing under the motor? That's the integrated steering motor for Yamaha. So if you buy this, you have opted out of the significantly standardized steering market that governs most outboards for the last 25, 30 years. And you now must buy Yamaha's helm, which is kind of annoying. I mean, it works really well, but it's kind of annoying. Their helm is force feedback. It's all CAN bus. It's kind of cute, but like you're in this for a lot of money now. So the reason you don't see companies doing autonomy and doing open buses is largely legal exposure. They both don't want you to warrant, don't want you to make warranty claims on the engines and don't want you killing people, quite frankly, accidentally. So let's talk more about inboard and IO. IO is sort of an odd one, but I've spent a bunch of time wrenching on IO. So I thought they deserved mention here. So the major manufacturers, they are Yanmar, Mercury, Cummins, Volvo, MTU, CAT. Caterpillar is notoriously locked down with their protocols. Like they will charge you out the wazoos. And a lot of what we're seeing in tractors with John Deere and the general hatred of them is very similarly reflected in Caterpillar. So here we've got a picture of an IO. It's basically the worst of both possible worlds. You have the lower half of an outboard that always stays wet and can't come out of the water and an inboard. And then you have an inboard engine, which is a straight driveline. There are a bunch of options there. So let's talk a little bit more about these. These are a little bit weirder. They're a lot less technically sophisticated than most modern outboards. This is for a variety of reasons. Manufacturers are way less vertically integrated. I mean, CAT makes a ton of engines for a ton of people, but their marine market isn't huge. The legacy control systems is really what people are trying to support. When I say legacy, I mean cables, like push-pull cables for throttle and shift. Let's say you bought yourself a nice Nordhavn yacht. You've really won the lottery. It's probably gonna come equipped with a helm. So you push the throttle forward. It's gonna send an electrical signal, either analog or CAN, to a box that moves a servo that pulls a cable. And then the engine go faster. The engine may have stuff like electronic throttle bodies. And actually, if you come to Maritime Hacking Village and plugs to come by the Maritime Hacking Village, it's super cool. We've got some great stuff, including boats with outboards. They didn't let me run them here. One of those motors is a Honda 150 that has a cable-driven electronic throttle body. So it's super weird, but it's basically a legacy support for a modern engine. There's an ECU on the motor. So these are way less sophisticated. They're made in way less volume. They're expecting legacy systems. So let's dive into those control systems. But outboards have significantly complex engine management. This Helm Master is from Yamaha. And I'm personally less familiar with Yamaha than other brands, but you've got a joystick there. So when you enable joystick mode, it can do GPS. So if you have four engines, for instance, it's gonna do some intelligent leader-follower stuff with the engines, because you probably only have two Helms rather than four. We're getting away from the sort of 747 style. I have six joysticks, I need to move them forward. That's all going out the window because digital. They're moving to CAN bus straight to the Helm, which is where some of my research starts to fall off because I need to go buy a digital Helm and hook it up to a digital motor, which I'll do eventually. Station keeping, say Virtual Anchor or Skyhook are these proprietary products that we as control systems folks sort of know about already, but they're being packaged and commoditized by Mercury, by Yamaha, and there's a big button that says, keep my boat in one place. And then it will use GPS, CAN bus, and advanced engine and steering control to try to do that. But these are all giant black boxes and they will absolutely not tell you how any of this works no matter who you are. They do not let Garmin do it, for instance. We talked legacy control systems. So that is an actual product from Glendinning. And we can talk more about them later. That literally pushes and pulls the cables. It sounds dumb, but that's a servo box that does that. And I don't know, I think that's like $1,600 or $1,700. It's very rugged. They have a bajillion hours on them. It will work. We'll also get into how to hack these guys for extra bonus points, because they won't tell you and their docs are terrible. Sorry, I'm going to actually name names in this presentation. If you're from Mercury, I apologize. I'll buy you a drink later. So a lot of modern ECUs, we talked about the ECUs being on the engine and controlling the actual firing sequence. Those are getting upgraded due to emissions concern, like tier four emissions, stuff like that. That's government mandated, but the interface itself is not. So cable-driven systems, still super common. If you're going to go out and buy a motor on Craigslist, it's probably going to be cable-driven. I can speak to a little bit of the Navy, US Navy autonomy looks for cable-driven motors because they use this exact setup. People that make these systems, Glendinning controls, C-Star is a name we'll come back to. So that's C-Star Dometic. They got bought out by, I think they're Danish, Dometic. They make refrigerators and campers and other stuff too. ZF micro commander, weird Zeppelin fact, because Zeppelin facts are awesome. ZF is the only surviving company that made original equipment for Zeppelins. And that's what the Z stands for. So NHK, which I haven't personally worked with, but same, same, you move a handle and servos move. Let's talk about hacking jet skis. I have a theory about jet skis that whenever anybody gets on them, they immediately become a jerk. No matter how nice they are. I have suffered from this myself. So honestly, the biggest hack I have here is read the manual. Like, I'm not kidding. We'll get into the actual manual pages in a second. And I realized this is an eye chart, but we will dive in deeper. So this is the master wiring diagram for a 2022 Sea-Doo. It was just the one I had handy. Yamaha is similar, similar enough. What this is showing you is that that's the throttle and it has two hall effects, which are basically digital voltage dividers. That's an OEM part they're buying from someone. So that's how to find out what it's looking for. And then you read the manual and it tells you how to tone it out because this is all designed for depot level maintenance. Stick a multimeter on it. How does it work? So the ECU is doing the digitizing from the command input. When I squeeze the throttle, I want to go faster. Two hall effect sensors are outputting voltage. ECU is reading it. ECU is then sending either CAN or analog to the throttle bodies and the reverser and the reverse bucket. And it's managing all that behind the scenes. So we see from this graph here, and to shout if you can't see, also the slides are available. We basically see it's just looking for two ratio metric voltages between, you know, what is it? 0.15 and 1.4. Like making these really isn't that hard. You like digipots are a thing, but also you can get DACs that will take PWM and output actual honest to God voltages. Slew rates, you should check beforehand. Like don't rack these around. Try to emulate what a human would do as a rate of change. Now do also keep in mind, jet skis specifically are designed to be driven by the lowest common denominators. They're expecting somebody to do that and the ECU to not error out. Honestly, jet skis are really easy to autonomate. Be careful though, please. They go fast and they get away from you quickly. But the TLDR from this slide is, look for the voltages and then make them and just make the voltages. And we'll get into the right hardware and like the right place in the stack to do that and the appropriate hardware to do it. But let's talk about Mercury DTS. So DTS is a significantly more complex architecture. I know this is another eye chart. I pulled this out of the Mercury Verado manual. I think this is a 2020 engine. DTS-1 is Mercury's architecture pre-2022. DTS-2, they moved to CAN coming out of the helm itself. This is the one I need to go by and hack on. Once you start scaling into multiple motors, multiple helms, so let's say you've got a flybridge, a rear control station, a forward control station, this diagram becomes absolute spaghetti. The takeaway is you need multiple command modules, which is what Mercury is calling them here. We're gonna zoom in in a second. Don't worry if you can't read it. Mercury has at least two CAN buses that are off engine that are giving these commands. Honestly, we're not even gonna bother to reverse engineer those. We don't have to, like why make our lives hard? So Mercury's philosophy sort of divides into these three abstraction layers. Engine space, where each engine doesn't know anything about the other engines, and it's a very traditional ECU. So that's, again, controlling piston firing, dynamic timing, water pumps. If it gets too hot, it's gonna shut it down. All of that is contained on each engine. So that's engine space. Then you have boat space, which is where these command module thingies come into play. Boat space knows about the boat. It knows about how many motors it has. It knows that the port, starboard, center engines, anything like that. And that will then translate user space, which is the user intention of, I want to go forward fast now, please, into, okay, you engines need to go fast and you need to not go fast, for instance. User space is the helm. If you read the diagram, again, they're really just showing us how it works. It's looking per throttle handle, it's looking for three voltages that move in tandem. So those three dotted, those three lines of varying dash types on the chart, tell us what those are. And in this case, they've abstracted reverse away a little bit too. So unlike the CDU where you have a separate trigger when like, I need to pull this, then pull that to go backwards. Mercury just basically says, I have plus 100, which is forward. I have zero and I have minus 100, which is all back. If you had a system that had a non zero neutral point, like a bucket, a jet ski bucket, for instance, doesn't go down all the way to keep you still. It goes down all the way for full reverse. This is where to abstract it away. So to replicate these, you just need three decks. Like this sounds dumb. And honestly, the hardest part of this is finding the active connector that plugs into this. I think it's a GTS 150, but don't hold me to that. We can talk later if you really want the connectors. I've written up on GitLab somewhere. DTS two, I'm going to open up a throttle binnacle and just see what, again, it's going to be a hall effect. Maybe the hall effect is potted under epoxy on the board or something dumb, but I suspect it's not. And we're going to cut the traces or cut the wires and figure out what we do. So does this all make sense so far? Great. So hacking Glendinning. This is again, basically the same deal. So Glendinning uses proprietary CAN and it's not even a standard 1939, which is really annoying. So the standard decode tools for 1939 don't work for this. Don't try it. It's just not even worth it. You take the helm apart. Honestly, it's mostly like really nicely machined detents for the handles. When you move them back and forth, it has a really nice user feel. And then it's just a hall effect sensor on a magnet. You're like, wow, that's it? And it is, it turns out. There's some other CAN stuff in there, like idle and fast idle, but yeah, the lever is just a magnet and a hall effect. So take it apart and then you put it on a scope. Again, the only real advice I have here is because of how this worked, a meter was not high enough impedance to figure out what it was doing. So you had to put it on a two channel scope. Like that was as complicated as this was. This took about, I don't know, an afternoon. And that was including a lunch break. They also divide it into user space or user intention, boat space, these command modules. I think they call them CP modules here. And again, this is very brand specific. The CP module can control multiple engines. It knows what CAN ID engines are which, and you'll just buy it pre-configured from them if you really want to. So that's how to control or a control strategy for cable driven motors. So notable exceptions, Torquedo is well understood if finicky. Their code is now included in mainline ArduPilot which is awesome that the ArduPilot community got that together, like props to them. It's RS-485. It involves a whole bunch of handshakes. It's a giant pain, but like, okay, you can make it work. I can't really recommend Torquedo if you want electric power plants. Five years ago, yeah, sure, absolutely. They were probably your only option. Now there are other options. Go find them. Cox Marine who makes diesel outboards out of the UK just sends you the J1939 ICD. You just ask them nicely. You don't even have to sign an NDA. It's great. I would happily buy their motors just based on that alone. Whereas Mercury Brunswick has actually told me to not give this talk at a different venue. So we're here and this is DEF CON and that's how this works. Cox is really cool. And I haven't used their motors, but diesel outboards are a real subset of, subset of outboards that's rapidly becoming more in demand as DoD basically says, like, you must have diesel, we don't care. Not that it like makes no sense, but okay. So how do you interface this with an autopilot? And in this case, we're gonna refer to autopilots, not in the Marine sense of like, you push a button and it tracks a line. It's gonna be more the sense of a flight controller. And obviously like our boats aren't taking flight, but the terminology from ArduPilot is flight controller, FMU. So I messed around with PLCs a bit for this. And PLCs seem like a really obvious answer. Like you wanna make voltages, you want them to be ultra reliable. You know, you want them to be super auditable. I like PLCs to be clear. I have some background in Siemens stuff, although it's been a while. I tried to get this to work over MQTT. That seemed like a really cool way to do it, of put it on a normal IP network, have something like MavProxy on a Pi, just output MQTT messages from MavLink, just translate MavLink messages. And this is all MavLink specific. Your mileage may vary. So MavLink to MQTT worked great. Receiving the MQTT messages on the PLC did not. There were rate limits that were not documented. There were on-off stuff that just didn't work. It just, it doesn't work well, at least with AutomationDirect. And I like AutomationDirect a great deal. They're a super awesome company. Props to them for having 3D models, 2D models, ICDs on their website. So this isn't a them problem. I mean, it's trying to pack all this onto an STM32 problem. So could you write one if you were a PLC expert? Yeah, probably. If that's your chosen religion, like sure. You could digitize the PWM signals coming out of your flight controller. That's sort of the most basic way to do this. Those are, when I say PWM, it's the PWM hobby servo space. It's super well understood. It's basically a time pulse and then a gap and then another time pulse. And the length of that time pulse is your desired servo output. Could you have a time counter on a PLC do this? Yeah, of course you could. It just wasn't worth it to me to write custom serial stuff, basically. So I just spun my own boards. Refresh speed is not a factor. I used a Teensy, shout out to PJRC. He's awesome. I didn't interact with him for this, but like what he brings to the community is amazing. So I just used a Teensy, added a bunch of peripheral hardware to it and have it either listen to the pulse widths or Mavelink over serial. Like, honestly, it's not that hard. It's like 500 lines of code. I'm not a software developer. You don't want me writing code. So the fact I was able to make this work says it's actually pretty easy. You're gonna spend a bunch of time like with an engine diagnostic tool. And if you want to get into this, the best device I can give you is buy an engine diagnostic tool, either from the manufacturer or one of the third party ones that plugs into the engine bus and at least sees what the commands are so you can ground truth what your hardware is doing. That will save you a lot of time. Otherwise, you're just gonna get strange errors and beeps and you won't be able to reset them. And the number of Yamaha beeps I've heard in my life is far too many at this point. So let's talk through that diagram just real quick. So that's coming out of the flight controller. Mavelink or PWM or whatever you want, I guess, but those are the two I would recommend. This engine translator piece of hardware that you all will have designed if this is the way you want to go. And then you can talk to each ECU over application-specific analogs. And honestly, the big letdown of this talk is I'm not telling you to reverse engineer Mercury's 12 different CAN buses because also they're gonna change it out from under you. It's just intervene at the user space level and this will all be fairly easy. It would make sense if you want to keep your variables to keep signed eight bits. 255 minus 254, zero, the same as Merck was doing. It basically makes the translation of when you get a command to what you want to do with that command to output a lot simpler in code. So that's the big reveal here is this isn't that complicated if you just break open stuff and pretend to be the user. And it works. It works reliably. So I've got some time for questions. I threw a lot out there and it was really fast. If you want to go back to any areas, please, I'm in the Maritime Hacking Village, which is awesome. It's my first DEF CON. So forgive me for talking fast and nervous. Come to Maritime Hacking Village. We have some boats, we have some engines. It's super cool. So we've got like five minutes for questions, exactly five minutes for questions. So after that great disappointment of just intervene with analog voltages, fire away. Someone must have a question here. Please, thank you. I do, unfortunately, and I hate it, but like, yeah, let's roll back to Yamaha. Like this is now the way they're going to, eventually they will stop selling cable driven like legacy support motors. And like, that's not great. And the wiring harness alone to rig one of these is over a thousand bucks new. That is the way it's going to go. And you're going to have to call your Yamaha rep and say like, I need a new thing and you won't be able to buy it yourself. And like, that's a world I personally don't want to live in, but yeah, it's going that way. I don't know what to do about it, but it is. Great question, thank you. Yeah, John Deere sucks. They do unfortunately make marine power plants too. I just haven't encountered any of them. Any other questions, please? Sir, thank you. Yeah, so that's sort of the whole, like the whole crux of this is, A, I'm not a particularly talented CAN reverse engineer and they're probably doing non-standard binary stuff that's really, really hard to track down. And this was like, this is sort of the afternoon level hacking and it works. I would say it's harder, but more hardware elegant to just modify the CAN packets, but you're gonna have to spend a lot of time listening to them and a lot of time with like very known states. And you're going to have a lot of jumpy data in that, that you're gonna be trying to decode as binaries. And I'm not saying don't throw an LLM at it cause that might actually work, but it's gonna be hard. It's not gonna take you an afternoon for sure. So my thought is just keep the Mercury stuff, Mercury stuff. And if they want to do engine synchronization in whatever weird way they're doing it, I don't care. Please. Cool. You should all buy a maritime hacking village badge cause it's super cool. And it can interface on 0183 and 2000 and should have arbitrary voltage outputs. And I don't know, I flashed a bunch of them, but I don't really know how they work. So those are super cool badge again. Thanks to maritime village for hacking, having me and thanks to DEF CON. Any other questions, please throw it out there. Those were great questions. Thank you, sir. Short answer, yes. It's easier than it looks. There is some subtlety to it. Like outputting PWM directly from microcontroller will probably yield unknown results. I put it through a DAC. So a PWM based DAC that has proper like voltage reference ratio metrics. All of these are like two, $3 hardware. But yeah, again, that's the terrible disappointment of this talk. Yeah. You could do it with analog if you wanted to. Yeah, sir, please. Ford has a really impressive system. Like that uses a whole bunch of cameras and lidars and basically you like, you turn the knob and your F250 will do like the inverse kinematics for the trailer. It's really sexy. It's only available in like the super high end Fords. Other than that, my only suggestion is practice. All right, we are at time. If anybody wants to get together at the hacking village, we have booze. Thank you.