Introduction: VDO Oilpressure Sensor for Arduino

The Idea is to make a 7.0 Inch TFT (800X480) instrument sensor readout for my little boat.

It has An onboard Yanmar 3GM30 3 cylinder diesel engine. The motor is as simple as it gets.

There are just two gauges onboard (Fuel and á RPM gauge) and i would like to expand.

Water tempeture, oil pressure, exhaust tempeture, water level and a battery monitor.

The price to make this happen is between 700 and á 1000 Euro's if i buy gauges and sensors.

I believe that is unbelievable expensive.

So i lookes at other options. Arduino to the rescue.

My first idea was that there must be somebody on the net that already done that.

And there was, I just Gould not make it work and had to adjust the code.

Most of the code was hard to understand and sometimes not complete.

My knowledge is minimal and I ‘am not capable of advising anybody with writing code.

My English is not that good so excuse my French.

I just modify existing code to my benefit. I also like to share in the hope to help another person to get his project going.

To make this work I started with a 16X2 LCD and the code works with that.

Step 1: Things You Need.

Things you need:



1. One Arduino board
2. VDO sensor or from another brand. I believe it works my way with all
3. 16X2 LCD
4. 10Kohms potmeter
5. MCP1755 Voltage regulator.
6. Elco 1uF
7. Elco 10uF
8. Green led
9. Resistor 150ohms
10. Resistor 1000ohms (1Kohm)
11. Powersupply for your Arduino
12. Breadboard, wires
13. 200 ohms Potentiometer (Or one that has the same ohms range as your sensor)
14. An Multimeter with leads
15. A tyrepump with a pressure gauge and a dustblow niplle
16. Compressor


Step 2: The Voltage Regulator

I made this because my battery on my boat is 12VDC and is charged to 14.8VDC by the alternator, when the battery is discharged.

And to measure I need a steady max 5VDC voltage to spare the Arduino and make it somehow accurate.

I used a Voltage regulator described at Electroschematics.com from P. Marian witch worked great

Again thanks for sharing.

I added a green led with a 150 Ohms resistor in series to see if I got the power.

1. Connect one side of the resistor to the positive 5V.

2. Connect the other side to the LED long leg.

3. Connect the short leg from the LED to the Negative side.

If you hook it all up correctly The LED turns on and you now you have 5V.

Mine is 5,07 Volts. Pretty damm accurate.

Step 3: Install Your LCD to Your Arduino.

Install the LCD as described on the pictures.

Is a standard hook-up with the "Hello World" code.

Step 4: Make the Voltage Divider for the VDO Oilpressure Unit.

I started to try out the example found at secrettweakerpad.blogspot.nl

I used this schematic to work from. His equation did not work for me. The readings where far off. Probably my sensor has different values. The schematic worked so I kept it. Also the routine he used i adapted and modified. Thanks RenaissanceMan for sharing.

The code only works with the left side of the schematic to the Arduino.

If you hook it up to your 12VDC system make sure you connect the negative poles.

The positive side from your voltage regulator goes to the 1000ohm (1Kohm) resistor.

Where the VDO is drawn I have placed a 100ohms potentiometer with a 100ohms resistor in series.

I did not have a 200ohm potentiometer lying around so to fix this i did it my way (love Sinatra).

The range from my VDO senderunit is 10-180Ohms.

To find the digital values that will be given by the VDO will be explained later.

Step 5: Mapping Out the VDO Sensor

An oilpressure sensor works with pressure.

So I took my tyre pump pistol and removed the tube. I placed a dust blower point to it. Om my VDO I placed a piece of gardenhose and secured it with a hose clamp.

On the other side I put it on my tyre pistol and secured that one too with a clamp. Started up my compressor and stopped it at a little more than 5 BAR.

Hooked my Multimeter to the correct terminal (the one that was about 180ohms) and the black lead to the metal housing of the VDO. (Be aware that sometimes there are two terminals you have to place your leads on, because the housing is not the negative part but the other terminal is)

Dropped the pressure to 5Bar and measured 181ohms and put it in a table.

Dropped it again with two tens of a BAR and wrote down the measured ohms in the table.

