MEGAsquirt A place to collectively sort out this megasquirt gizmo

MSII: PWM Converter Board w/ CL Idle on NB Miatas

Thread Tools
 
Search this Thread
 
Old 10-30-2009, 05:23 PM
  #1  
Senior Member
Thread Starter
iTrader: (7)
 
Marc D's Avatar
 
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
Default MSII: PWM Converter Board w/ CL Idle on NB Miatas

Woot. Closed loop idle ******* works! I'm still tinkering with the PID settings, but its slowly getting there.

I finally got the PWM converter board yesterday and I assembled it this morning.


Here is the wiring diagram. It can be used for any NB miata, whether it is using a full self-encased modified MSII (like franks former setup), or it can be used with Abe's Adapter board. Keep in mind, The wiring is for Abe's adapter board, and where the transistor is placed, there is a jumper between pin 1 and 2 on the PWN converter board. If you want, you can use the transistor that may already have, but you will require a 12V ref to the 12V pin on the board, as well as a ground to the A_GND on the side of the transistor. Using abe's adapter board will NOT REQUIRE A 12V reference AND THE A_GND CONNECTED.

On an NB miata, our valves run at close to 500Hz frequency. This is the purpose of the PWN converter board. On MSII, the frequency setting should be set at 1 for accurate and precise CL idle control. If you use anything higher than 4, your idle will suffer with closed loop, and you will have to use PWM warmup as your source of idle control.

When you assemble the board, for our cars, use the top 2 jumpers, which appear on the side of the IC chip, which is pictured here. You can see three jumper sets.

It appears to be the "bottom two" but if you need to reference, jbperf.com has the diagram.

Wire it up, according to the diagram.



The next post will be regarding CL idle settings on your MSQ.

Last edited by Marc D; 10-30-2009 at 05:38 PM.
Marc D is offline  
Old 10-30-2009, 05:34 PM
  #2  
Senior Member
Thread Starter
iTrader: (7)
 
Marc D's Avatar
 
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
Default

Here are my current settings for CL idle. If you have any suggestions or any thing to say, please post here, and I'll take a note of it.


This will probably be unnecessary when MSIII comes out, but hell, it works for me as of now.
Marc D is offline  
Old 10-30-2009, 06:15 PM
  #3  
Elite Member
iTrader: (3)
 
AbeFM's Avatar
 
Join Date: Aug 2006
Location: San Diego, CA
Posts: 3,047
Total Cats: 12
Default

OMG, I have to do the tuner studio thing. Keeping all those setting straight in your head in separate windows has always been the big hang up. Having them open at once is great.
AbeFM is offline  
Old 10-31-2009, 01:45 AM
  #4  
Elite Member
 
Zaphod's Avatar
 
Join Date: Mar 2006
Location: Schwarzenberg, Germany
Posts: 1,553
Total Cats: 101
Default

I can only suggest to anyone - use Tuner Studio - it's way better than Megatune and you get used to it very very fast.

@ Marc - great work.Going to have to add this to the DIYPNP over the winter...

Greets
Zaphod is offline  
Old 10-31-2009, 03:52 PM
  #5  
Junior Member
 
muythaibxr's Avatar
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Originally Posted by AbeFM
OMG, I have to do the tuner studio thing. Keeping all those setting straight in your head in separate windows has always been the big hang up. Having them open at once is great.
In MS3 we've made them all 1 window. We may eventually backport some of the usability stuff from there to our ms2/extra inis.

Ken
muythaibxr is offline  
Old 10-31-2009, 03:59 PM
  #6  
Junior Member
 
muythaibxr's Avatar
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Marc D:

Just some suggestions:

1) Having the "RPM with valve closed" and "RPM with valve open" so close together is giong to make the PID gains very sensitive. It might be hard to get it to idle right without oscillation this way. Of course since your Idle open duty and closed duty are so close together, this somewhat counteracts the behavior caused by having the RPM values close together, so it might be fine.
2) I would make PID delay 3 seconds or longer. This just gives the RPM a chance to become stable before going into PID.
3) I usually like a longer crank-run taper but that's just personal preference.
4) A longer ramp to target time will give you the ability to set a larger P-term, which will catch things like the AC turning on better. I usually use 3 or 4 seconds here.
5) You could probably get away with a much shorter control interval. I use 70 ms. This will also help catch sudden load changes.
6) PID lockout rpmDOT threshold should be much much lower, or else you'll get into PID during decel. I use 50-75 here.
7) PID lockout max decel load should be set to just under the lowest load you see at idle.
8) PID disable RPMdot should be set between 100 and 200 RPM. This is for those who don't rev-match when re-engaging first from neutral while the car is moving. It turns off PID when RPMdot goes over the threshold so that the next time PID engages, it's not so low that the engine stalls.
9) I typically use as low of a TPS threshold as I can. On the 20v 4age, I'm using .5%. Having this too high will result in PID staying active while you rev the engine, and will cause the valve to close, and the engine to stall the next time you lift off the throttle.

