wideband AFR sensor interface

It's all about the code!
Post Reply
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

wideband AFR sensor interface

Post by AndreyB »

My wideband AFR set is one of the cheapest on the marked - http://betterpartx.com/catalog/1 $99.99 for sensor + controller + a tiny digital display

This controller has a 9600-8-N-1 serial interface and a simpler analog interface which I currently use. The whole code is

Code: Select all

aft = interpolate(0, 9, 5, 19, voltageSignal);
Let's see who've got what :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: wideband AFR sensor interface

Post by kb1gtt »

Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

Ops, apparently my BPSX unit has some "publicity": http://forum.diyefi.org/viewtopic.php?f=6&t=2138
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
mobyfab
Posts: 139
Joined: Tue Oct 29, 2013 10:09 am
Location: Versailles, France

Re: wideband AFR sensor interface

Post by mobyfab »

http://www.14point7.com/

They have some really nice units.

Also there is the AEM UEGO which I've been using for a few years with my turbo civic, very good and the price it not that high.
User avatar
Sergey89
contributor
contributor
Posts: 839
Joined: Wed Sep 25, 2013 5:30 pm
Location: Russia, Velikiy Novgorod

Re: wideband AFR sensor interface

Post by Sergey89 »

User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

Jared, do you happen to know who has created that schematics?

As usual, it takes me two years to notice the cool stuff :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: wideband AFR sensor interface

Post by kb1gtt »

