Complete n00b :) Car Information LCD

Hello. I am complete n00b at this...i mean Arduino stuffs. Also .. sorry for my bad english :slight_smile: I came to this idea a week ago. I want to make a LCD with Arduino that read some analog data in my car. I ordered 0.96" IIC I2C OLED and Arduino UNO. They will come maybe 1-2 weeks ahead. Last time that i was writing some code was at school...now i am metal worker. Anyway.... i am taking this job seriosly :slight_smile: I am reading now some tutorials and stuffs. Anyway....on the job now :slight_smile:

I have Mercedes W202 C200K with LPG. The LPG has a MAP sensor. It's analog from 0 to 5V. I know what type is the sensor : MPXHZ6400A . This sensor read LPG Pressure . Also my car have Lambda probe which have range from 0.01V to 1.10V. My wish is to make Arduino read those analog data and displays it at this OLED.

For now i found some tutorials for 0-5v voltmeters and for some analog data reader :slight_smile:

My wish is this....i know that coding this is maybe a job for 30min for somebody. If somebody want to help me please write here. If nobody want to make this i will teach myself to make it :slight_smile: any help will be very good for me.

For now i will read basic tutorials and wait the hardware to start testing :slight_smile: My purpose for this topic is to tell people what i cant do by myself.

Without electronics knowledge you risk to damage your car, or make it inoperable. You also won't get useful data from the sensors, unless you know how to connect to them properly.

At least you should run some examples using analogRead(), reading voltages from e.g. a pot, and write the voltage to the display. If that works, you can start connecting to your car's sensors, with protective resistors added between the sensors and analog inputs.

Hello. I know a lots of stuffs about hardware , but maybe 0 things about codding :slight_smile: I know how to use multimeter , how to connect and test stuffs and etc :slight_smile: The hardware part dont afraid me at all. All of the repairs , LPG instalation and etc are made by me . Anyway....i found an 0-30v oled tutorial , boost gauge oled tutorial and one friend that might help me .... i have some ideas in my head :smiley: When i was younger i should get more interested in codding stuffs. I will post here all of the things that i do just in case that somebody spot any error :slight_smile:

As i see there is no need to make protective resistors between sensor andd analog inputs because it nevers get more than 1.1V . But i should :slight_smile:

You always need protection resistors in a car. The fault currents possible with just basic errors are easily enough to set fire to your Arduino. Consider every wire leaving your box might get hit with +36V or -24V at any time.

Do you have any other computer in the car other than the LPG one? (I have no idea of Mercedes model numbers so I don't know how old it is.) Often it's easiest to plug the Arduino into the OBD2 port on a modern car. There's lots of projects online to do this, with associated hardware cheaply available.

Just connecting one 0-5V sensor to an analog input on the Arduino seems simple enough. That should be easy to get started.

My car si 1999 and its on old mercedes O style 38pin plug , with iso9141-1 . I remember that it might have K line but i am not sure. I will make a protected voltmeter as you say...maybe some tutorial. In any case the voltage shouldnt get more than 1v ,because it will blow car ECU. What is best way to power up arduino...5v or 12v. I read that both work great in a car. A lot of people connect it directly to cars instalation..

It's highly likely that the sensor information is being broadcast on your car's "CAN bus".
A $3 CAN bus adaptor and an Arduino is probably all you need.

I will search information about this lately today. I wasnt knowing that there ia can bus readers :slight_smile: the ELM readers cant connect to my ECU...anyway...the LPG Gas Pressure sensor is stabd alone and cannot be readed by can bus :slight_smile: Thanks a lot for this idea

Hello. I have a problem . After receiving all hardware i started to make some code. I use a template for the Lambda sensor which is a 0-5V Voltmeter. The problem is : when i run a Voltmeter code its ok, but when i add analog sensor 2 read the arduino start to make mistakes. If there is only 1 analog input it works fine , when i make 2 analog sensors read , the screen starts from 0.10v and make a lots of changes between 0.08v to 0.10v. When i put 1.5v battery at A0 input ( it display 1.52V voltage ) but the other value also get 1.5V read and show 1.2bar of pressure but infact the A1 analog isnt connected at all :slight_smile: Here is the code :

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

void setup() {

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.setTextColor(WHITE);

}
void loop(){
  delay(1);
  display.clearDisplay();

  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println("Gas Pressure");
  display.setTextSize(2);
  
  int sensorValue1 = analogRead(A1);
  float bar = sensorValue1 * (400 / 102300.0);   // 400kpa to 4.0BAR
  display.print(bar); display.println("Bar");
  
  display.setTextSize(1);
  display.println("Lambda");
  display.setTextSize(4);
  display.setTextSize(4);
  
  int sensorValue = analogRead(A0);
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  display.print(voltage); display.println("V");
  display.display();

}

If i disable the second analog read the measures start from 0V and they are right :smiley:

Here is a picture:

An ADC is not a voltmeter, you can read any random value from an open input.

all lessons i see was with ADC Voltmeters...what is best way to do it ? both of the sensors that i want to read are 0-5v analog . My idea was to read both volts and displayes it :slight_smile:

Connect the sensors to the analog inputs, then you can read meaningful values. Or add a pulldown resistor to open inputs, as is done in voltmeters.

Your picture shows nothing connected to any analog pins. With nothing connected, what voltage did you expect? The analogRead() can't return "nothing" so it returns a random value.

If i connect 1.5v battery to A0 , the voltage gets to 1.52V ,but also the A1 input goest to 1.2bar which is 1.5v :slight_smile: thats the problem...if there is only one input measured there isnt any problem. I will show later

A typical PEBKAC :frowning:

Sorry if i was missunderstanded or etc. Now it works. I speak with a local boy and he give me some advices. First the measurements are made with 50ms delay one by another , the next was texts , and then they are called on the display. Everything works fine. Heres a picture : . Thanks a lot :slight_smile: