It is currently Wed Jul 18, 2018 10:05 pm



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 37 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Wed Sep 07, 2016 2:37 pm 
Offline
User avatar

Joined: Thu Mar 26, 2015 11:55 am
Posts: 112
Location: Massachusetts, USA
So op-amps and active filters are quite a big subject and I am struggling a bit on how to post where things stand now.

My first reason to use op-amps on the analog input was because I assumed they would provide more protection to the CPU than just the simple RC filter. There is some truth to this, but the amount varies and is sometimes not really much more. Many suitable op-amps provide 10 mA of clamping but some very attractive parts provide less.

Using simple diodes in small packages can provide 100 mA of clamping pretty easily and at low cost. It is important to use low leakage diodes though so Schottky as I used in the original design are out. But what are we clamping against? Battery voltages ( with spikes ), AC line voltages, ESD or transients from the ignition drivers?

Other reasons to use an op-amps is to provide amplification for small signals or an increase in the input impedance. Our 5xxx chip provides the ability for a gain of 4x on it's differential inputs and the A/D does not draw much current from it's input. So these issues do not pose an issue for most of out inputs.

It appears then that a couple of approaches may be appropriate depending on the purpose or source of the input. Sensors for coolant and air temp using thermistors are easier to handle than something with a potentially high impedance like, I assume, an oxygen sensor.

In addition to the RC filters, op-amps and low-leakage diode clamps there are also special TVS diodes for ESD protection on data lines. Careful choice is required here for leakage currents which would not normally be an issue for digital lines but depending on source impedance may be a problem for us. In addition these would limit the voltage that a signal line could be exposed to to maybe 35V. Some are rated for brief exposure to jumping with a 24V battery.

Next, I'll make some explanations about filter choices and we can also talk more about supporting "interesting" inputs that might require op-amps.


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Wed Sep 07, 2016 3:54 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
A compelling reason for some people to buffer the inputs would be in situations where this may piggy back on another ECU or controller of some sort. Then, whatever the 5xxx chip ADC / inputs sink will not pull down the input to the other unit.

I'm thinking more like if the user has some reason to have the stock ECU coexist with this, or in the future where transmission controllers or other such may be a source of inputs.

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Wed Sep 07, 2016 10:05 pm 
Offline
User avatar

Joined: Thu Mar 26, 2015 11:55 am
Posts: 112
Location: Massachusetts, USA
I hadn't thought yet about issues with piggybacking controllers etc., so I'm glad you brought it up again. Do you have a specific example we can look at, that would help? I don't think it's an issue for most sensors, but I am not sure.

The CPU performs the ADC function by charging a small cap, something like 10 pF, during part of the clock cycle and then applying this cap to a network of resistors and comparators. The input impedance of the this block is extremely high, maybe gigaOhms. The capacitors in the RC input filter are several orders of magnitude larger than what is on the inside of the chip.

It may be that sharing the inputs causes problems because of interactions of the RC filters on the different boards? Mostly what I was looking at with the op-amps was the protection and filtering. If we decide to do buffering, that's simple enough, but it would probably require it's own stage.


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Thu Sep 08, 2016 4:40 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
I haven't had to deal with it myself but I've read about people who have needed to interface to the speed sensors and things and some ECU put a bias voltage on wires for fault detection or noise reduction or whatever reasons. That can shift voltages above 5V, so the bias has to be removed in the piggyback unit before it hits that ADC and do so without affecting the actual signal to the other ECU.

It's likely not an issue worth addressing now because it would probably be on a case-by-case basis, so just something to think about for the future.

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Fri Sep 09, 2016 10:43 am 
Offline
User avatar

Joined: Thu Mar 26, 2015 11:55 am
Posts: 112
Location: Massachusetts, USA
Thanks, I hadn't thought of some of those issues, especially non 5V stuff. It's pretty clear that just connecting wires together might not work or even be a bad idea.

I think for most inputs an RC filter alone is appropriate. We'll look at what to do with some more interesting inputs. Next I'll comment a bit on filters and then we'll look at the special inputs for "interesting" things.


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Fri Sep 09, 2016 12:10 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
A little further thought and it might be easier to develop a simple, stand-alone "signal conditioner" type module that could be placed between a "corruptible" source and the piggyback ECU.

