Porsche 951 and Arduino Uno?

Talk and Tech about turbocharged 924/944/968 cars
User avatar
DGUN951
Posts: 52
Joined: Wed Oct 13, 2021 5:10 am
Has thanked: 11 times
Been thanked: 19 times
Hey guys. I made a quick video about the Arduino uno and some of the applications we could use it for. I know Tom plays with it. What types of automotive of projects has everyone do with it. Check out the video and see what you think.


#1

User avatar
Tom
Site Admin
Posts: 8969
Joined: Fri Jun 25, 2021 2:04 pm
Location: Silicon Valley, CA
Has thanked: 943 times
Been thanked: 4028 times
Contact:
Very nice! That's one of the basic building blocks for the SpeedoBooster..... The SpeedoBooster is not based on an Arduino per se, but it's based on the same chip with an Arduino boot loader. If I can help, let me know!

As for knock, I put a TON of effort into programming an Arduino to replicate the Curtis counter. The Arduino is so fast I had to create little software windows to act the same as the Curtis counter....

But since you tee'd it up for me....




#2

User avatar
Tom
Site Admin
Posts: 8969
Joined: Fri Jun 25, 2021 2:04 pm
Location: Silicon Valley, CA
Has thanked: 943 times
Been thanked: 4028 times
Contact:
One project I've wanted to work on for a long time is a boost controller. With a cheap mac valve, an arduino, and lots of coding time, I'm sure we could come up with something that works as well or better than most the stuff out there. That video showing the LEDs that detect which gear the car is in was an early building block for a gear based boost controller, but it's been on the back burner for years. If anyone wants to run with it and/or do it as a group project, I'll share what I have and offer any advice that might come to mind from prior efforts.... :)

#3

User avatar
four0four
Posts: 184
Joined: Wed Feb 02, 2022 10:09 pm
Location: Western WA
Has thanked: 22 times
Been thanked: 32 times
Hah, I started doing nearly exactly that before pulling my engine. I've even got the breadboard sitting somewhere around here with a beefy-enough FET and Teensy LC: I wanted it to be buildable on a perf board :)

All it should take is a simple PID loop - or, at least, that's what all the other codebases seem to use. Modulate the valve at like 40hz, maybe set some lower/upper bounds where PID is bypassed (and disabling the integrator!), and you've probably got at least as much function as anything off the shelf!

(rationale for the teensy: native USB, cheaper than the old 8-bits, nice peripherals, built-in +5v logic output [intended for ws2812 led strips], substantial existing libraries/support)

#4

Alex89
Posts: 14
Joined: Sun Jan 23, 2022 7:50 pm
Location: Ontario, Canada
Has thanked: 4 times
Been thanked: 2 times
I too started thinking about building an electronic boost controller but haven't gotten past the stage of collecting parts yet. I imagined it could also use inputs from the knock sensor and my WBO2 for extra security. But I also started thinking about what could happen if any of it failed causing overboost. My basic manual boost controller is pretty reliable so I decided to leave it alone for now.

I commented on Dave's video that I've also been considering an Arduino-based data logging setup. Basically splice into the DME wiring to collect data on RPM, airflow, knock and anything else relevant. I spent some time mapping out the pins and it should be pretty simple to connect them to a mega board. Add a sensor for boost and connect the analog output from my wideband O2 sensor. All fairly simple to wire up, but finding a nice way to log and display the data is what's holding me back. Rather than collecting and saving data in the Arduino itself I was looking at using Excel to actually collect the data via serial from the Arduino. But it's still not really very user friendly. Especially if I want to be able to quickly review data and update my tune. I'm open to suggestions!

#5

User avatar
johnb
Posts: 320
Joined: Thu Jul 08, 2021 5:57 am
Has thanked: 110 times
Been thanked: 78 times
Cool stuff. I haven't posted in a while (sorry Tom!) being busy with life, but these projects always get me excited. A while back I started work on an ABS tool, to activate the ABS unit safely to help with bleeding the brakes. You can fiddle around with jumper wires but you can easily damage something that way, so I thought it would be nice to have something that controls the unit safely with the same current levels and duty cycles as the factory computer.

As always the first step is reverse engineering. I captured some voltage and current traces from the valve wires while the ABS was engaging.

Here you can see current (blue) and voltage of one for the valves:
abs_valve_current_and_voltage.png
abs_valve_current_and_voltage.png (85.71 KiB) Viewed 2083 times
As you can see, there are 2 distinct current levels. These correspond to the 2 modes the valves have, "hold" (2 amps) and "dump" (5 amps). In hold mode, the valve moves to prevent any further pressure getting to the brakes. In dump mode, it actively releases existing pressure from the brakes. It tries hold mode first, and resorts to dump mode if that doesn't fix the problem. The pump (not shown here) runs constantly whenever the valves are doing anything, to push fluid back to the MC.

Using the Arduinos PWM modules and some big MOSFETS you can easily replicate this behavior and cycle the ABS unit realistically to get any air bubbles out.

Regarding the knock stuff, trust me it's going to be hard to beat the KLR. I completely reverse engineered the knock sensing functionality of the KLR and most of the boost control stuff (see https://jhnbyrn.github.io/951-KLR-PAGES/). I don't think the Arduinos capabilities would offer anything over the KLR for this. It's very sophisticated and basically allows the each cylinder to run at the threshold of knock constantly.

I'm also looking for good software for visualizing logged data! I have a really cool board that attaches to a Raspberry PI and has great analog abilities (this one: https://pi-plates.com/daqc2r1/). Because you're working with a mini PC you can write your code in Python or some easy high level language. But how do you visualize the data afterwards? It turns out that's the hard part ;)

#6