Step 6: Get the Digital Value From the Sensor

The trick is when you put the code in your Arduino IDE you will find two lines as shown below.

The first is in the Setup routine //Serial.begin(9600);

Remove the two //

void setup() {

lcd.begin(16, 2); // set up the LCD's number of columns and rows:

lcd.print("Oliedruk"); //Print a message to the LCD.

//Serial.begin(9600);

The second one is in the loop function. . //Serial.println(RawADC) Again remove the two //

float OilPressure1(float RawADC)
{ float Pressure; //Local variable. Only used in this routine.

//Serial.println(RawADC);

When you run the code and upload it. Start your serial monitor. It will display your digital value.

Why do you do this?

When you run the Serial monitor and the LCD at one time, the display gives odd figures.

That is when you are done, not wanted. So when you are done with putting the digital values in your table put the two // for these two lines and your LCD tells it all.

Step 7: Copy the Code and Load It in Your Arduino

/*

Oliepressuresensor VDO 0-5 bar with switch for Yanmar 3GM30 Boat engine First took a Pressure gauge fot pumping tires and mapped the pressure versus OHMS. Put it in a tabel. I hooked up a compressor to my tirepumping pistol with a pice of waterhose and two clamps. I started at 5 bar and let air out every two tens of a bar less and wrote the ohms in a tabel. On my workbench i hooked up a potentiometer to find the Digital values that i got in return. A bit tricky. The lcd and the serial monitor where biting eachother. Little bit fidling about. But it worked. I put the RAWADC values in my tabel and put in the numbers at the if, else statment in the code below.

The powersupply is 5V regulated. I found out that the arduino droped the power to 4,5V. I started to try out the example found at http://secrettweakerpad.blogspot.nl/2012/08/contr... I used this schematic to work from. His equeation did not work for me. The readings where far off.Probebly my sensor has diverend values. The schematic worked so i kept it. Also the routine he used i adapted and modified. Thanks RenaissanceMan for sharing.

Searched the internet and found http://secrettweakerpad.blogspot.nl/2012/08/contr... from Ken Kallsen. Thanks for sharing. Used the Liquid christal example to start provided bij the arduino interface. Copied IF else function and to my surprise it worked first time.

The circuit:

* LCD RS pin to digital pin 12

* LCD Enable pin to digital pin 11

* LCD D4 pin to digital pin 5

* LCD D5 pin to digital pin 4

* LCD D6 pin to digital pin 3

* LCD D7 pin to digital pin 2

* LCD R/W pin to ground

* LCD VSS pin to ground

* LCD VCC pin to 5V

* 10K resistor:

* ends to +5V and ground

* wiper to LCD VO pin (pin 3) *

* I used a Voltage regulator described at http://secrettweakerpad.blogspot.nl/2012/08/contr... from P. Marian witch worked great

* Again thanks for sharing. I added a green led with a 150 Ohms resistor to see if i got the power.

* MCP1755 Voltage regulator.

* Electrolitic capacitor 1 Uf and 10Uf

* Green Led * resistor 150 ohm

*

* Used A2 as the readanalog port.

*I used for the voltage divider a 1000Ohms resistor straight on de 5V and the sensor on the negative side.

*The middlepoint i lead to the A2 analog port.

* http://secrettweakerpad.blogspot.nl/2012/08/contr...

* Make sure you couple the minus from the regulator and the arduino together

* I intend to use the 12V from my boat to feed the arduino and the sensor.

* The Voltage regulator will be mouted near the engine block to provide the 5V to the sensor.

Intension is to mount a tempeture sensensor for the exhaust, cooling water sensor, Engine bay tempeture sensor and oilpressure sensor and display it on a GLCD screen.

This can be used for a lot of sensors just map out the values and you are good to go.

Here is the standard Cristal display words as used in the example area.

Library originally added 18 Apr 2008 by David A. Mellis library modified 5 Jul 2009 by Limor Fried (http://www.ladyada.net) example added 9 Jul 2009 by Tom Igoe modified 22 Nov 2010 by Tom Igoe

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/LiquidCrystal

*/ //----------------------------------------------------------

#include <LiquidCrystal.h

// include the library code liquidcristal:

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

float OilPressure; // Variabel for calculating oilpressure

//-----------------------------------------------------------------

void setup() {

lcd.begin(16, 2); // set up the LCD's number of columns and rows:

lcd.print("Oliedruk"); //Print a message to the LCD.

//Serial.begin(9600);

}

//------------------------------------------------------------------

void loop() {

OilPressure = (float(OilPressure1(analogRead(2))));

lcd.setCursor(0,2); //Start to print on the second line.

lcd.print(float(OilPressure)); //Pints oilpressure to the display

lcd.print(" BAR");

}

//---------------------------------------------------------------------

float OilPressure1(float RawADC) {

float Pressure; //Local variabel. Only used in this routine.

//Serial.println(RawADC);

if(RawADC < 30) Pressure = 0.0;

else if (RawADC < 62) Pressure = 0.4;

else if (RawADC < 72) Pressure = 0.6;

else if (RawADC < 78) Pressure = 0.8;

else if (RawADC < 86) Pressure = 1.0;

else if (RawADC < 95) Pressure = 1.2;

else if (RawADC < 102) Pressure = 1.4;

else if (RawADC < 105) Pressure = 1.6;

else if (RawADC < 112) Pressure = 1.8;

else if (RawADC < 117) Pressure = 2.0;

else if (RawADC < 125) Pressure = 2.2;

else if (RawADC < 128) Pressure = 2.4;

else if (RawADC < 137) Pressure = 2.6;

else if (RawADC < 142) Pressure = 2.8;

else if (RawADC < 147) Pressure = 3.0;

else if (RawADC < 152) Pressure = 3.2;

else if (RawADC < 159) Pressure = 3.4;

else if (RawADC < 166) Pressure = 3.6;

else if (RawADC < 171) Pressure = 3.8;

else if (RawADC < 176) Pressure = 4.0;

else if (RawADC < 181) Pressure = 4.2;

else if (RawADC < 183) Pressure = 4.4;

else if (RawADC < 188) Pressure = 4.6;

else if (RawADC < 195) Pressure = 4.8;

else if (RawADC < 198) Pressure = 5.0;

delay(1000); // Just a delay otherwise the display is flashing

//Pressure = Pressure * 14.7; //convert from bar to PSI

return Pressure; //Returns to the second line of the loop function.

}

Step 8: Find the Digital Numers to Program With

I commented the code very precise.

But when I copied it into the site, it was a disaster. I had to remove it.

When the code works and you see a number on your LCD, you have succeeded for replicating mine.

Now you have to find to the numbers to make your sensor accurate.



1. Remove on your voltage divider the white wire (In my Picture) this is the middle point between the two resistors.
2. Now hook-up your digital multimeter and set it to ohms setting you have written down in your table at the top. With me is that at 5 Bar/181Ohms
3. So your multimeter now says 181 ohms. That equals 5 Bar at your sensor (in this case mine)
4. Remove one lead from your Multimeter and put the white wire back in the breadboard.
5. Start your Serial monitor.
6. You will see now the digital value that eguals 5Bar.
7. Write down in your table.
8. Repeat step 1 to 7 but now take the ohm reading at 4.8 (in my case 177).
9. The digital values in the code are written after the < (smaller then) sign.
10. Fill in your own values and you are two tens of a bar precise.


I put a short explanation in front of the code to thank the people who shared it on the net and to now when I going to build it in my boat as a reference what I have done.

Good luck with build.

Comments

author
muzzen (author)2017-04-08

Hello , this sensor can measure pressure in tyre?

author
WillemN1 (author)muzzen2017-04-20

This sensor has an metric thread of about 8mm or named M8.
It is used to messure oilpressure within engineblocks.
I'am not sure if you can use it for tire pressure.

The sensor is expensive, about 50euro's.

Hope this helps.

author
Muhammad AsifB (author)WillemN12017-09-14

helo sir

I am giving 3 volt in pin analog (2) but not giving any reading on lcd

author
andersos (author)2015-09-20

Could be useful, thanks :)