Ken
muythaibxr is offline  
Old 10-31-2009, 04:04 PM
  #7  
Junior Member
 
muythaibxr's Avatar
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Originally Posted by Zaphod
I can only suggest to anyone - use Tuner Studio - it's way better than Megatune and you get used to it very very fast.

@ Marc - great work.Going to have to add this to the DIYPNP over the winter...

Greets
The *ONLY* major problem people are having with TunerStudio is if you have an old computer. It runs a little slow on old computers where MT ran fine.

Just a warning to those who are going to switch. If your computer is older than 3-5 years (based on the feedback I'm getting from various users and ms3 testers) old, it might be a bit sluggish with TS.

Ken
muythaibxr is offline  
Old 10-31-2009, 05:24 PM
  #8  
Elite Member
iTrader: (3)
 
AbeFM's Avatar
 
Join Date: Aug 2006
Location: San Diego, CA
Posts: 3,047
Total Cats: 12
Default

Ken,
Thanks again for all the good pointers. I still haven't even caught up with the answers to my last round of questions on the MS-IIe forums.

The biggest thing I always hear from you, and the piece of advice I ignore the most (heh), is basically not to use PID for anything except long idles.

My situation, where the car will idle 100% ok with the radio off, and idle 100% ok with the radio on (and different settings), but will stall coming into a stop.. doesn't seem like the current PID worldview supports it?

Or, if the idle valve is staying open (i.e. close is set to "never"), then it should handle that very well? Basically, you're counting on what worked last time you were idling to pick the value, as opposed to figuring out a value each time?

I'm worried I'll not be able to, since the music/fans/etc varies more even stop to stop when driving than some might expect. Guess I'll try it soon.

Great idea combining all the idle stuff in one window. :-)

Originally Posted by muythaibxr
Marc D:

Just some suggestions:

1) Having the "RPM with valve closed" and "RPM with valve open" so close together is giong to make the PID gains very sensitive. It might be hard to get it to idle right without oscillation this way. Of course since your Idle open duty and closed duty are so close together, this somewhat counteracts the behavior caused by having the RPM values close together, so it might be fine.
2) I would make PID delay 3 seconds or longer. This just gives the RPM a chance to become stable before going into PID.
3) I usually like a longer crank-run taper but that's just personal preference.
4) A longer ramp to target time will give you the ability to set a larger P-term, which will catch things like the AC turning on better. I usually use 3 or 4 seconds here.
5) You could probably get away with a much shorter control interval. I use 70 ms. This will also help catch sudden load changes.
6) PID lockout rpmDOT threshold should be much much lower, or else you'll get into PID during decel. I use 50-75 here.
7) PID lockout max decel load should be set to just under the lowest load you see at idle.
8) PID disable RPMdot should be set between 100 and 200 RPM. This is for those who don't rev-match when re-engaging first from neutral while the car is moving. It turns off PID when RPMdot goes over the threshold so that the next time PID engages, it's not so low that the engine stalls.
9) I typically use as low of a TPS threshold as I can. On the 20v 4age, I'm using .5%. Having this too high will result in PID staying active while you rev the engine, and will cause the valve to close, and the engine to stall the next time you lift off the throttle.

Ken
AbeFM is offline  
Old 10-31-2009, 06:13 PM
  #9  
Junior Member
 
muythaibxr's Avatar
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Originally Posted by AbeFM
Ken,
Or, if the idle valve is staying open (i.e. close is set to "never"), then it should handle that very well? Basically, you're counting on what worked last time you were idling to pick the value, as opposed to figuring out a value each time?
For the long-idle thing, pay attention to almost any modern car and how it idles. Those turn on the PID control after the car comes to a complete stop. Since we don't have VSS, all those settings are basically there to emulate that behavior. So if you don't let it idle for long, PID should not even engage. That's how my last 3 or 4 daily drivers have worked, and that's what I set out to emulate. My RX8 idles like this, my old Vibe did, my old Alero before that did, and my wife's Vibe does.

Every time you lift off the throttle, even if you have the valve set to close while driving, it opens to last-good+dashpot adder duty.

