Honda D Series Forum banner

1 - 20 of 25 Posts

·
Registered
Joined
·
680 Posts
Discussion Starter #1 (Edited)
This has been a project of mine for a little while. Pretty much my first real electronics and arduino project.

I have been wanting a sensor to go with my wideband but I didn't really want to buy a innovate gauge and i didn't have anywhere to put it. I also want the ability to display other data. such as outside temp ambient temp maybe boost and oil pressure by pressing a button to switch.

I learnt the fundamentals of how i could set this up by hooking up a clock display to the arduino and getting it do count and such. then just taped the whole breadboard to the dash to see what it was like.

variable resistor to show code works

in car test it was displaying vacuum in -inHg



last november i bought a couple digits of 7 segment display and a bit of protoboard and did some layout.

tonight i soldered the board together and made all my circuits (what a PITA)

but it works!! so far just need to get power and signal too it.

here it is coming together





 

·
Registered
Joined
·
2,638 Posts
Took me probably 4 hours or so all the way through. Granted that's the first time I've done this.

This will essentially be a volt meter but then change it to display it in air fuel or whatever
The simplest solution is often the easiest. Nice work with the arduino.
 

·
Registered
Joined
·
680 Posts
Discussion Starter #7
That is pretty cool. Any plans to modify the output to take other parameters from the ECU?
There is always the possibility of reading the serial output of the ecu just like freelog does. but i really don't know enough about serial communications or programming yet to do that. there is a thread on there that is called something like "civic lcd dash" which is essentially a whole dash biased on serial info from the computer.

for now this will be able to do everything i want to do with it. if anything i might add a boost control circuit.
 

·
Registered
Joined
·
680 Posts
Discussion Starter #8 (Edited)
I messed around with the code a whole bunch during school today.

implemented a debounced button to switch between states

made a system to make the sensors ready more slowly to make the display easier to read. ( before it would just be a flash of numbers)

made a system that displays a title after each state change to show what info its going to display

anyway from all that coding i ended up with this!





now i just need to wire the thing up and see how it works out.
 

·
Registered
Joined
·
178 Posts
good work, pity that you preferred to go arduino instead of mastering basics of microcontrollers though.
to smooth output either lower the refresh rate or use buffer to show average value.
any details on wb, you said you dont want to buy gauge, so you do have sensor and hardware already?
 

·
Registered
Joined
·
680 Posts
Discussion Starter #13
Thats pretty neat....
Care to share the code?
for sure, its damn long because i didn't use a driver for the displays.


here it is

Code:
/*
led placement for making new symblos

  led
  l  l
  e  e
  d  d
  1  2
  led3
  l  l
  e  e
  d  d
  4  5
  led6
        led7
 */
 
//Pins that each variable is attached to
int anode = 2;
int anode1 = 3;
int anode2 = 5;
int anode3 = 4;
int led = 7;
int led1 = 8;
int led2 = 6;
int led3 = 12;
int led4 = 9;
int led5 = 10;
int led6 = 11;
int led7 = 13;
int input = A0; // input connected to switch
int input1 = A1; // input connected to headlight signal
int input2 = A2; // input connected to IAT
int input3 = A3;  //input connected to MAP
int input4 = A4;  //input connected to O2
int input5 = A5; //input connected to oil pressure
int input6 = A6;
int input7 = A7;

byte thousand = 11; //left most digit in display
byte hundred = 11; // left middle
byte ten = 11;  // right middle 
byte one = 11;  // right most digit in display
byte a = 0;  //varable for thousand 
byte b = 0;  //varable for hundred
byte c = 0;  //varable for ten
byte d = 0;  //varable for one
int z = 0;   //used to determine time the title is displayed
int x =0;   // used to time the display tesing 
int w=0;   //used to time the delay for updating signals
int in2 = 0;  //input for IAT
int in3 = 0;  //input for MAP
int in4 = 0;  // input for o2
int in5 = 0;  //input for oil pressure
int in = 0 ;  // used in testing display
int state = 0;  //state of the switch
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;   //set last button state different to beggining state
long lastDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 50;  //deyal after button pressed before it can be pressed again



// the setup routine runs once when you press reset
void setup() {                
  // initialize the pins as inputs and outputs
  pinMode(led, OUTPUT); 
  pinMode(led1, OUTPUT); 
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(anode, OUTPUT);
  pinMode(anode1, OUTPUT);
  pinMode(anode2, OUTPUT);
  pinMode(anode3, OUTPUT);
  pinMode(input, INPUT);
  pinMode(input1, INPUT);
  pinMode(input2, INPUT);
  pinMode(input3, INPUT);
  pinMode(input4, INPUT);
  
}

