"Noisy" tpsDOT

This is a forum for discussing the development and testing of alpha MS2/Extra code. Documentation
(Runs on MS2 and Microsquirt)

Moderators: jsmcortina, muythaibxr

JasonC SBB
Helpful MS/Extra'er
Posts: 120
Joined: Wed Oct 26, 2011 7:36 pm

Re: "Noisy" tpsDOT

Post by JasonC SBB »

muythaibxr wrote:Matt Yates (y8s) had an idea that I'm trying on ms3 that could easily be backported to ms2:

If the TPS value doesn't change more than <user settable> %, set TPSdot to 0. I *think* this will allow things to remain just as responsive while not false triggering. Essentially I've implemented half your changes.
The effect of the hysteresis window is the same, but its advantage is that the window moves around as needed.
This is the moving hysteresis window:
http://www.msextra.com/forums/viewtopic ... 40#p301859
Additionally, one should have the "do nothing if TPSdot is below some threshold" thing I mentioned above.
jsmcortina
Site Admin
Posts: 39585
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: "Noisy" tpsDOT

Post by jsmcortina »

JasonC SBB wrote:The effect is the same is you use some kind of lopass filter
There already is. Check the schematics.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Black99rt
Experienced MS/Extra'er
Posts: 364
Joined: Tue Mar 14, 2006 10:38 am

Re: "Noisy" tpsDOT

Post by Black99rt »

While we are on this topic, what is the best TPS wiring scheme? Should I twist all three wires together? Shielded three conductor?
1999 Dakota 5.9L R/T-
MSIIe 3.1.2 Batch Fuel/MSD single coil dizzy/Stepper idle
LC-1
JasonC SBB
Helpful MS/Extra'er
Posts: 120
Joined: Wed Oct 26, 2011 7:36 pm

Re: "Noisy" tpsDOT

Post by JasonC SBB »

jsmcortina wrote:
JasonC SBB wrote:The effect is the same is you use some kind of lopass filter
There already is. Check the schematics.

James
The TPS filter time constant is 220 us. Way too short. It should be closer to 2 ms (10x slower), possibly 10-20 ms. Better yet, turn it into a 2-pole Bessel (my personal favorite :))

I will say this again:

- Thous shalt filter a signal from the outside world, to only the bandwidth required and no more.

A classic error is the audio amplifier designer who designs the amplifier to have MHz bandwidth (when audio signals can be rolled off <100 kHz), and then wonders why the local AM station is getting into his circuit causing weird noise effects.
Last edited by JasonC SBB on Tue Nov 08, 2011 10:21 am, edited 2 times in total.
JasonC SBB
Helpful MS/Extra'er
Posts: 120
Joined: Wed Oct 26, 2011 7:36 pm

Re: "Noisy" tpsDOT

Post by JasonC SBB »

Black99rt wrote:While we are on this topic, what is the best TPS wiring scheme? Should I twist all three wires together? Shielded three conductor?
3 factors make a signal source prone to noise contamination:

- small voltages
- high source impedance
- signal has wide bandwidth ... this means you can't lopass filter the signal aggresively.

All these are relative, of course. But of all the sensor signals, I'd say the knock sensor (mic type as opposed to piezo tuned type) far and away wins all 3 factors, followed by the TPS and MAP.
CLT and IAT are very slow signals so they can be lopassed very aggressively to get rid of any noise.

A shielded wire for the knock sensor is de rigueur. Factory wiring uses shielded wire.

For the TPS and MAP a twisted-wire pair would be good. In my own miata I use the factory wiring for the TPS, and I used shielded wire for the MAP sensor.
Shielded wire for the TPS may be needed if the wiring goes past some extra noisy crap like the ignition coils.

The proper way to use shielded wire is to have 2 wires inside a shield. The - wire goes only from the sensor - to the ECU signal gnd, and isn't connected anywhere else. The shield is grounded to the head or chassis at one end only. The other end of the shield is left floating.