What worked last time + the adder is the start point for PID to take over again, so really it does "figure it out" every time.

For cases where that's not good enough, I will be adding feedforward control, which will basically intercept the AC button being pushed, add an adder to the current position, and turn on the AC clutch just a bit after that. For the fan, an adder will be added when the fan kicks on. Either way the adder will be there the next time you come to idle, just as if the last good value was with the AC on.

In the meantime, a large dashpot adder works pretty well for catching everything.

I'm also going to be adding the ability to fine-tune idle speed control with a secondary I-only (or maybe PID, I have not decided yet) loop that will be able to interact with the PID controller running on the idle valve.

I'm convinced that a lot of your problems with coming to a stop, etc... are just due to settings and the fact that (unless something has changed) you're running at too high of a frequency setting causing the code to have very inaccurate valve control.

There are really plenty of people using this saying that it's as good as their factory control was the way it is now, and I intend to make it better still.

Ken

Last edited by muythaibxr; 10-31-2009 at 06:31 PM.
muythaibxr is offline  
Old 10-31-2009, 07:55 PM
  #10  
Elite Member
iTrader: (3)
 
AbeFM's Avatar
 
Join Date: Aug 2006
Location: San Diego, CA
Posts: 3,047
Total Cats: 12
Default

I'll give it another go. A big part of it was the philosophy difference, I was trying to force it to be the PID and not the other support settings put in.

The thing that I never got, and I have to read the other thread before getting into it, is the P-only didn't seem to work as P-only, in the limited testing I did. Will get back to all this soon. Thanks again, and for the record, I never had these kinds of loads on the car while stock, so I don't know if it would have handled it well or not.
AbeFM is offline  
Old 10-31-2009, 08:41 PM
  #11  
Junior Member
 
muythaibxr's Avatar
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Originally Posted by AbeFM
I'll give it another go. A big part of it was the philosophy difference, I was trying to force it to be the PID and not the other support settings put in.

The thing that I never got, and I have to read the other thread before getting into it, is the P-only didn't seem to work as P-only, in the limited testing I did
Yeah, I responded to that on the other forum too. It will never converge on a target with P only because it's a type-C PID loop (Three Types of PID Equations). In this type of loop, the P term will only cause responses to changes in PV (RPM in this case), regardless of how much error there is. This way works better for catching large changes due to increases in load, but will never actually converge on a target by itself. For that the I term must be used.

For boost, I'm probably going to change it to a type-B controller so that P can respond to changes in set-point or process variable.

Ken
muythaibxr is offline  
Old 10-31-2009, 08:55 PM
  #12  
Senior Member
Thread Starter
iTrader: (7)
 
Marc D's Avatar
 
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
Default

Thanks for the tips, I will definitely continue working on the settings.
Marc D is offline  
Old 10-31-2009, 09:51 PM
  #13  
Senior Member
Thread Starter
iTrader: (7)
 
Marc D's Avatar
 
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
Default

I played with the settings a lot more, this time I set my open RPM to about 1800-1900, and the closed RPM to about 700.

I set the idle open duty to about 57, closed duty stayed at 27. I put the idle activation RPM adder down to 200, and TPS threshold about 0.5% like you suggested. The Dash pot adder remains at 4.

I set the PID delay to about 4, crank to run taper to 3, and PID ramp to target to about 4. PID control interval now sits at 40 instead of 200.

my PID settings are now completely different, they are set at 115 for P and 165 for I. I did al the running while my lights are on, and my fan came on occasionally. FOr the time being, the settings are just about perfect. I switched on my A/C, the idle caught slowly, but it didnt dip too low to the point where the car will stall. After it caught, it idled close to my set target RPM about +50 above what it was set. Not on target, but very close.

Very happy that the car no longer bogs with it A/C on. If I ever had A/C the car would stall, or when coming to stop it would stall if I didnt keep my foot on the pedal to let it come to a rest. CL idle FTW.

Abe, get on it, its worth the trouble.
Marc D is offline  
Old 10-31-2009, 10:34 PM
  #14  
Junior Member
 
muythaibxr's Avatar
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Originally Posted by Marc D
my PID settings are now completely different, they are set at 115 for P and 165 for I. I did al the running while my lights are on, and my fan came on occasionally. FOr the time being, the settings are just about perfect. I switched on my A/C, the idle caught slowly, but it didnt dip too low to the point where the car will stall. After it caught, it idled close to my set target RPM about +50 above what it was set. Not on target, but very close.
Yeah, you *might* be able to speed up the "catch" behavior using idle advance. Just set it up so that it comes on about the same time as PID idle, and then make it so that higher loads have more timing. That will help catch the sudden load increase with AC coming on.