That schematic has not been tested yet :( However I have physically validated the footprint, so the chip fits on the PCB. Also it wouldn't take much to make that into it's own PCB. I seem to recall I have a CJ125 kicking around somewhere.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

I've created a blank project & copied the schematics, looks like the CJ125 would need to be extracted into a separate file https://svn.code.sf.net/p/rusefi/code/trunk/hardware/CJ125_board/
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

russian wrote:looks like the CJ125 would need to be extracted into a separate file
Now with proper symbol - schematics looks good now. https://svn.code.sf.net/p/rusefi/code/trunk/hardware/rusefi_lib/cj125.lib
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

http://www.open5xxxecu.org/viewtopic.php?f=44&t=101 has the full 40 page datasheet for CJ125
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

http://www.msextra.com/forums/viewtopic.php?f=123&t=54150#p401147
mariob wrote:The implementation was not that hard as the datasheet for the sensors is quite informative and the CJ125 does the bigger part of the work. One just needs to take the both analogue values (temperature and mixture), calculate lambda (ok, this was a 6th order polynom but no black magic), send lambda to a pwm output (with a scaling the MS understands) and feed a small pid controller for the heater. This is also the right place to take care of not destroying the sensor by heating it up too quickly. (i always assume -40°C here, this wastes some seconds of usefull sensor data on hot starts but is always safe)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

http://www.turbo-mopar.com/forums/showthread.php?74106-Connectors&p=1036486&viewfull=1#post1036486 has some data on 4.2 and 4.6 connectors
Turbo SOB wrote:Bosch LSU 4.2 Wideband O2
936142-1 (TE, Micro Timer, 6-way connector) HAVE
144431-1 (TE, Junior Power Timer, 17 - 22 gauge tin terminal) HAVE
12157739 (Delphi, 2.8 Timer, tin terminal) HAVE
15324976 (Delphi, Metri-Pack 150, White Cable Seal) HAVE

Bosch LSU 4.9 Wideband O2
1599620-2 (TE, Housing, Micro-Timer, Available from OnlineComponents.com) HAVE and verified to work with Bosch sensor p/n 17025.
284716-4 (TE, Housing, Micro-Timer, Mouser) HAVE and verified, but is more difficult to disconnect than the 1599620 (may be good or bad, depending on what you want).
964274-2 (TE, Female Terminal, Micro-Timer, Available from OnlineComponents.com) HAVE
1241732-2 (TE, Female Terminal, Micro-Timer II, Mouser) HAVE, appears to be identical to 964274, but is pre-gapped a tiny bit (reduces connection force).
962876-2 (TE, Female Terminal, Micro-Timer, Mouser) HAVE, I can't tell any difference to 964274.
968015-2 (TE, Female Terminal, Micro-Timer, Mouser) HAVE, slightly different tang design (though, for what benefit?).
964972-1 (TE, Cable Seal, Micro-Timer, Yellow, 1.9 - 2.4 mm Insul. O.D, Available from OnlineComponents.com) HAVE
963530-1 (TE, Cable Seal, Micro-Timer, Gray, 1.4 - 1.9 mm Insul. O.D) HAVE
964971-1 (TE, Cable Seal, Micro-Timer, Red, 1.2 - 1.6 mm Insul. O.D) HAVE
Update: see also http://wbo2.com/cable/lsuconns.htm
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: wideband AFR sensor interface

Post by puff »

I couldn't find any source codes for that controller (I mean software)
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: wideband AFR sensor interface

Post by puff »

oops. sorry. actually, I could. that was code in basic.
KLAS
Posts: 23
Joined: Tue Jul 14, 2015 8:58 am

Re: wideband AFR sensor interface

Post by KLAS »

russian wrote:another open source cj125-based controller including source code and gerbers: https://www.elektormagazine.com/magazine/elektor-201201/19791

Looks like the article has leaked to http://uploadkon.ir/uploads/4b5782ba531bb58ff30ceeaa383a9212.pdf and/or http://d1.amobbs.com/bbs_upload782111/files_49/ourdev_707565DNEIR9.pdf
if i'm not mistaken, this evolved to http://breitband-lambda.de/
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

First bump with rusEfi CJ125 integration:

I've populated only the chip and R1 which is the RST line pull-up. My logic analyzer shows that https://svn.code.sf.net/p/rusefi/code/trunk/firmware/hw_layer/sensors/CJ125.cpp is sending the IDENT_REG_RD 0x48 command but I get no response from the chip.

What do you think I am missing?
Attachments
screenshot.png
screenshot.png (3.81 KiB) Viewed 16987 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: wideband AFR sensor interface

Post by kb1gtt »

To me it is unclear at what voltage the CJ125 will register as a 0 vs a 1. Your LA will trigger at something like 1V or 1.5V. However the CJ125 is 5V for VCC, so you probably need to get close to 5V before it registers as a 1. I believe you STM is driving at 3V. Is that correct? If so then we may need a level shifter, something to prove the concept could be purchased from sparkfun. https://www.sparkfun.com/products/12009 If that turns out the be the problem, I can add those to the PCB easy enough.

Other things to check, did you get 5V at the CJ125 pin? I know that the footprint is mangled, so verifying it made it to the pin might be a good validation that all is well. Also do you see these signal pulses at the SPI pins? Again I know the footprint is mangled. Just because you see these signals on the discovery pins, doesn't mean they are making it to the CJ125. Is C8 installed? Is C1 installed?
Welcome to the friendlier side of internet crazy :)
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: wideband AFR sensor interface

Post by kb1gtt »

Ah, just found the voltage levels in cj125a.pdf. For SCK on pg 31, it notes 0=vcc*0.3=1.5V. Then 1=VCC*0.7=3.5V.

What happens if you put 3V to VCC instead of 5V? I know this would not have proper accuracy, but it might allow the SPI logic to start working. I would expect that VCC needs to be 4.28V or lower before it would start to potentially work with 3V SPI signals. Can you drop your VCC voltage to 4.28? Do you still have one of those adjustable 5V power supplies which the 5V switch regulator was based on? Those had a POT which allowed you to set the voltage.
Welcome to the friendlier side of internet crazy :)
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

Now with

engineConfiguration->spi2SckMode = PAL_STM32_OTYPE_OPENDRAIN; // 4
engineConfiguration->spi2MosiMode = PAL_STM32_OTYPE_OPENDRAIN; // 4
engineConfiguration->spi2MisoMode = PAL_STM32_PUDR_PULLUP; // 32

next step capacitors and finding my DSOQuad
Attachments
screenshot.png
screenshot.png (8.91 KiB) Viewed 16963 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: wideband AFR sensor interface

Post by AndreyB »

Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Post Reply