You can use a single shielded cable to carry multiple signals. Say your MAP sensor and TPS are mounted close to each other. Use a shielded cable with 3 wires inside. One is connected to the MAP and TPS - side, and one wire for each for their + side. At the ECU the - wire goes to sensor ground. Again the shield is grounded to chassis or head, at one end. The other end of the shield is left floating.

All this will be defeated if there is *shared impedance noise coupling* (aka "ground loop" - a name I hate) inside the ECU grounding as I alluded to earlier.

Again the current paths of the signal ground return and any other high current ground returns (e.g. MOSFET and IGBTs), *must not share any length of conductor*. The 2 should be connected together at only a single point - in most cases, inside the A/D IC or uC's itself. Many A/D IC's have a signal gnd pin and a digital ground pin, internally connected with bond wires. All circuitry associated with the analog stuff is returned to the signal gnd pin and all digital stuff is returned to the digital ground pin. On the PCB the 2 grounds should not be connected to each other.

In an automotive ECU, all sensor grounds should be connected to the signal ground. (With the possible exception of hall sensor outputs). For protection the signal gnd input at the ECU connector should have a low-impedance, low-current PTC (auto resettable fuse) in series with the connection to the A/D analog ground. If a user connects the sensor ground to a chassis ground, a high current will be driven through the said A/D internal ground blowing it. The PTC will protect it.
y8s
Master MS/Extra'er
Posts: 478
Joined: Wed Jan 07, 2009 3:21 pm

Re: "Noisy" tpsDOT

Post by y8s »

Jason, the schematics are available for the mainboard but not the MS3 processor if you want to look at how grounds are handled on the main board.

http://www.msextra.com/doc/general/ms3v3schems.html

As far as I know, without having the board outline in front of me, ground is just ground. all of the signal and power grounds are linked at the main harness connector pins.
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

JasonC SBB wrote:Question:
Does TPSdot simply look at Delta_TPS (unscaled for sampling rate) or does it do Delta / sampling_rate?
It divides delta by the elapsed time. Sorry for not answering this yesterday. Was kinda distracted with other things.

So I had the car out for another drive into town yesterday. This is the first time with my most recent changes:
  • tpsDOT is now calculated on the raw sample so lag factor has no effect on tpsDOT
  • mapDOT is calculated in the same way as tpsDOT, just using the latest value of map_sample as set by the ISR.
  • now running 35% lag factor for MAP. Graph is now very smooth, as is PW. AFR has smoothed out a bit too.
No opportunity for tuning -- and it definitely needs some -- but I did log the drive. Here's an excerpt -- average traffic-light take off. Here's a before picture (from September):
pre.jpg
And here's a similar take off from yesterday's drive:
post.jpg
As you can see, both DOT graphs are much less "nervous" than before. The much higher tpsDOT value I'm pretty sure is not down to ol' leadfoot, but because the un-lagged TPS value is being sampled. Probably the same is true of MAP. Anyhow, I'll try to find some time to do some more accel tuning, but this looks pretty promising to me.

Have fun,

Rob.
gslender
Super MS/Extra'er
Posts: 1072
Joined: Fri Sep 16, 2011 5:29 am
Location: Brisbane, Australia
Contact:

Re: "Noisy" tpsDOT

Post by gslender »

hi Rob, so where is this implemented code wise? have you published this or have you developed somethign else and running with that?

G
Mazda MX5 + MS3 Pro
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

Thought I'd try to make clearer just what my approach to TPS (and MAP) DOT calculation now is. Apologies to those who have already fully understood, but I thought this diagram might help anyone who's still unclear.
thresh.jpg
The horizontal axis is time, but as seen by the MS -- in particular it only samples the sensor at discrete intervals represented by S0, S1, ... The vertical axis is the sensor value as sampled. The "Clean" line represents the threshold value that might be used for a setup with a good clean TPS signal. The "Noisy" line -- you get the idea.