The feed forward control will ultimately completely get rid of the dip when AC comes on, but for now, turning on and using idle advance should help.

You could probably get it to drop all the way down to the target by slightly decreasing the RPM with valve open (and leaving the valve open duty alone). That kind of situation is exactly what the I-loop for using timing for speed control will help with though. It would just slightly lower timing to get rid of that 50 RPM error. That said, 50RPM isn't that bad.

Very happy that the car no longer bogs with it A/C on. If I ever had A/C the car would stall, or when coming to stop it would stall if I didnt keep my foot on the pedal to let it come to a rest. CL idle FTW.
Very glad to hear that. I put a lot of hard work into getting it to the point where it would catch AC and e-fan coming on and keep the engine from stalling.

Ken
muythaibxr is offline  
Old 11-01-2009, 01:41 AM
  #15  
Senior Member
Thread Starter
iTrader: (7)
 
Marc D's Avatar
 
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
Default

Ok, I just came back form a long hour and a half drive on the freeway, but I noticed something pretty strange.

The idle gets "locked" at about 2300 RPM, basically, the highest "open valve" setting, which was about 57.

It would go into closed loop, and then immediately jump out of it, repeating over and over, with the RPMs remaining at 2200-2400 until I shut off the car. When I restarted the car, The idle went into CLoop, then it settled. But when I started driving and RPMs went above 3000, it repeated the same thing as I got off the freeway.


Whats up with that? Is that the "lock out" that I was reading about?


I set the Open Duty down to 50, and kept the closed duty at 27. I Increased the RPM adder to 400. I also lowered the RPM valve open setting to 1700, and changed the PID settings to 76/167/0. Didn't have time to tinker any more with it tonight, I'll see what happens tomorrow.

Ill try to get a datalog tomorrow if this continues to happen.
Marc D is offline  
Old 11-01-2009, 01:53 AM
  #16  
Junior Member
 
muythaibxr's Avatar
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

IT sounds like PID was engaging when it shouldn't.

Most likely the lockout settings are incorrect, and causing you to go into PID.

If you're using megatune, the CL idle indicator should be at the bottom, and will tell you if it's going into CL idle.

My suggestions number 6 and number 7 should keep this from occurring. Set the lockout RPM setting to 50-75, and set the lockout MAP setting to just below where you idle with no load.

IF you're using TS, you'll have to use the standard gauges that look like MT to see that indicator.

To explain the lockout feature:

Sometimes the code can get into a situation where you get "locked out" of PID idle... In this situation, RPM will be stuck above the RPM+adder value. The lockout settings are there to help the code detect that situation and engage PID anyway.

The RPMdot setting should be set as low as possible so that during a decel situation when you're off the throttle, the code can see that you're decelerating (even if it's a very slow decel) and avoid enabling PID. Also, if MAP is below the MAP lockout setting, it won't enable PID, so that setting should be set a few kPa under the lowest value seen during idle for MAP.

You probably didn't need to change any other settings other than the lockout ones.

Ken
muythaibxr is offline  
Old 11-01-2009, 09:55 AM
  #17  
Junior Member
 
muythaibxr's Avatar
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Also, make sure PID disable RPMdot is set to 100-200. Setting it to 0 will make PID turn off pretty much any time RPM changes once PID is engaged.

Ken
muythaibxr is offline  
Old 11-02-2009, 11:27 AM
  #18  
Senior Member
 
WestfieldMX5's Avatar
 
Join Date: Nov 2007
Location: Belgium
Posts: 999
Total Cats: 73
Default

does the board do what it's supposed to do ie solve the iac hum? I had a very annoying loud hum on mine :(
You're running 488 Hz, right?
WestfieldMX5 is offline  
Old 11-02-2009, 07:04 PM
  #19  
Senior Member
Thread Starter
iTrader: (7)
 
Marc D's Avatar
 
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
Default

No hum frank. Its nice and quiet. Its running at 488Hz, with the 16x multiplier set on the pWM board. The setting on MSQ is 1 as you can see, thats at 30.5Hz.
Marc D is offline  
Old 11-03-2009, 10:39 AM
  #20  
Junior Member
 
muythaibxr's Avatar
 
Join Date: May 2007
Location: Columbia, MD
Posts: 248
Total Cats: 0
Default

Did you try the lockout settings I suggested?

Ken
muythaibxr is offline  


Quick Reply: MSII: PWM Converter Board w/ CL Idle on NB Miatas



All times are GMT -4. The time now is 08:44 PM.