Controlling functions in the engine bay with Arduino and servo motor? - MR2 Owners Club Message Board
MR2 Owners Club Message Board

Go Back   MR2 Owners Club Message Board > Shop Talk > After Market Engine Management

Reply

Currently Active Users Viewing This Thread: (0 members)
 
 
Thread Tools
Old March 3rd, 2011, 00:45   #1
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
Controlling functions in the engine bay with Arduino and servo motor?

I have been thinking about this for a while, and I am going to try this out. The main motivation behind it is the fact that I am keeping my TVIS system and want to get the most out of it, and the oem ecu TVIS operation is far from performance-optimal. Hence, not only controlling its opening point but its opening rate. The reason being, it seems to me best to have it open based on RPM (which many have done), but not only that, to have it open progressively based on RPM.

From studying dyno charts of those that have dyno'd with the TVIS closed and then fully open, and then set their TVIS to open at a certain RPM, there is a bit to be gained, when all those dynos are overlayed. There always is a dip as the TVIS goes from fully closed to fully open rather quickly. This rate of opening is always the same regardless of the gear we are in.

Now what I am curious about, is whether the turbulence from a half-open TVIS will be too disruptive and negate the potential gains. It could be possible that this is the case. However, I am too curious not to try.

What some people have done to control things like throttle bodies on various motors is to use a suitable servo motor (originating from the RC hobby world). I want to control this servo motor using my Arduino (Freeduino actually) microcontroller, and then programming it with whatever parameters I want. Using correct resistors and circuitry, I get the tach signal (probably have to get it down from 12v to 5v (the Arduino needs 5v)... I think its all squarewave... and then write a small program that assigns servo motor positions based on those RPM numbers. So, I can start the motor's movement at 3700 RPM, and finish its movement at 4700 RPM (for example), if it is deemed to be most beneficial in that range. It also does not have to be a linear rate, it can be anything at all.

I am willing to bet that if we were able to dyno in every gear, we would find that one of our gears is closest to having the oem TVIS open at a rate that suits the RPM climb.This is probably first or second gear. The gears that this mod would benefit the most would be 3,4,5, since the TVIS normally opens at the same speed no matter the gear.

In addition, if I figure out that there are other conditions or scenerios in which to make exceptions to the RPM-based rate (such as boost for example), I can write another small program to perform that as well, and run input data from another source such as boost level (signal).

Has anybody done this, or something like it? Any thoughts welcome... Its going to take a bit of homework on my part to figure out the correct electronic parts... I already have the Arduino, and access to a great electro-acoustic lab at school tht is stuffed to the brim with resistors etc... I am studying what others have done to convert correctly from the tach signal to the Arduino so that it all works. Some things are less than 12v in our cars, so it may work to my advantage.

scarecrowX?
You usually have a way of simplifying over-complicated plans...

One thing I can see right away:
-moisture/heat protection for the servo motor. I can install the Arduino anywhere (like in the trunk for protection).
Gandalf is online now   Reply With Quote
Sponsored Links
Advertisement
 
Old March 5th, 2011, 04:47   #2
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
scarecrowX confirmed tonight that apparently the timing related stuff is all logic level (5v) so that's definitely a step in the right direction... in the quest for coil-on-plug sequential ignition, the CYP (cylinder position sensor used to determine which cylinder is next in the firing order for sequential fuel injection) is tapped off the HIC1, and the TDC sensor can be tapped on the output of the HIC1 board as long as you're not loading it (affecting the signal). That would be a pulse per revolution.

I can work with that... I can write a little basic math program operation that relates these pulses to RPM (or borrow code from someone who has done it, for say, computer fan rpm, etc)... then assign positions for the servo motor based on the RPM range I want to target.

Last edited by Gandalf; March 18th, 2011 at 15:59.
Gandalf is online now   Reply With Quote
Old March 6th, 2011, 09:49   #3
l0ch0w
B&S Restricted
 
l0ch0w's Avatar
 
Join Date: Feb 2008
Location: Lansing, KS
Posts: 2,530
OldTrader Rating: (43)
ultimately wouldnt the best input to guage how to open the tvis be mass air flow rather than just RPM? manifold pressure isnt exactly constant at any given rpm... That way you wouldnt be programming to a square wave, but you would have an analog signal. More complicated maths, but more accurate

Last edited by l0ch0w; March 6th, 2011 at 09:52.
l0ch0w is offline   Reply With Quote
Old March 6th, 2011, 11:12   #4
l0ch0w
B&S Restricted
 
l0ch0w's Avatar
 
Join Date: Feb 2008
Location: Lansing, KS
Posts: 2,530
OldTrader Rating: (43)
ok so its not as complicated as I thought... what you do is you find out the optimal flow velocity through the tvis, and then maintain that flow value. For example, lets assume that the optimal flow velocity during a normal pull through the tvis with the valves closed happens at 2500 rpm using a given turbo and . This means that the motor is flowing some volume of air through one open tvis port.

Lets use this equasion (flow velocity through a pipe of given diameter) as a baseline @ 2500 rpm: v = 1.274 q / (d^2)

let v be the velocity, q be the m^3/s of air, and d be the diameter of a circle with equivalent area to the cross sectional area of the inlet (~1.5 in?) (we can calculate the exact flow later if we find the exact cross sectional area)

we know that for some range of air flow that we want v to be constant, airflow (m^3/s) will be our dependant variable, and d in meters will be our independant variable.

So for a hypothetical: we are doing a straight pull and @ 2500 RPM, the turbo is just starting to spool, and our map sensor and iat are measuring 1 bar in the manifold. This means that air flow through the tvis should be ~.0395 cubic meters a second. The corresponding velocity is ~34.67m/s ( i promise i did all my conversions )

We then want to keep our intake velocity at that value or greater from this point forward. This will require finding out which air flow value is required to keep the air velocity at this 34.67 when the butterfly valves are completely open. The d at this value will be calculated from 2A, which is: .002279m^2 (A is .0011395 m^3) the corresponding equivalent d is then: 5.38cm or 2.12in So then all you have to do is assign the closed position to the d value of 3.81cm, and then the open position the d value of 5.38cm.

d= sqrt(1.274q/v)

all you have to do from this point is to assign servo positions to values of d between 3.81 and 5.38 cm, or whatever the actual calculated values may be...

Last edited by l0ch0w; March 6th, 2011 at 11:16.
l0ch0w is offline   Reply With Quote
Old March 7th, 2011, 07:07   #5
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
Thanks for the time and effort on the math and your reply Ok, I follow what you are saying. Now, under which conditions (signal type aside) does it more accurately determine opening/closing points than RPM? Which driving conditions?

Those that have dyno'd the TVIS full open vs fully closed have found that the best opening point for the TVIS is around 3700 RPM. On my car, my GT3040 turbo spools around there and breaks 200 rwtorque at about 4000 RPM. So for me, the TVIS helps me with a little lower end grunt just prior to the turbo sweet spot. Every car will be different depending on the components of course, but I am wondering how using a flow velocity TVIS control will give me an advantage...

In order for it to be an advantage, it would have to be a situation where for a second or two the RPM is telling the TVIS to be closed (under 3700) but in fact the TVIS should be open? Or, the RPM is telling the TVIS to be open (above about 4500 RPM) but it should in fact be closed? I am finding it hard to imagine where the RPM system is inadequate, or not a decent solution... (Of course, this is testing the system under a dyno-condition only)

Right during shifts perhaps, when the turbo drops boost? The Neptune system I am going to run has full-throttle shifts, so I should lose little under those conditions...

I am still trying to fully grasp what the most crucial factor in a TVIS sytem is in terms of the air... so, another question: can it be said that it is most important to get maximum air velocity possible at anything below full boost? How is air velocity more crucial than boost to control the TVIS?

Last edited by Gandalf; March 7th, 2011 at 07:12.
Gandalf is online now   Reply With Quote
Old March 7th, 2011, 13:43   #6
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
Another factor is, what is the difference between optimal air velocity and maximal air velocity? Wouldn't maximal air velocity always be right at redline?
Gandalf is online now   Reply With Quote
Old March 7th, 2011, 18:41   #7
l0ch0w
B&S Restricted
 
l0ch0w's Avatar
 
Join Date: Feb 2008
Location: Lansing, KS
Posts: 2,530
OldTrader Rating: (43)
mass air flow isnt constant, especially with varying temperatures and barometric pressures. There is a good possibility that you may change the VE of your motor in the future (new better parts). And whenever you change your motor's VE the flow rates at any given point will change.

We have to go back and look at exactly why toyota put in the tvis.. It was put in to increase flow velocities and the force from the air on the fuel stream into the combustion chamber in low rpm's for greater low end torque. The thing is that if the mass air flow is different, then the velocities will be different, and the equivalent forces on the fuel will be different. If you guage off of mass air flow however, you can more adequately and more consistently open your tvis in exact proportion to the optimal air velocity demanded . If you guaged solely off of RPM, you couldnt account for any unforseen changes. The beauty of a setup like this is that it would run more intellegently and be self adjusting based on intake temperatures, manifold pressures, and VE.
As for optimal vs maximal velocity, you have to figure that because the intake ports on the genII motor are so retarded huge, that if left open the flow velocities at low RPM would be way too slow. But if they stayed closed all the time, we would quickly hit a maximum flow, but that would choke the engine. Which is why finding optimal flow is most important.

(this next part is hard to describe without visual aides)

If we trust that the OEM's had it right, we know that the tvis opens at 3700RPM because this is the point where the open and closed torque curves intersect. However if we had full control over how the butterfly valves open, essentially we would eliminate the sharp point in the torque curve. It would be perfectly smooth. with torque gains in both the low and high end.

But because in the real world that intersection point actually changes (with different intake temps, and pressures) if you really want to get the most out of the tvis, its important to go off of your variables, not just pick a point and hope its good enough.

Last edited by l0ch0w; March 7th, 2011 at 18:43.
l0ch0w is offline   Reply With Quote
Old March 7th, 2011, 20:40   #8
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
Excellent. Makes sense. Gotcha.
Now, how do we find the optimal flow velocity through the TVIS?
Gandalf is online now   Reply With Quote
Old March 7th, 2011, 20:42   #9
RickyB
Automotive cartographer
click here to visit the sponsor page
 
RickyB's Avatar
 
Join Date: Feb 2004
Location: Cupertino, CA
Age: 52
Posts: 4,369
OldTrader Rating: (25)
Quote:
Originally Posted by l0ch0w
But because in the real world that intersection point actually changes (with different intake temps, and pressures) if you really want to get the most out of the tvis, its important to go off of your variables, not just pick a point and hope its good enough.
Are you just speculating? You must be, because if you had actually produced the torque curves at varying boost pressures on a dyno you would notice that the crossover point stays the same.

Also, the stock opening point is 4200 RPM, not 3700 RPM.

I agree that the VE of the motor will change the optimal opening point, but the air density doesn't. All that air density does is change the number of molecules that flow across the TVIS at a given RPM--it does not change the velocity of those molecules. This is why the code in the stock ECU switches only on RPM even though the mass flow values from the AFM are available.
RickyB is offline   Reply With Quote
Old March 7th, 2011, 21:29   #10
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
Quote:
Originally Posted by RickyB
Are you just speculating? You must be, because if you had actually produced the torque curves at varying boost pressures on a dyno you would notice that the crossover point stays the same.

Also, the stock opening point is 4200 RPM, not 3700 RPM.

I agree that the VE of the motor will change the optimal opening point, but the air density doesn't. All that air density does is change the number of molecules that flow across the TVIS at a given RPM--it does not change the velocity of those molecules. This is why the code in the stock ECU switches only on RPM even though the mass flow values from the AFM are available.
Would you say then that the optimal opening point is a product of VE primarily? What other factors do I need to take into account if I design a mocrocontroller program? During off throttle or shifts for example?
Gandalf is online now   Reply With Quote
Old March 8th, 2011, 19:41   #11
RickyB
Automotive cartographer
click here to visit the sponsor page
 
RickyB's Avatar
 
Join Date: Feb 2004
Location: Cupertino, CA
Age: 52
Posts: 4,369
OldTrader Rating: (25)
Quote:
Originally Posted by Gandalf
Would you say then that the optimal opening point is a product of VE primarily? What other factors do I need to take into account if I design a mocrocontroller program? During off throttle or shifts for example?
VE is going to determine the VOLUME of air coming down the runner (not molecules, that's determined by the DENSITY of the air). The volume of air is going to determine the velocity of air (a direct correlation with the cross sectional area of the runner, which is what the TVIS is altering).

Thus, any changes to the engine that affect VE will require the TVIS opening point to be adjusted.
RickyB is offline   Reply With Quote
Old March 8th, 2011, 20:54   #12
l0ch0w
B&S Restricted
 
l0ch0w's Avatar
 
Join Date: Feb 2008
Location: Lansing, KS
Posts: 2,530
OldTrader Rating: (43)
The stock opening point isnt exactly geared towards being super precise. I am assuming that you want to get absolutely the most out of your TVIS. Which means taking into account every variable.

RickyB, As for velocity and pressure both being important, you have to figure that pressure pretty much determines the number of air molecules in a given space. The force exerted on the fuel is then a determinant of both velocity as well as pressure. Velocity alone will not move fuel... If only a couple of molecules of air moving really fast (high temperature air) interupt the fuel flow not that much will happen, but if lots of air molecules moving really fast (cool air) interupt the fuel flow, then you will do alot more work. This was my point, its not just about air velocity.
l0ch0w is offline   Reply With Quote
Old March 8th, 2011, 20:59   #13
l0ch0w
B&S Restricted
 
l0ch0w's Avatar
 
Join Date: Feb 2008
Location: Lansing, KS
Posts: 2,530
OldTrader Rating: (43)
Quote:
Originally Posted by RickyB
Are you just speculating? You must be, because if you had actually produced the torque curves at varying boost pressures on a dyno you would notice that the crossover point stays the same.
This statement would not hold water if you dynoed the same car at the same boost level in Denver vs lets say San Diego... The point is that the TVIS opening point does change based on many factors. I would be willing to bet it also changes if the turbo is swapped out. I never said the varying boost pressures change the opening point, but changes in ve or barometric pressure would...

Setting up the TVIS to open variably based on a greater range of inputs would make for a car that performs much more constanly given different external variables.
l0ch0w is offline   Reply With Quote
Old March 9th, 2011, 02:15   #14
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
The stock TVIS opening point is barely important because there are sooo many other factors from the ecu that play around with the TVIS, leaving stock control of the TVIS as highly undesireable from a performance perspective, especially on a non-stock engine. Hence the key is to take control of the TVIS away from the ecu, as RickyB advised long ago.

Would it then not be best to write a program based on RPM and the engine's particular characteristics on a dyno, and then additionally write sub-routines that will influence the program to take into account variables such as altitude and any other non-constants? Similar to how a dyno corrects?

If I dyno and get the expected gains from the TVIS compared to open/closed TVIS pulls, and the curve is perfectly smooth like l0ch0w mentioned, then I know I've got it right. I think KBlake posted a dyno in which the TVIS actually provided peak torque (moved his torque peak up 1300 RPM or thereabouts).
Actually, I found it... This is a great example of not only what a TVIS can do, but what I want to do with it. See that concave curve in the torque between 3200 and 4700 RPM (green line)? I think I can flatten it. Now, in my case, with a GT3040 (3082) turbo, it will spool later, so the TVIS won't have as wide an RPM range to affect, but I believe if I set it up correctly, the TVIS can have a more profound effect on torque onset (and spool). The gains should be lesser on a spool-monger turbo. I'm sure KBlake is ok with me re-posting it:

Last edited by Gandalf; July 15th, 2012 at 14:30.
Gandalf is online now   Reply With Quote
Old March 9th, 2011, 02:33   #15
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
On the microcontroller subject, I wonder if this can be of use... it is designed for the OBD2 ecu, and I have an OBD1, so it may not fit, but, perhaps it is a step in the right direction?

Maybe I should have mentioned for those that don't know, I am going the scarecrowX-route for an ems, using a Honda PO6 OBD1 ecu and Neptune software. Things are very similar to the oem 3sgte ecu, except fully programmable.

Anyways, I won't need their little display or anything since I will just look on my laptop, or eventually on a built-in car computer (which will also run all entertainment etc, and have any function display I want). Its an Arduino similar to mine with a program written to monitor several OBD2 inputs.

http://code.google.com/p/opengauge/wiki/OBDuino

Last edited by Gandalf; March 9th, 2011 at 02:46.
Gandalf is online now   Reply With Quote
Old March 9th, 2011, 19:45   #16
l0ch0w
B&S Restricted
 
l0ch0w's Avatar
 
Join Date: Feb 2008
Location: Lansing, KS
Posts: 2,530
OldTrader Rating: (43)
What I am saying is that if you setup your tvis to open a certain way at a set RPM, you will not have as consistent of performance. That tune is only good for that day on that dyno. What happens when a high pressure system comes in and messes with the barometric pressure? what happens if you drive up to the mountains? what happens if you buy a sweet new exhaust manifold or intercooler and change the ve of the system? All of these things will require you to "re-tune" your tvis for optimal performance... Im saying set it up the more complicated way so that your motor can auto tune the opening point of the tvis. thats all...
l0ch0w is offline   Reply With Quote
Old March 9th, 2011, 19:49   #17
l0ch0w
B&S Restricted
 
l0ch0w's Avatar
 
Join Date: Feb 2008
Location: Lansing, KS
Posts: 2,530
OldTrader Rating: (43)
o... subroutines.... i guess i should read... Either way, I think it would be a cool academic exercise...
l0ch0w is offline   Reply With Quote
Old March 10th, 2011, 13:30   #18
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
The TVIS will be the last thing that gets tuned, after the cam gears. But it would be great to have an accurate compensation system for things like altitude, so that when I come down from high altitude and show up at sea level for a meet, that I still get the best performance.

So since the opening point is determined by VE, how will the particular factors such as you mentioned alter or affect the opening point? How can we compensate them accurately? We would almost need to dyno at two altitudes...
Gandalf is online now   Reply With Quote
Old March 17th, 2011, 07:52   #19
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
Update and video

I have designed a patcher using Max MSP, Maxuino, a freeduino microcontroller, and a Spectrum A6030 digital titanium-geared aircraft servo (280 oz of torque). It is capable of analog and digital inputs, and will give me precise control over every aspect of the TVIS, including rate and opening/closing points. It is not yet in communication with the ecu, that is the next step, and no other "variable parameters" such as altitude are at this stage taken into account. When I fully understand which factors need to be accomodated and how much, I can write them into the patcher.

I made a YouTube video detailing how it works, check it out:
http://www.youtube.com/watch?v=CQLr5fcW_e8
Gandalf is online now   Reply With Quote
Old March 22nd, 2011, 16:19   #20
Gandalf
CyKlops Custom Creations
click here to visit the sponsor page
 
Gandalf's Avatar
 
Join Date: Mar 2004
Location: Vancouver Island
Age: 45
Posts: 3,959
OldTrader Rating: (6)
Second video, Part 2

I have completed the Max MSP patch that will control the TVIS. I have added dials to the interface that allow me to set the TVIS start-point and fully-open-points independantly to whatever RPMs I want. This gives a precise range and rate for this opening. It took a fair bit of head-scratching math, but it works flawlessly.

In the future I can also add any other exceptions I want, such as gear selection... just for example, if I find that in first gear, the engine whips through the RPM's faster than the fastest servo/TVIS opening rate, I can have the TVIS only engage from second gear onwards, etc.... It is currently mathematically a linear-rate of opening, but a servo arm actually naturally gives a scaled rate, having the fastest travel in the center of its range. As we select a longer servo arm (or larger-diameter wheel), this scale moves closer to being linear. I can play with the arm-length and servo range to get the best compromise.

What this interface has proven to me is that I can use this system to design ANY gauges, dials, readings, sensor inputs I want, and have them displayed in whatever manner or configuration I want to see. I can also add large numbers of sensor inputs independantly of my tuning software, or take/exchange data from my Neptune/Demon/Honda P06 combo and have it displayed in a nice layout. So it can go well beyond TVIS... but it was a good place to start .

Here is the Part 2 video showing the new completed interface, patch, and servo control:

http://www.youtube.com/watch?v=43iBLhqMhII
Gandalf is online now   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 22:06.


Powered by: vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

Content- © 2000-2014 MR2OC.com
MR2OC and The MR2 Owners Club are trademarks of AutoGuide and can not be used without prior consent.
Privacy Statement
Review the MR2OC Terms of Service | MR2OC Forum Rules | Sales Forum Rules | Advertising Rules | How to use this forum - FAQ