The oblique lines show the slowest throttle opening rate that can be detected with the "Noisy" parameter for each subsequent sample. So anything between vertical and the first oblique will be detected within one sample; between there and the next oblique will be detected at the second sample; etc.

If you look along the "Clean" line you can see that, even for the slower rates, all can be detected before the next sample. This is where having a clean signal gives its big advantage: its ability to quickly detect small tpsDOT values. The clean signal gives no advantage in speed of response to big tpsDOT values -- though it will likely be more accurate in its estimate of the value itself.

The algorithm that y8s and Ken have been experimenting with (as I understand it) only looks to the next sample. If you have to set the threshold high, it will miss all but the fastest opening rates. Mine allows you to say how long to hold on to the anchor point and so can tease out a slower trend even from a noisy signal.

Another thing to contemplate is how close you would practically want the "Clean" line to be to the time axis. Even if your TPS was perfect with regard to noise, would you really want to detect every little quiver of your foot or jiggle of the engine? More controversially, is there any real need to detect a TPS change of anything less than (say) 3%?

Despite my feeling that this solution is probably good enough, I have certainly found the electronic ideas described by Jason compelling. Some time in the last year or so, downward spikes have been appearing in the raw TPS values that weren't there before. This seems consistent with a larger current raising the ground voltage for a moment. Perhaps it has been there all along and the reason I didn't see it before was that it was always between samples, but I might do a bit of ferreting around with the scope and see what turns up.

Have fun,

Rob.
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

gslender wrote:hi Rob, so where is this implemented code wise? have you published this or have you developed somethign else and running with that?

G
The MAP stuff is new, and I have wiggled the TPS stuff so that it does tpsDOT from the raw values, regardless of the lag factor. Haven't built a patch file for this yet. I can post one; it's just that last time, the only feedback on the code was several people saying that they were interested, but weren't set up to build the software.

Have fun,

Rob.
Black99rt
Experienced MS/Extra'er
Posts: 364
Joined: Tue Mar 14, 2006 10:38 am

Re: "Noisy" tpsDOT

Post by Black99rt »

This is still the case. Very closely watching this, but I'm not set up to build code.

If you send me built code I would load it. I want to upgrade to 3.1.4 anyway for the idle improvements over 3.1.2 and the nonlinear injector dead time.

I dunno in if I know enough about my TPS signal to put in good numbers for your hardcoded variables..... maybe somebody can help with getting that into TS with the INI?
1999 Dakota 5.9L R/T-
MSIIe 3.1.2 Batch Fuel/MSD single coil dizzy/Stepper idle
LC-1
gslender
Super MS/Extra'er
Posts: 1072
Joined: Fri Sep 16, 2011 5:29 am
Location: Brisbane, Australia
Contact:

Re: "Noisy" tpsDOT

Post by gslender »

robs wrote:
gslender wrote:hi Rob, so where is this implemented code wise? have you published this or have you developed somethign else and running with that?

G
The MAP stuff is new, and I have wiggled the TPS stuff so that it does tpsDOT from the raw values, regardless of the lag factor. Haven't built a patch file for this yet. I can post one; it's just that last time, the only feedback on the code was several people saying that they were interested, but weren't set up to build the software.

Have fun,

Rob.
I'll add the code to a mod along with TunerStudio options. Pm me and we can discuss further.

G
Mazda MX5 + MS3 Pro
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: "Noisy" tpsDOT

Post by muythaibxr »

y8s wrote:Jason, the schematics are available for the mainboard but not the MS3 processor if you want to look at how grounds are handled on the main board.

http://www.msextra.com/doc/general/ms3v3schems.html

As far as I know, without having the board outline in front of me, ground is just ground. all of the signal and power grounds are linked at the main harness connector pins.
That's not true. The idea is to wire the sensors back to the sensor ground on the MS, then wire the MS grounds out to the engine so everybody has the same "0"

If that's not happening, there's your noise.