void loop() {
  
  int reading = digitalRead(input);
  if (reading != lastButtonState) {    // reset the debouncing timer
    lastDebounceTime = millis();
  } 
  if ((millis() - lastDebounceTime) > debounceDelay) {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:

    // if the button state has changed:
    if (reading != buttonState) {
      buttonState = reading;

      // only toggle the LED if the new button state is HIGH
      if (buttonState == HIGH) {
        state ++;  //changes the state
        z = 0;  //resets title timer
        if (state>=5){
        state = 0; //keeps the state switching between the 3
        }
      }
    }
  }
  
  // save the reading.  Next time through the loop,
  // it'll be the lastButtonState:
  lastButtonState = reading;

//---------------darkness dim for when headlights on ----------

 int darkness = 0;
  int lights = digitalRead(input1);
  
   if (lights == HIGH){//headlights on
    darkness = 0;//lowers duty of leds to darken display
  }
  else
  darkness = 0;

//--------------for testing display ---------

x++;  
if (x==20){
in = in+20;
x=0;
}

if (in >= 1020) {
  in = 0;
}

//---------------for insuring display isn't changing to fast to see

if ( w >= 25){
  in2 = analogRead(input2);  //IAT
  in3 = analogRead(input3); // MAP
  in4 = analogRead(input4); // O2
  in5 = analogRead(input5); // oil
  w=0;
  in2=in3=in4=in5=in;
}
w++;

//-----------------for displaying MAP-------
if (state == 3){

int dnum3 = map(in3 , 0 , 1023 , 0 , 140); //reads O2 input and maps it to A/F ratio 

d = dnum3 % 10;
c = ((dnum3/10) % 10);
b = ((dnum3/100) % 10); 
  a=11;


if( z <= 250){
   a=11;
   b=11;
   c=14;
   d=11;
 }
 if(z>=310){
     z=350;
   }

display2(a,b,c,d,darkness);
}

//-----------------for displaying O2 air fuel ratio-------
if (state == 1){

int dnum4 = map(in4 , 0 , 1023 , 735 , 2239); //reads O2 input and maps it to A/F ratio 

d = dnum4 % 10;
c = ((dnum4/10) % 10);
b = ((dnum4/100) % 10)+20; //+20 makes the number display the decimal point also
a = (dnum4/1000) % 10;
if (a ==0){
  a=11;
}

if( z <= 250){
   a=11;
   b=11;
   c=0;
   d=2;
 }
 if(z>=310){
     z=350;
   }

display2(a,b,c,d,darkness);
}

//-----------------for displaying oil pressure------- defalut display
if (state == 0){

int dnum5 = map(in5 , 0 , 1023 , 0 , 80); //reads O2 input and maps it to A/F ratio 

a = 11;
d = ((dnum5) % 10);
c = ((dnum5/10) % 10); 
b = 11;

if( z <= 250){
   a=11;
   b=0;
   c=1;
   d=15;
 }
 if(z>=310){
     z=350;
   }
   
display2(a,b,c,d,darkness);
}

//-----------------for displaying air temp------- 
if (state == 2){
int dnum2 = map(in2 , 0 , 1023 , -20 , 40); //reads O2 input and maps it to A/F ratio 

d = ((abs(dnum2)) % 10);
c = ((abs(dnum2)/10) % 10); //+20 makes the number display the decimal point also
b = 12;
if (dnum2 >=0){
  b=11;
}
a = 11;

if( z <= 250){
   a=14;
   b=11;
   c=7;
   d=16;
 }
 if(z>=310){
     z=350;
   }
display2(a,b,c,d,darkness);

}

z++;

}


//------------------------display2 -----------