Then, if a signal needs interfaced to and the signal has some odd trait like a bias voltage, or otherwise needs buffering, one of these could be installed inline. Since there may be no particular "standard" configuration, the components that may need altered could be left uninstalled and be designed in as through-hole type parts for the user to install once those values are established. Put it in a standard automotive relay-like housing and it could be made a clean installation.

Probably should spin this off to another topic if the interest is there.

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Sat Sep 17, 2016 11:50 am 
Offline
User avatar

Joined: Thu Mar 26, 2015 11:55 am
Posts: 112
Location: Massachusetts, USA
So, I'm just going to say wow, filtering is a huge subject. You could spend years on this and still have years in front of you... One of the things that amazes me is that some of the filters are named after mathematicians who did their work a hundred years ago or more.

There are two sides to implementing the filters for our use - the electrical topology and then the electrical characteristics of each stage and their interactions with each other. Examples of electrical topology include RC and RLC which are passive. Active filter examples include Sallan-Key and Multiple Feedback configurations that use op-amps.

Our data for the ECU is baseband, it is not de-modulated from a higher frequency like an FM radio station. This means we should not need to be filtering out adjacent signals of large magnitude in order to discriminate the desired signal. In addition many of our sensors will be powered from a voltage regulator which will also filter against much of the noise in our auto environment.

It appears then that filters with rapid roll-off are not needed. An exception would be modern knock sensors, maybe ion sensors and oxygen sensors (less likely). The knock sensor and oxygen sensor would also benefit from gain ( 4x is provided by the Freescale part ).

So our basic inputs will have RC filters. The Freescale chip has a max injection current of 3 mA and an input leakage current of 250 nA. I have also seen lower numbers for the injection current, like 1 mA. The reference designs often use a 20K resistor on the input. Using that value the leakage current will produce a 5 mV offset error.

I have more to write here, but need to do some errands so I'll post this and then we'll talk about providing external protection to avoid the injection current...


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Sun Sep 18, 2016 12:46 pm 
Offline
User avatar

Joined: Thu Mar 26, 2015 11:55 am
Posts: 112
Location: Massachusetts, USA
Continuing on here.

The 5 mV offset is about a 4 bit error, so reducing it certainly won't hurt. These 4 bits might be at least partly hidden by other errors, the Freescale manual gives an ENOB of just under 9 bits.

Using an op-amp can reduce this error because the feedback will correct it. It can also be reduced by using smaller value resisters on the input. Doing that also requires providing external protection and that's what we're looking at now.

In order to provide this external protection we need to provide clamps and to decide wether to clamp to a diode drop beyond the rails or to get smarter and provide clamps directly to the rails. If we clamp a diode drop beyond the rails, that is use a diode directly to the rails, we need a 2nd order filter and the clamping happens between the stages. The second stage isolates the clamped voltage from the CPU, otherwise the CPU chip diodes will attempt to current share and likely die in the process.

The second order filter and it's clamp diodes is simple to layout and inexpensive. The complication here is that the 2 stages of the filter should be carefully designed so that their interaction provides the expected result. We would like to provide a flat pass band, a sharp knee, minimize overshoot and preserve phase relationships. In the real world we will need to make tradeoffs here. Additionally I have not yet found a tool or web site that helps design 2nd order passive filters...

Next we'll think about active current limiting with something like MOSFETs and providing clamping rails that are a diode drop within the 0V-5V range...


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Tue Sep 20, 2016 4:53 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
As a thought, none of the 5V sensors should reach either rail. Even an MPX4xxx sensor outputs 0.2 to 4.8V with a 5V supply. Resistive sensors similarly should hit the rails. A TPS is physically limited by the throttle body from bumping against its stops.

By the same token, a wide band O2 shouldn't ever read 0V or 5V on its output either.

If you're sensing battery voltage through a divider, the same applies- the divider is selected so that at a 14.5V nominal, when running, falls under the 5V range, and if you sense 0V... I'm surprised the engine is running. ;)

For many of the sensors, a simple rolling average without any filtering, I think, would suffice... maybe a little cap on it to remove any "AC" component... and some sanity checks like if the engine temp (CLT) jumps from 190F to 486F between sampling periods, that might be worthy of ignoring, but if it persists there's a problem likely with the sensor or wiring.