Ken
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
muythaibxr
Site Admin
Posts: 8228
Joined: Thu Oct 14, 2004 12:48 pm

Re: "Noisy" tpsDOT

Post by muythaibxr »

I believe James is going to take his sliding window code from the rpmdot calcs and move it to the other dot calcs.

As far as getting rid of the lag factors and filtering the MAP and TPS signals a different way, I'm interested in the bessel filter for that, so will be looking into it as soon as I have some time.

Ken
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

In case anyone wants to try out the changes, here is a patch file. Be nice to hear back if you give it a go.
tpsmapfilter.zip
I have been working on the 3.1.1 code. Haven't checked whether it's the same in the latest, but I don't think this is a very busy area so the chances are good that it'll work there too.

Have fun,

Rob.
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

muythaibxr wrote:I believe James is going to take his sliding window code from the rpmdot calcs and move it to the other dot calcs.

As far as getting rid of the lag factors and filtering the MAP and TPS signals a different way, I'm interested in the bessel filter for that, so will be looking into it as soon as I have some time.

Ken
Heh -- at the very least this proves that I'm not very convincing.

The least-squares approach will give a more accurate xxxDOT value, but will take longer to respond -- particularly to rapid changes. I don't think it's the right choice in this trade-off.

Once the need for xxxDOT derivation is taken out, using low lag factors already makes for pretty good smoothing.

Have fun,

Robert.
gslender
Super MS/Extra'er
Posts: 1072
Joined: Fri Sep 16, 2011 5:29 am
Location: Brisbane, Australia
Contact:

Re: "Noisy" tpsDOT

Post by gslender »

robs wrote:In case anyone wants to try out the changes, here is a patch file. Be nice to hear back if you give it a go.
tpsmapfilter.zip
I have been working on the 3.1.1 code. Haven't checked whether it's the same in the latest, but I don't think this is a very busy area so the chances are good that it'll work there too.

Have fun,

Rob.
I'm gonna add this into the 3.1.4 release.

Rob, would love some pointers on which parts need to be configurable (unless that is obvious).

G
Mazda MX5 + MS3 Pro
ewflyer
Experienced MS/Extra'er
Posts: 233
Joined: Fri Jul 16, 2010 9:38 am

Re: "Noisy" tpsDOT

Post by ewflyer »

Robs,

It sounds like we're getting closer to a solution for the "computer challanged" like myself.

When you use the word "patch" I imagine a really user-friendly, self-extracting and installing, effortless and painless experience. But it's not, is it?

Greg
robs
Master MS/Extra'er
Posts: 564
Joined: Sun Jan 17, 2010 4:26 pm
Location: Sydney, Australia

Re: "Noisy" tpsDOT

Post by robs »

ewflyer wrote:Robs,

It sounds like we're getting closer to a solution for the "computer challanged" like myself.

When you use the word "patch" I imagine a really user-friendly, self-extracting and installing, effortless and painless experience. But it's not, is it?

Greg
Afraid you're right -- a patch file is a list of differences between one version of code and another. It's a fairly popular way of sharing edits among nerds (I pretend to be one from time to time). What gslender is up will be much closer to what you want.

Still, you're not fooling anyone. If you're really after effortless and painless, why are you using MS!

Have fun,

Rob.
tpsretard2
Master MS/Extra'er
Posts: 662
Joined: Thu Feb 14, 2008 4:59 am

Re: "Noisy" tpsDOT

Post by tpsretard2 »

gslender wrote:
robs wrote:In case anyone wants to try out the changes, here is a patch file. Be nice to hear back if you give it a go.
tpsmapfilter.zip
I have been working on the 3.1.1 code. Haven't checked whether it's the same in the latest, but I don't think this is a very busy area so the chances are good that it'll work there too.

Have fun,

Rob.
I'm gonna add this into the 3.1.4 release.

Rob, would love some pointers on which parts need to be configurable (unless that is obvious).

G
gslender why not wait for the 3.2.0 code..!!??
Post Reply