void display2(int a, int b, int c, int d, int darkness) {
  
thousand = a;
hundred = b;
ten = c;
one = d;
  
  digitalWrite(anode, LOW);
  digitalWrite(anode1, LOW);
  digitalWrite(anode2, LOW);
  digitalWrite(anode3, HIGH);
  display1(thousand);
  delay (1);
  thousand = 11; // 11 is blank
  display1(thousand);
  delay (darkness);
  
    
  digitalWrite(anode, LOW);
  digitalWrite(anode1, LOW);
  digitalWrite(anode2, HIGH);
  digitalWrite(anode3, LOW);
  display1(hundred);
  delay (1);
  hundred = 11; // 11 is blank
  display1(hundred);
  delay (darkness);
  
  digitalWrite(anode, LOW);
  digitalWrite(anode1, HIGH);
  digitalWrite(anode2, LOW);
  digitalWrite(anode3, LOW);
  display1(ten);
  delay (1);
  ten = 11; // 11 is blank
  display1(ten);
  delay (darkness);
  
  
  digitalWrite(anode, HIGH);
  digitalWrite(anode1, LOW);
  digitalWrite(anode2, LOW);
  digitalWrite(anode3, LOW);
  display1(one);
  delay (1);
  one = 11; // 11 is blank
  display1(one);
  delay (darkness);

}
//---------------display1 -------

  void display1(int x) {
    if(x==0)  //diplay 0 
  {
   digitalWrite(led,LOW); 
  digitalWrite(led1,LOW); 
  digitalWrite(led2,LOW);  
  digitalWrite(led3,HIGH); 
  digitalWrite(led4,LOW); 
  digitalWrite(led5,LOW);
  digitalWrite(led6,LOW);
  digitalWrite(led7,HIGH);
  }
      if(x==1)  //diplay 1
  {
   digitalWrite(led,HIGH); 
  digitalWrite(led1,HIGH); 
  digitalWrite(led2,LOW);  
  digitalWrite(led3,HIGH); 
  digitalWrite(led4,HIGH); 
  digitalWrite(led5,LOW);
  digitalWrite(led6,HIGH);
  digitalWrite(led7,HIGH);
  }
  if(x==2)  //diplay 2
  {
   digitalWrite(led,LOW); 
  digitalWrite(led1,HIGH); 
  digitalWrite(led2,LOW);  
  digitalWrite(led3,LOW); 
  digitalWrite(led4,LOW); 
  digitalWrite(led5,HIGH);
  digitalWrite(led6,LOW);
  digitalWrite(led7,HIGH);
  }
  if(x==3)  //diplay 3
  {
   digitalWrite(led,LOW); 
  digitalWrite(led1,HIGH); 
  digitalWrite(led2,LOW);  
  digitalWrite(led3,LOW); 
  digitalWrite(led4,HIGH); 
  digitalWrite(led5,LOW);
  digitalWrite(led6,LOW);
  digitalWrite(led7,HIGH);
  }
  if(x==4)  //diplay 4
  {
   digitalWrite(led,HIGH); 
  digitalWrite(led1,LOW); 
  digitalWrite(led2,LOW);  
  digitalWrite(led3,LOW); 
  digitalWrite(led4,HIGH); 
  digitalWrite(led5,LOW);
  digitalWrite(led6,HIGH);
  digitalWrite(led7,HIGH);
  }
  if(x==5)  //diplay 5
  {
   digitalWrite(led,LOW); 
  digitalWrite(led1,LOW); 
  digitalWrite(led2,HIGH);  
  digitalWrite(led3,LOW); 
  digitalWrite(led4,HIGH); 
  digitalWrite(led5,LOW);
  digitalWrite(led6,LOW);
  digitalWrite(led7,HIGH);
  }
  if(x==6)  //diplay 6
  {
   digitalWrite(led,LOW); 
  digitalWrite(led1,LOW); 
  digitalWrite(led2,HIGH);  
  digitalWrite(led3,LOW); 
  digitalWrite(led4,LOW); 
  digitalWrite(led5,LOW);
  digitalWrite(led6,LOW);
  digitalWrite(led7,HIGH);
  }
      if(x==7)  //diplay 7
  {
   digitalWrite(led,LOW); 
  digitalWrite(led1,HIGH); 
  digitalWrite(led2,LOW);  
  digitalWrite(led3,HIGH); 
  digitalWrite(led4,HIGH); 
  digitalWrite(led5,LOW);
  digitalWrite(led6,HIGH);
  digitalWrite(led7,HIGH);
  }
 
  
  }
i had to take out all the different symbols cause the post has too many character. but its more of the same just different pins set to high and low.
 

·
Registered
Joined
·
680 Posts
Discussion Starter #14
good work, pity that you preferred to go arduino instead of mastering basics of microcontrollers though.
to smooth output either lower the refresh rate or use buffer to show average value.
any details on wb, you said you dont want to buy gauge, so you do have sensor and hardware already?
yeah I do want to do a project with just a micro controller but i really don't have any experience with them. and as you can probably see my coding skills aren't exactly the best. But they do work for me.

see if you can find what i did to smooth the output. it seemed to work quite good.

wideband is a inovate lc-1 i bought a while ago. i do tuning with crome free and freelog so whenever i am tunning i have a display. i haven't really needed a display for it, but i started to think it would be nice so i did this.


thanks for all the support guys! i figured some of you would get a kick out of it.
 

·
Registered
Joined
·
2,638 Posts
When you going to start selling these as kits? Can't be too pricey to make them.
 

·
Registered
Joined
·
680 Posts
Discussion Starter #17
When you going to start selling these as kits? Can't be too pricey to make them.
I might design a printed circuit board to make this a lot more reliable, then i guess i could set a set with the displays some wire and the arduino. but there would have to be decent demand for it.

And i would also have to contact the forum about selling stuff and becoming a sponsor which i haven't done so i can't sell or advertise anything.
 

·
Registered
1999 EJ8
Joined
·
1,188 Posts
I would totally buy one.

A clock is nice and all but what you have there really sets it apart for function.
 

·
Registered
Joined
·
2,638 Posts
DIY kits would be much easier then making and selling them.
 
1 - 20 of 25 Posts
Top