I know the discussion is about hardware, but the above would likely be a hardware fault the software should detect.

We are not decoding GSM or LTE or LORA signals so the filtering doesn't need to be complex. It's just reading some analog sensors. Filter out AC components, normalize voltages and move on... I would think.

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Fri Sep 23, 2016 12:01 pm 
Offline
User avatar

Joined: Thu Mar 26, 2015 11:55 am
Posts: 112
Location: Massachusetts, USA
I was going to say "Hi Abe", but I looked up your username first - it's hilarious....

Anyway, I agree on the filtering - it's not something we need very much to pursue. It tends to be part of providing protection though making it almost unavoidable. If a sensor lead takes a static hit or comes in contact with battery voltage there will be potentially a leading edge showing up at the ECU with 100A or more in a billionth of a second. So the choice of the parts facing outwards here is important. Obviously not everybody does this but I think it's especially important for people working with performance equipment or other things that are subject to a lot more handling and potentially mistakes of various types.

Also thanks for mentioning the MPX4xxx sensors. I did look at the data sheet to remind myself and realize now that providing current limiting to the sensors may be more involved than I expected. It requires 7mA @ 5V to run, so a simple series resistor probably won't work. Sigh...

Here's the update. I'm trying to work out a way to provide clamping rails that are one diode drop inside the power rails ( GND and 5V ). Also whether to provide active current limiting on the inputs using little depletion mode MOSFETs. The issues seem to be about board space as much as anything. The transistors are only $0.16....

We're almost there...


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Fri Sep 23, 2016 9:59 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
Not sure about hilarious, but abecedarian has its own connotations, which is why I chose such an obscure user name. It allows me to be both the idiot and savant. ;)

My opinion is that any filtering outside what may be necessary to protect the processor or remove any bias, as I mentioned previously, really isn't necessary. If the input voltages are constrained to tolerable values, the processor itself will be doing what is necessary so as to translate those to workable things. Various things like reading sensors during pre-determined windows in relation to crankshaft position, for instance.

For most values, a running sum and average would suffice... like coolant temp for instance. It's not going to spike randomly. Arguably, few of the sensors would do that. MAP may be an exception, as maybe O2 could be... but then O2 is a reactive, and not proactive, sensor and as such what it gives you is an "after the fact" reading; a little hard to predict things after the fact. What is there to filter? It's not like you're doing audio processing, eh? Oh... that knock sensor.... ;)

So many possible filters one could apply to knock sensing.

Realistically, we're just reading the voltage from sensors so not much filtering going on. It is not like were trying to run a polytonic VU meter. ;)

Constrain, sample, sum, average... seems to me all that's needed. Yeah, maybe some oversampling for MAP, TPS and maybe O2, but... what else?

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
 Post subject: Re: Practical and basic prototype ECU decisions...
PostPosted: Fri Sep 23, 2016 10:10 pm 
Offline
User avatar

Joined: Sat May 11, 2013 9:52 am
Posts: 304
Location: Over here, doing 'over here' things.
Maybe worth noting:

... most sensors are not going to hit the rails. They might get close, but the MPX4xxx have a 0.2 to 4.8V output range, so no 0V or 5V despite those being the supplies. Also, a TPS sensor will likely have a few degrees of rotation left over when at closed or fully open. Air and coolant temp sensors similarly won't, or at least shouldn't, be fully open or shorted either... and O2, narrow band at least, should be oscillating around 0.5V- if it hits 0V or above 1V, there's a problem; wide band are another issue, but still shouldn't be hitting 0V or 5V if monitoring their analog output.

So, out of those sensors, IAT and CLT might be the troubled ones. But if you know what their biased voltage is, if their output is that voltage you know the sensor is either not present, failed open or its signal wire is shorted to its source, and if the voltage is 0V, you know the sensor has failed shorted to ground, or its signal wire is shorted to ground.

_________________
/me goes off to the corner feeling like Jerry Springer with a mullet.

My O5E candidate: 1982 Honda CX500TC motorcycle.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 37 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Theme designed by stylerbb.net © 2008
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All times are UTC - 5 hours [ DST ]