Close

Page 1 of 2 12 LastLast
Results 1 to 25 of 29
  1. #1
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0


    2 out of 2 members liked this post. Yes Reputation No

    Secondary O2 sensors - what does the ECU want to see?

    Iím interested in programming a microcontroller to simulate the secondary O2 sensors.

    Background: A lot of Z4/Z4M guys want to run aftermarket headers, but a tune to turn off the SES light causes them to fail the OBDII readiness test. While you can get away with welding in bungs after the section 1 cats and extending the sensors, many are hesitant to Frankenstein their expensive section 1ís. The Z4M is such a low production car that you have to do a bit of searching to find a used section 1. Itís an OEM catted piece, so new prices are outrageous. Most donít possess the skills to make such a modification themselves. Owners donít want to take their cars to a random muffler shop and request they make a modification that the owner may not fully understand or have confidence they can totally explain. Again, the cost of miscommunication or incompetence can be extremely expensive.

    The goal is to create a totally plug and play microcontroller that requires some minimal soldering or splicing, with installation difficulty on par with aftermarket gauge wiring. I donít want to intimidate the average DIYíer.

    I know very little other than whatís on Wikipedia about how O2 sensors operate. Please correct me if Iím wrong. From what Iíve gathered, both primary and secondary O2 sensors on these cars read 0.1 V (lean) to 0.9 V (rich). Once they are warmed up- by a combination of onboard heaters and exhaust gasses- they generate the voltage themselves. The secondary O2ís typically vary between 0.7 V and 0.9 V when at full operating temperature. They donít fluctuate with the primary O2 sensors (I donít understand why). Their outputs do not appear to be related.

    1.) What does the ECU want to see from the secondary O2 sensors?

    2.) What are the four wires on the O2 sensors? Heater power, heater ground, O2 output, O2 ground?

    3.) Does anyone have some graphs they can post that show the outputs of the primary and secondary O2 sensors over time? Preferably from a catted M54- or S54-equipped car, but an uncatted car can be used to show what the ECU doesnít like to see.

    4.) Can anyone recommend an OBDII port-based data-logging tool thatís inexpensive?

    5.) Why are the secondary O2 sensor outputs not tied to the primary O2 sensor outputs? I can understand the cats providing some damping, but I would think they would at least fluctuate together.

    6.) Does the voltage of the secondary O2 sensors need to fluctuate, or can it be a steady voltage?

    7.) Iíve heard the ECU will throw a fault code if the heating element of a secondary O2 sensor doesnít appear to be operating (like if I left the sensor totally unplugged). Is this true?

    8.) What are the bounds of the secondary O2 sensor voltage under normal conditions? 0.7-0.9 V?

    9.) Is the O2 sensor output a steady state value that moves incrementally, or is there any kind of frequency/duty cycle? Iíve heard itís a constant voltage, but Iíve also heard the output is a square wave (which would complicate things).

    My plan right now is to splice the primary O2 heater wires and feed them into inputs on the microcontroller. This will be used to determine when the heating element is operating. While the heater is operating, I can have the microcontroller randomly output voltages (or none at all) to mimic a cold O2 sensor. When the heating element shuts off (does it ever?), I will have the secondary O2 sensors start to output a randomly fluctuating voltage between 0.7 V and 0.9 V. Iíll use a variable resistor in its own circuit to add in some adjustment logic. Thoughts?

  2. #2
    Join Date
    Sep 2012
    Location
    Harrisburg
    Posts
    1,281
    Rep Points
    1,527.3
    Mentioned
    43 Post(s)
    Rep Power
    16


    2 out of 2 members liked this post. Yes Reputation No
    You can accomplish the same thing using a 555 timer. I made a post somewhere talking about this, let me see if I can find it.

    Here: http://www.bimmerboost.com/showthrea...720#post367720

    The secondary sensor is a narrow band type, with two wires for the heater, one for signal and one for signal ground.

    The secondary sensors monitor the health and effectiveness of the primary catalyst, and are not used for AFR control like the primary sensors are.

    You will need to keep the sensor hooked up to satisfy the minimum current requirements of the heater circuit to prevent a code. Alternatively, you can use a resistor equal to the resistance of the sensor heater, or possibly slightly above, as the resistance will increase as the heater element warms. Make sure the resistor you choose can handle the power. Remember use 14 volts for power calculations, and not 12.

    The sensor fluctuates between 0.2 and 0.8 volts with 0.45 volts being equal to ~14.7 AFR. The DME wants to see the voltage in this range. It also wants to see a certain number of transitions from rich to lean in a certain amount of time. Finally the average time spent above or below 0.45 V will indicate the mixture.

    You can think about it like a 0.6 volt PWM signal offset by 0.2 volts. The duty cycle will control whether the DME thinks the sensor is reading rich or lean, and the frequency indicates the time constant of the circuit.

    The 555 circuit will operate at a fixed frequency, and the potentiometer will control the duty cycle.

  3. #3
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0



    Yes Reputation No
    Thank you very much!! I will check out the link. Much appreciated!

  4. #4
    Join Date
    Jan 2010
    Location
    SoCal
    Posts
    118,865
    Rep Points
    31,850.6
    Mentioned
    2092 Post(s)
    Rep Power
    319


    Yes Reputation No
    Click here to enlarge Originally Posted by pokeybritches Click here to enlarge
    but a tune to turn off the SES light causes them to fail the OBDII readiness test.
    So why not just run stock software when the OBDII test is necessary?

  5. #5
    Join Date
    Sep 2012
    Location
    Harrisburg
    Posts
    1,281
    Rep Points
    1,527.3
    Mentioned
    43 Post(s)
    Rep Power
    16


    Yes Reputation No
    Click here to enlarge Originally Posted by Sticky Click here to enlarge
    So why not just run stock software when the OBDII test is necessary?
    The primary catalysts have been removed, so the secondary oxygen sensors will never allow the DME to set the Primary Catalyst Monitor to ready.

    It's like when someone uses off road down pipes in their 335, and uses a Cobb to suppress the MIL. The readiness monitor is never set for OBD-II emissions testing purposes. Most people in the 335 world use the DP-Fix, which essentially (exactly?) is the 555 secondary 02 simulator circuit described.

  6. #6
    Join Date
    Jan 2010
    Location
    SoCal
    Posts
    118,865
    Rep Points
    31,850.6
    Mentioned
    2092 Post(s)
    Rep Power
    319


    Yes Reputation No
    Click here to enlarge Originally Posted by ajm8127 Click here to enlarge
    The primary catalysts have been removed, so the secondary oxygen sensors will never allow the DME to set the Primary Catalyst Monitor to ready.
    Ah of course. But you can just put the primary cats back in for inspection right?

  7. #7
    Join Date
    Sep 2012
    Location
    Harrisburg
    Posts
    1,281
    Rep Points
    1,527.3
    Mentioned
    43 Post(s)
    Rep Power
    16


    Yes Reputation No
    Click here to enlarge Originally Posted by Sticky Click here to enlarge
    Ah of course. But you can just put the primary cats back in for inspection right?
    I suppose you could, but that's a PITA. If you could make a device that would emulate the proper signal from your secondary sensors at the flip of a switch, now that's an easy solution which doesn't require putting your car in the air or taking it to a shop.

    Not like this is ground breaking, O2 sims have been available for a long time, but this is why they exist, well for secondary sensors at least.

  8. #8
    Join Date
    Jan 2010
    Location
    SoCal
    Posts
    118,865
    Rep Points
    31,850.6
    Mentioned
    2092 Post(s)
    Rep Power
    319


    Yes Reputation No
    Click here to enlarge Originally Posted by ajm8127 Click here to enlarge
    I suppose you could, but that's a PITA.
    For sure, just another way to solve problems.

  9. #9
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0



    Yes Reputation No
    Thanks again for the info. I want to proceed with building a microcontroller that will output a signal similar to the 555 timer, because I think it will be easier to troubleshoot and is much more versatile. It will be easier to build, more reliable (less soldering and components), and cheaper.

    What you are saying is to use 0.2 V for low, 0.8 V for high, and let the average per cycle be used to determine if the mixture is lean or rich?

  10. #10
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0



    Yes Reputation No
    Click here to enlarge Originally Posted by Sticky Click here to enlarge
    Ah of course. But you can just put the primary cats back in for inspection right?
    Since the primary cats are located in the headers, you would have to swap back in your stock headers and buy new gaskets. For those like me that will be running Supersprint V1 stepped headers, this means swapping section 1's as well. Many states have annual inspections, so this would be a huge pain.

  11. #11
    Join Date
    Jan 2010
    Location
    SoCal
    Posts
    118,865
    Rep Points
    31,850.6
    Mentioned
    2092 Post(s)
    Rep Power
    319


    Yes Reputation No
    Click here to enlarge Originally Posted by pokeybritches Click here to enlarge
    Since the primary cats are located in the headers, you would have to swap back in your stock headers and buy new gaskets. For those like me that will be running Supersprint V1 stepped headers, this means swapping section 1's as well. Many states have annual inspections, so this would be a huge pain.
    Agreed. Last resort Click here to enlarge

  12. #12
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0



    Yes Reputation No
    Click here to enlarge Originally Posted by ajm8127 Click here to enlarge
    The primary catalysts have been removed, so the secondary oxygen sensors will never allow the DME to set the Primary Catalyst Monitor to ready.

    It's like when someone uses off road down pipes in their 335, and uses a Cobb to suppress the MIL. The readiness monitor is never set for OBD-II emissions testing purposes. Most people in the 335 world use the DP-Fix, which essentially (exactly?) is the 555 secondary 02 simulator circuit described.
    Correct, and both of my cars will be supercharged, so stock software isn't feasible even if I put back in the stock exhaust.

  13. #13
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0



    Yes Reputation No
    Click here to enlarge Originally Posted by ajm8127 Click here to enlarge
    The secondary sensor is a narrow band type, with two wires for the heater, one for signal and one for signal ground.

    You will need to keep the sensor hooked up to satisfy the minimum current requirements of the heater circuit to prevent a code. Alternatively, you can use a resistor equal to the resistance of the sensor heater, or possibly slightly above, as the resistance will increase as the heater element warms. Make sure the resistor you choose can handle the power. Remember use 14 volts for power calculations, and not 12.
    This answers #2, 7.

    Click here to enlarge Originally Posted by ajm8127 Click here to enlarge
    The sensor fluctuates between 0.2 and 0.8 volts with 0.45 volts being equal to ~14.7 AFR. The DME wants to see the voltage in this range. It also wants to see a certain number of transitions from rich to lean in a certain amount of time. Finally the average time spent above or below 0.45 V will indicate the mixture.

    You can think about it like a 0.6 volt PWM signal offset by 0.2 volts. The duty cycle will control whether the DME thinks the sensor is reading rich or lean, and the frequency indicates the time constant of the circuit.
    This answers #5, 6, 8, and 9.

  14. #14
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0



    Yes Reputation No
    Click here to enlarge Originally Posted by ajm8127 Click here to enlarge
    Not like this is ground breaking, O2 sims have been available for a long time, but this is why they exist, well for secondary sensors at least.
    I agree it's far from groundbreaking.

    However, I haven't found anyone that has had success with an O2 sim on the Z4M, but I have found a few that couldn't make one work. I'll add a few bits of adjustability via potentiometers (lean/rich cycle rate for one).

  15. #15
    Join Date
    Sep 2012
    Location
    Harrisburg
    Posts
    1,281
    Rep Points
    1,527.3
    Mentioned
    43 Post(s)
    Rep Power
    16


    1 out of 1 members liked this post. Yes Reputation No
    Click here to enlarge Originally Posted by pokeybritches Click here to enlarge
    Thanks again for the info. I want to proceed with building a microcontroller that will output a signal similar to the 555 timer, because I think it will be easier to troubleshoot and is much more versatile. It will be easier to build, more reliable (less soldering and components), and cheaper.

    What you are saying is to use 0.2 V for low, 0.8 V for high, and let the average per cycle be used to determine if the mixture is lean or rich?
    Using a micro controller, you will have the issue of generating the voltages. There is a trick to generate NTSC frames using two outputs here:

    http://eyetap.org/ece385/lab5.htm

    You will have to configure a voltage divider on one pin to produce 0.2 volts, and another pin will have to be configured to output 0.8 volts. You will switch between the two outputs at some frequency which is the response time of the sensor. During each cycle, the duty cycle will equate to the sensor measuring rich or lean.

    I would configure the circuit to use a microcontroller with two analog inputs that you can connect two potentiometers to. These pots will control the frequency and duty cycle of the output waveform. The simulators usually requires some tuning to trick the DME into thinking there is a sensor attached, and the potentiometers will allow you to do that. Easiest way to figure out what frequency and duty cycle is necessary is to monitor the sensor's output while connected to a set of headers with cats in them. If you don't have an oscilloscope, I'm sure you can find documentation online about what the frequency should be.

  16. #16
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0



    Yes Reputation No
    Click here to enlarge Originally Posted by ajm8127 Click here to enlarge
    Using a micro controller, you will have the issue of generating the voltages. There is a trick to generate NTSC frames using two outputs here:

    http://eyetap.org/ece385/lab5.htm

    You will have to configure a voltage divider on one pin to produce 0.2 volts, and another pin will have to be configured to output 0.8 volts. You will switch between the two outputs at some frequency which is the response time of the sensor. During each cycle, the duty cycle will equate to the sensor measuring rich or lean.

    I would configure the circuit to use a microcontroller with two analog inputs that you can connect two potentiometers to. These pots will control the frequency and duty cycle of the output waveform. The simulators usually requires some tuning to trick the DME into thinking there is a sensor attached, and the potentiometers will allow you to do that. Easiest way to figure out what frequency and duty cycle is necessary is to monitor the sensor's output while connected to a set of headers with cats in them. If you don't have an oscilloscope, I'm sure you can find documentation online about what the frequency should be.
    Again, outstanding information! I'll check the link. I would rep you if I could.

    I'll have to brush up on my microcontrollers, but I was under the impression that I would have an analog output, depending on the model. I was going to have the software determine when to switch between 0.2 and 0.8 V on that output. Potentiometers will be used for duty cycle, wave frequency, and rich/lean oscillation frequency.

    One concern is the amperage of the heater circuit. After some testing I could determine the resistance values of the heater circuit when the O2 sensor is cold and hot. I could then have the heater wires (or wire) fed into inputs on the microcontroller, and have an output dedicated to producing the expected voltage. If the amperage is high, I'll look into some trickery to get the required current without burning out the microcontroller.

    Ultimately I'll look into buying O2 sensor connectors and make it totally plug and play, other than maybe splicing the wires to power the microcontroller.

    I don't have an oscilloscope, and it may be time to purchase one. I actually have been without my cars for 7 months now. Been deployed to Afghanistan, but I'll be headed home in the next few weeks. Again, I appreciate all the help!

  17. #17
    Join Date
    Sep 2012
    Location
    Harrisburg
    Posts
    1,281
    Rep Points
    1,527.3
    Mentioned
    43 Post(s)
    Rep Power
    16


    Yes Reputation No
    I have not used microcontrollers with on board D2A converters. Which models are you looking at?

    I got a Rigol model DS1102E and have had good luck with it. I've read of people modifying the 50 MHz version for 100 MHz bandwidth, but when I got mine they were the same price, so I got the 100 MHz model.

    For the heater circuit, I would just test the resistance of the O2 sensor heater, and pick a resistor close to that value. I suspect the DME just supplies voltage to the heater, and as long as the current is in range, it is happy. It probably only really cares about open or short circuit conditions, so the acceptable range is likely quite large. If you wanted, you could measure the current in the heater circuit directly and size the resistor that way. Make sure you use a large power resistor. P = I^2 * R

  18. #18
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0



    Yes Reputation No
    Click here to enlarge Originally Posted by ajm8127 Click here to enlarge
    I have not used microcontrollers with on board D2A converters. Which models are you looking at?

    I got a Rigol model DS1102E and have had good luck with it. I've read of people modifying the 50 MHz version for 100 MHz bandwidth, but when I got mine they were the same price, so I got the 100 MHz model.

    For the heater circuit, I would just test the resistance of the O2 sensor heater, and pick a resistor close to that value. I suspect the DME just supplies voltage to the heater, and as long as the current is in range, it is happy. It probably only really cares about open or short circuit conditions, so the acceptable range is likely quite large. If you wanted, you could measure the current in the heater circuit directly and size the resistor that way. Make sure you use a large power resistor. P = I^2 * R

    I think you're right about there not being analog outputs. I did a little research and it looks like all I can do is create a low pass filter with a PWM signal... and that wouldn't work since I don't know what frequency I'll be using. It's been about 7 years since I've messed with microcontrollers, and that was in school and a controlled, supervised environment. The link you sent will be extremely helpful, and I'll go the route you suggested.

    I'm checking out the Rigol DS1102E.

    I'll use a resistor for the heater circuit like you recommend. The logic is sound.

  19. #19
    Join Date
    Sep 2011
    Posts
    18
    Rep Points
    56.7
    Mentioned
    0 Post(s)
    Rep Power
    0



    Yes Reputation No
    Update: Ordered the Rigol DS1102E Click here to enlarge

    I'll do some tests when I get back next month.

  20. #20
    Join Date
    Sep 2012
    Location
    Harrisburg
    Posts
    1,281
    Rep Points
    1,527.3
    Mentioned
    43 Post(s)
    Rep Power
    16


    Yes Reputation No
    I know it will add additional components, but you might want to think about using a voltage follower on the output of your DAC. That will allow your circuit to be almost completely insusceptible to the input impedance of the DME on the secondary O2 signal lines.

    Using the two digital outputs and voltage dividers as a DAC is great because it is simple, but it is going to have a high output impedance. Using a rail to rail op-amp configured as a voltage follower, you can lower the output impedance of your circuit tremendously, and this will keep your signal where you want it. Something like the Microchip MCP6002-E/P is cheap and should do the job.

    Also think about trying to find a clean, regulated 5 volt supply to power your circuit (not the heater, but the micro controller). That will make your life easier. If you must use the heater circuit for power, I recommend looking into transient voltage suppression and then using a 5 volt LDO regulator to drive the electronics. Any noise in the power supply to your circuit will be coupled to the output, and when the range of voltages for the O2 sensor signal is only 0.2V to 0.8V, this noise may make a difference.

    Finally, make sure the components you use are specified for the industrial operating range. The commercial range is only good to 0 įC.

  21. #21
    Join Date
    Oct 2012
    Location
    NJ/Philly
    Posts
    57
    Rep Points
    122.7
    Mentioned
    0 Post(s)
    Rep Power
    2


    1 out of 1 members liked this post. Yes Reputation No
    This is very interesting. I was also debating this idea but with the oem O2 sensor feeding data to a microprocessor and having the microprocessor trim the output and tweak so the range is within accepted values. I haven't gotten far with this though as I am not catless yet!
    Click here to enlarge

  22. #22
    Join Date
    Sep 2012
    Location
    Harrisburg
    Posts
    1,281
    Rep Points
    1,527.3
    Mentioned
    43 Post(s)
    Rep Power
    16


    Yes Reputation No
    I think the ideal situation would be to have a microcontroller, or even a binary counter with proper supporting circuitry monitor the primary O2 sensor and base the simulated secondary O2 sensor output on that. In this way it would be self adjusting.

    As long as the engine sees the secondary O2 sensor changing at a slower rate than the primary O2 sensor, within reason, things should be fine.

    Or is that exactly what you said? You didn't specify the sensor the micro would read.

    Then again, the primary and secondary O2 sensors should cycle rich/lean at the same rate if there is no catalyst. So even if you took the output of the secondary sensor in a catalyst-free system and divided that by 2 or 4, the end result would still be a dynamically adjusting secondary O2 simulator.

  23. #23
    Join Date
    Oct 2012
    Location
    NJ/Philly
    Posts
    57
    Rep Points
    122.7
    Mentioned
    0 Post(s)
    Rep Power
    2


    Yes Reputation No
    Click here to enlarge Originally Posted by ajm8127 Click here to enlarge
    I think the ideal situation would be to have a microcontroller, or even a binary counter with proper supporting circuitry monitor the primary O2 sensor and base the simulated secondary O2 sensor output on that. In this way it would be self adjusting.

    As long as the engine sees the secondary O2 sensor changing at a slower rate than the primary O2 sensor, within reason, things should be fine.

    Or is that exactly what you said? You didn't specify the sensor the micro would read.

    Then again, the primary and secondary O2 sensors should cycle rich/lean at the same rate if there is no catalyst. So even if you took the output of the secondary sensor in a catalyst-free system and divided that by 2 or 4, the end result would still be a dynamically adjusting secondary O2 simulator.
    I was thinking about using the oem, rear O2 sensor as input. The microproccessor can then be programmed to add a small trim to allow the DME to see acceptable values. Again this is all theoretical.

    I wish I had a car to log but I'm still on the fence about deleting my cats though. The headers are $400 and AA off-road tune $600. $1k for a 15-20whp bump in power is kinda crazy. Not much I can do with the N52B30 though. This is really the only mod that has the potential for noticeable gain
    Click here to enlarge

  24. #24
    Join Date
    Oct 2012
    Location
    NJ/Philly
    Posts
    57
    Rep Points
    122.7
    Mentioned
    0 Post(s)
    Rep Power
    2


    Yes Reputation No
    So I caved. I just placed an order for catless headers. I've been reading on other forums that the BMS DP fix works for my car. I ordered that as well. I guess I'll know for sure in a couple weeks Click here to enlarge

    I think some of the Z4s come with N52s so the BMS DP fix may work for them as well.
    Click here to enlarge

  25. #25
    Join Date
    Sep 2012
    Location
    Harrisburg
    Posts
    1,281
    Rep Points
    1,527.3
    Mentioned
    43 Post(s)
    Rep Power
    16


    Yes Reputation No
    I don't see why the BMS DP fix wouldn't work for most cars. You should be fine.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •