Max MSP in my MR2! Controlling, sensing, and displaying multiple functions
For some time now I have wanted to take Max MSP into my car. I have a 1988 Toyota MKI.5 MR2. MKI.5 designates an older-generation MKI car with a newer-generation turbo 3sgte engine. I have begun and completed a large portion of what I set out to do, and thought I would document from this point on.
My engine is going to be controlled by an aftermarket computer system because I am installing larger injectors and other fuel modifications. Normally in an MR2, we have to buy an expensive aftermarket "standalone" computer and then either pay a LOT of money to have it done correctly, or go through the arduous and sometimes fatal process of tuning it ourselves. I have elected to do the latter, mostly due to the fact that a friend of mine from the United States has figured out how to run his MR2 beautifully using a Honda Civic ecu. The advantage of that is, those ecu's can be turned into a fully-functional standalone computer using aftermarket software programs, such as the Neptune RTP, or Hondata, etc.. Neptune RTP is native to Mac. A Civic ecu (PO6) can be found for $30 at a wrecker, and needs minor soldering of a few resistors and connections to make it plug into an MR2 harness. So really, I pay mostly just for the software program of choice. Sacrilege, I know.
My build on the MR2 forum can be found here:
The thread on the MR2 forum, focussing on oem ecu, Max MSP and arduino-related progress is here:
The first debate I had with myself was, "Is there a profound advantage or need to have my Macbook in my car?"
I concluded "YES" for several reasons:
– I can remove it easily
– I always seem to have it with me anyway
– I already own a Macbook (no need to buy anything new right now)
– Neptune RTP is already installed on my Macbook and will be used to tune the car
– I am in need of a new stereo deck, since my previous Kenwood CD changer still had only 4x oversampling. LOL! The amps are still great, I figured it was time to get firewire-quality sound into my car via my Presonus firebox.
– with Max MSP in the car, I can interface with whatever sensors I want and manipulate the signals however I want, to optimize certain functions, control others, and display them in a variety of ways.
– using TouchOSC, I can have my iTouch wirelessly control the Mac via Max, and act as a multi-gauge display for anything I want, from iTunes to boost to Wideband.
So I set about building a strong laptop mount with a cage and "rollbar", which will hold the laptop firmly in place no matter what, and can be mounted in an accessible but unobtrusive location – between the seats against the back firewall. It is bound in pleather, and can be opened thanks to a built-in servo that actuates a pair of electronically-controlled deadbolts.
My thread which tackles how to control iTunes with Max MSP can be found here:
This process, progress, and the interface/patch I made in Max are displayed in a series of YouTube videos that I made:
Part I – http://www.youtube.com/watch?v=CQLr5fcW_e8
Part V shows the servo install on the TVIS system. I spent the past while learning how to TIG weld, and have built a new intake manifold, welding the 8 runners from a Celica 3sge to a new plenum of my design. The TVIS system sits between the runners and the engine, and has butterflies in four of the eight runners. These four butterflies are opened and closed by a vacuum actuator, to increase airspeed going into the engine at lower RPM. Hence, there is no in-between, they are either open or closed, which can cause a noticeable dip in the dyno power curve at the opening moment. This is much more evident in gears 3,4,5 because the engine spends more time going through the power range. The TVIS system is also not optimized for performance by the oem ecu, and performance upgrades and changes to engine VE can change the optimal opening point.
I am taking it a step further than just controlling the opening point, I am controlling the speed with which it will open as well as the point at which it is fully open. RPM-based.
Now, I am entrenched in getting a good clean RPM signal into Max MSP, and the best way seems to be via audio… turning a pulse square wave signal from the ecu around 5 volts into a signal that I can plug into my Presonus firebox, and then from there I can grab that signal via the number~ object and use the number value frequency to control my TVIS patch.
A few pics:
I have managed to get my IGT signal from my ecu, which is already a square wave pulse around 5v, and run it into my Presonus Firebox interface. I simply used a chassis ground as the negative. In Max MSP, I utilized the external [sigmund~] to analyze the signal and spit out a clean accurate hertz value.
The IGT signal puts out 2 pulses per crank revolution, which amounts to 25 hertz @ 750 RPM (idle) and 250 hertz at 7500 RPM. Thankfully, [sigmund~] operates well all the way down to around 10 hertz, which is lower than I need (300 RPM). So, at my redline of 7400 RPM, I set up a dial object with a max range of 246.669998 and connected the hertz value from [sigmund~] directly to it. I can easily direct any signals below 10 hertz to register as zero RPM.
Amazingly, the signal is clean and clear with no blips or flutters, so no need for any smoothing or averaging. The resulting virtual RPM dial is also more accurate and responsive than my oem Toyota tachometer, easily evident with small throttle increases.
There is also a nice oscilloscope (thanks to [scope~]) displaying the square wave IGT signal.
Here is the next video, showing these results with the car running:
PART VI – http://www.youtube.com/watch?v=Zz5nTzEFgNk&feature=g-upl&context=G25101fcAUAAAAAAAAAA
Totally awesome! Thanks for sharing!
Forums > MaxMSP