Innovate LC-1 wideband o2 controller bar graph display.

7cory7

Member
I use an Innovate LC-1 wideband o2 sensor controller to monitor the Air Fuel Ratio on my Honda Accord F22A6 Turbocharged engine.
Innovate sells a guage for almost $200.00 which gives a numerical display of your Air Fuel Ratio(AFR).
As I have done most of the work on my car, I wanted a custom solution for the gauge also.
The design is a 18M2 which reads an auxiliary output from the LC-1, which can be configured to output any voltages 0-5v according to AFR, and displays the information graphically.
I use a readadc to read the 0-3.48v signal that I programmed the LC-1 to put out. The Voltage corresponds to an AFR. For very low AFR(Cylinder wash) I display only one or two leds and both the red and green sections are driven giving me an orange color. Safe AFR's are shown in green and once the AFR is in a region where detonation (PING) can occur under boost the display turns red.
It took some time to calibrate the display, but I have tried it on 2 different LC-1 controllers and it works great.
http://www.innovatemotorsports.com/products/lc1.php
The led bargraph was a fleabay job which will display red green or orange if both red and green are driven. Any bargraph will work, i just liked the tri-color option.
This project maxes out the pins available on the 18M2, but hardly touches the capabilities of the chip. A smarter person could probably have built it with and 08, but i don't have much Picaxe experience.
o2 sensor graph.gif
 

Attachments

Last edited:

nick12ab

Senior Member
Just going to show your code here so that the code does not have to be downloaded to view it...
Code:
#picaxe 18m2

#no_data


Main:
debug
goto out
goto AFR
goto lights
goto main

Out:
high b.0
high b.1
high b.2
high b.3
high b.4
high b.5
high b.6
high b.7
high c.6
high c.7
low c.0
low c.2

AFR:
readadc C.1,b1

Lights:
if b1 >= 180 then
goto twentytwo
endif
if b1 >= 167 then
goto twentyone
endif
if b1 >= 154 then
goto twenty
endif
if b1 >= 152 then
goto nineteeneight
endif
if b1 >= 141 then
goto nineteen
endif
if b1 >= 129 then
goto eighteen
endif
if b1 >= 117 then
goto seventeen
endif
if b1 >= 106 then
goto sixteen
endif
if b1 >= 93 then
goto fifteen
endif
if b1 >=89 then
goto stoich
endif
if b1 >=81 then
goto fourteen
endif
if b1 >=68 then
goto thirteen
endif
if b1 >=54 then
goto twelve
endif
if b1 >= 40 then
goto eleven
endif
if b1 >= 30 then
goto ten
endif
if b1 >=27 then
goto nineeight
endif
if b1 >=17 then
goto nine
endif
if b1 >=8 then
goto eight
endif
if b1 >= 1 then
goto seven
endif
goto out

twentytwo:
low c.0
high c.2
low b.0
low b.1
low b.2
low b.3
low b.4
low b.5
low b.6
low b.7 
low c.6
low c.7
goto main

twentyone:
low c.0
high c.2
low b.0
low b.1
low b.2
low b.3
low b.4
low b.5
low b.6
low b.7 
low c.6
toggle c.7
pause 5
toggle c.7
pause 5
goto main

twenty:
low c.0
high c.2
low b.0
low b.1
low b.2
low b.3
low b.4
low b.5
low b.6
low b.7 
low c.6
goto main

nineteeneight:
low c.0
high c.2
low b.0
low b.1
low b.2
low b.3
low b.4
low b.5
low b.6
low b.7 
toggle c.6
pause 5
toggle c.6
pause 5
goto main

nineteen:
low c.0
high c.2
low b.0
low b.1
low b.2
low b.3
low b.4
low b.5
low b.6
low b.7 
goto main

eighteen:
low c.0
high c.2
low b.0
low b.1
low b.2
low b.3
low b.4
low b.5
low b.6 
toggle b.7
pause 5
toggle b.7
pause 5
goto main

seventeen:
low c.0
high c.2
low b.0
low b.1
low b.2
low b.3
low b.4
low b.5
low b.6
goto main

sixteen:
low c.0
high c.2
low b.0
low b.1
low b.2
low b.3
low b.4
low b.5
toggle b.6
pause 5
toggle b.6
pause 5
goto main

fifteen:
low c.0
high c.2
low b.0
low b.1
low b.2
low b.3
low b.4
low b.5
goto main

stoich:
low c.2
high c.0
low b.0
low b.1
low b.2
low b.3
low b.4
toggle b.5
pause 5
toggle b.5
pause 5
goto main

fourteen:
low c.2
high c.0
low b.0
low b.1
low b.2
low b.3
low b.4
goto main

thirteen:
low c.2
high c.0
low b.0
low b.1
low b.2
low b.3
toggle b.4
pause 5
toggle b.4
pause 5
goto main

twelve:
low c.2
high c.0
low b.0
low b.1
low b.2
low b.3
goto main

eleven:
low c.2
high c.0
low b.0
low b.1
low b.2
toggle b.3
toggle b.3
goto main

ten:
low c.2
high c.0
low b.0
low b.1
low b.2
goto main

nineeight:
high c.2
high c.0
low b.0
low b.1
toggle b.2
pause 5
toggle b.2
pause 5
goto main

nine:
high c.2
high c.0
low b.0
low b.1
goto main

eight:
high c.2
high c.0
low b.0
toggle b.1
pause 5
toggle b.1
pause 5
goto main

seven:
high c.2
high c.0
low b.0
goto main
If I may make some comments, all of the IF : ENDIF : next IF... can be compacted by using ELSEIF or gotos can be used simply by putting the label on the IF line. Examples:
Code:
Lights:
if b1 >= 180 then twentytwo
if b1 >= 167 then twentyone
...
Code:
Lights:
if b1 >= 180 then : goto twentytwo
elseif b1 >= 167 then : goto twentyone
...
end if
And except for the toggles, that whole lot of code could probably be changed into a (fancy phrase coming...) 'two-dimensional array' of some LOOKUPs(/table/eeprom) that get the port values for use. Portwide pin changes can be made by using {let} pinsB/C = v543210. Example:
Code:
Out:
 high b.0
 high b.1
 high b.2
 high b.3
 high b.4
 high b.5
 high b.6
 high b.7
becomes
Code:
Out:
dirsB = 255                          'Make pins outputs, needed once only
pinsB = 255                          'Makes all outputs high
 
Last edited:

7cory7

Member
nick12ab:
Thanks for showing the code:)
As is evident, I only have a rudimentary knowledge of the Picaxe language and poor math skills. I will try your ideas, and see what I get.
This is the second project I have made so far, the first being a high altitude balloon computer which has no flown yet so its not in here.
I'm always open to suggestions/criticisms/gripes/laughs/etc
Thanks again
Cory
 

westaust55

Moderator
For the future, you may also consider the SELECT...CASE program command structure in lieu of numerous IF...THEN tests.
 
Top