User avatar
johnb
Posts: 320
Joined: Thu Jul 08, 2021 5:57 am
Has thanked: 110 times
Been thanked: 78 times
four0four wrote: Tue Apr 26, 2022 4:04 pm Hah, I started doing nearly exactly that before pulling my engine. I've even got the breadboard sitting somewhere around here with a beefy-enough FET and Teensy LC: I wanted it to be buildable on a perf board :)

All it should take is a simple PID loop - or, at least, that's what all the other codebases seem to use. Modulate the valve at like 40hz, maybe set some lower/upper bounds where PID is bypassed (and disabling the integrator!), and you've probably got at least as much function as anything off the shelf!

(rationale for the teensy: native USB, cheaper than the old 8-bits, nice peripherals, built-in +5v logic output [intended for ws2812 led strips], substantial existing libraries/support)
It suspect it's more complicated than than just using a PID. The KLR uses a combination of open loop and PID control. One of the things on my list is to disable each one in turn and find out which one matters more. But I strongly suspect that it's the open loop control that does most of the work, and the PID controller is for fine tuning. It could do all the work on it's own, but it might be slow.

I've never used an aftermarket boost controller, so maybe they have this feature, but what I would consider if I was designing one is to use the PID control option, and the use that to gather the duty cycle data, and then use that data for open loop maps. Of course those maps have to change if you change anything in the engine, but as long as it stays the same it would be more responsive (in theory).

#7

User avatar
DGUN951
Posts: 52
Joined: Wed Oct 13, 2021 5:10 am
Has thanked: 11 times
Been thanked: 19 times
johnb wrote: Tue Apr 26, 2022 7:42 pm Cool stuff. I haven't posted in a while (sorry Tom!) being busy with life, but these projects always get me excited. A while back I started work on an ABS tool, to activate the ABS unit safely to help with bleeding the brakes. You can fiddle around with jumper wires but you can easily damage something that way, so I thought it would be nice to have something that controls the unit safely with the same current levels and duty cycles as the factory computer.

As always the first step is reverse engineering. I captured some voltage and current traces from the valve wires while the ABS was engaging.

Here you can see current (blue) and voltage of one for the valves:

abs_valve_current_and_voltage.png

As you can see, there are 2 distinct current levels. These correspond to the 2 modes the valves have, "hold" (2 amps) and "dump" (5 amps). In hold mode, the valve moves to prevent any further pressure getting to the brakes. In dump mode, it actively releases existing pressure from the brakes. It tries hold mode first, and resorts to dump mode if that doesn't fix the problem. The pump (not shown here) runs constantly whenever the valves are doing anything, to push fluid back to the MC.

Using the Arduinos PWM modules and some big MOSFETS you can easily replicate this behavior and cycle the ABS unit realistically to get any air bubbles out.

Regarding the knock stuff, trust me it's going to be hard to beat the KLR. I completely reverse engineered the knock sensing functionality of the KLR and most of the boost control stuff (see https://jhnbyrn.github.io/951-KLR-PAGES/). I don't think the Arduinos capabilities would offer anything over the KLR for this. It's very sophisticated and basically allows the each cylinder to run at the threshold of knock constantly.

I'm also looking for good software for visualizing logged data! I have a really cool board that attaches to a Raspberry PI and has great analog abilities (this one: https://pi-plates.com/daqc2r1/). Because you're working with a mini PC you can write your code in Python or some easy high level language. But how do you visualize the data afterwards? It turns out that's the hard part ;)
This is awesome stuff… when I mentioned using Arduino for knock.. I only ment to display a knock event.. Tom has a nice knock counter setup that he shared, but I’d also like something with LEDs the light up when the knock is detected. It would also be nice to log it, with RPM, Boost, and AF for reference later, but that’s stretching it. I’m not that good at Arduino stuff yet lol

#8

User avatar
four0four
Posts: 184
Joined: Wed Feb 02, 2022 10:09 pm
Location: Western WA
Has thanked: 22 times
Been thanked: 32 times
Regarding the knock stuff, trust me it's going to be hard to beat the KLR. I completely reverse engineered the knock sensing functionality of the KLR and most of the boost control stuff (see https://jhnbyrn.github.io/951-KLR-PAGES/). I don't think the Arduinos capabilities would offer anything over the KLR for this. It's very sophisticated and basically allows the each cylinder to run at the threshold of knock constantly.
I've read a handful of this! props for putting up with the 8048..I'm not even sure IDA supports it! Nor Binja...Though the latter wouldn't be difficult to rectify. Would a proper interactive disassembler/decompiler be helpful?

I cannot imagine we can't beat the KLR, unless it's using some trick analog circuitry...the 8048 is really, really basic. Hell, drop in that Teensy (M0+ core, I think?) and just emulate it :D

I'm also looking for good software for visualizing logged data! I
Have you seen Grafana? I'm sure it's easy to set up with Docker nowadays, but even manually spinning up an instance isn't *too* bad. It looks amazing. Even if you don't use the visualizer (Grafana), the Graphite db might be useful. If you're old-school..Munin?


This is awesome stuff… when I mentioned using Arduino for knock.. I only ment to display a knock event.
iirc it's just a pulse output. you could do some quick math and put together an integrator that would both effectively stretch those pulse to a visible duration and provide a scaling output as they continue...But the easier thing might just be to look up a pulse stretcher circuit and toss that together :)

#9

Dave W.
Posts: 104
Joined: Thu Nov 11, 2021 6:32 pm
Has thanked: 4 times
Been thanked: 22 times
Have you guys looked at the MegaLogViewer program from MegaSquirt? It's extremely versatile, the parameters are customizable and it accepts data from many different forms including excel and csv. I once used it to log daily environmental conditions in a building, such as temperature, humidity, time of day and when certain devices clicked on and off.

#10

Post Reply