Introduction

Hello all, As I progress on my 99 F150 build I realized that it would be nice to replace the original oil pressure switch used by Ford with an actual gauge. So, I have decided to implement this via a simple ATTINY88 Micro Development Board. Like this one from Amazon. Below, I will discuss the plan to accomplish this feature and still maintain the original check oil light. Oh, the benefit to this is that I will have the ability to program exactly when the check oil light turns on. Or, to why the check oil light would turn on. Such as, some other failure condition in the future such as if I add oil temp to the mix next.

3D Top View of PCB for pressure sensor.

The Plan

This is not to complex of a plan. For example, it is using the Development Board so I do not have to mount the ATTiny88 on an pcb board it is already done. It also provides a breakout of the micro’s I/O so now all I have to do is take the 12v (actually more like < 16v) and convert it to a constant 5v. No problem, just use a standalone regulator supply like this. Then, I have to send out the signal to the original circuit so the dash check oil light works as it did; well at least, similarly to original as I want it to work. Here, I referenced the Mitchell Manuals for the circuit that controls the oil light. Below, is from the Instrument Cluster wire schematic.

Oil Pressure Switch Original Schematic

Great, this is not to complex! All I have to due is ground out that wire so a simple Mosfet negative switch will work wonderful and I can easily control this with the ATTiny88 I/O. So, the 2N7000 Mosfet will work here just fine without any further Mosfet driver. It has a VGS(th) of 2.5v so should switch on fine to drive circuit to ground. Especially true since it is only driving a wire that connects to another Microcontroller so there is not a high current flow in this circuit. Probably < 1mA of current flows in this circuit. The 2N7000 can handle 500 mA current all day long.

Below is an example of the switch circuit; and my circuit will replicate this design R gen is going to be a 1K Ohm resistor just to handle the gate capacitance and not overdrive the ATTiny88 IO ports current.

Basic N Mosfet Switch Circuit.

After looking at the ATTiny88 it is a 5v capable device so no voltage leveling needs to be done. Here is an example circuit if you wanted to do 3.3v max voltage leveling.

5v to 3.3v Voltage Leveler Circuit.

Also, V1 is grounded; and, V2 is max of 5v. VP should be set to 3.3 volts to prevent the possibility of going over 3.3 volts. U?A could be a LM358 for example as it is a great single supply op-amp. However, since I am using ATTiny then analog input can go to 5v.

The Pressure Transceiver

Now, the oil pressure transceiver is this one 100 psi capable one. The nice thing about this one is that it is quite linear across the supported pressure range. That is, Output: 0.5-4.5V linear voltage output. 0 psi outputs 0.5V, 50 psi outputs 2.5V, 100 psi outputs 4.5V. So a simple voltage scale work well to calculate output of ADC on ATTiny Arduino has a MAP function but it only works on int so here is the one for float types.

long map(long x, long in_min, long in_max, long out_min, long out_max) 
{   
	return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 
} 

LCD Display

Finally, the last piece of this puzzle is the LCD display. I have chosen this display from Amazon. With that I will be able to compile in a nice readable display that is fully eliminated. I have also chosen to code this all in PlatformIO via Visual Studio Code (VSC). So, I have added the PlatformIO extension to VSC. Then, I added the following libraries

  • Tiny4kOLED – For the display
  • sstaub/Ticker – for non-blocking thread like action.

The Execution

BOM

CommentDesignatorFootprintLCSC
10uFC1,C3Capacitor_SMD:C_0603_1608Metric_Pad1.08×0.95mm_HandSolderC194427
.1uFC2Capacitor_SMD:C_0603_1608Metric_Pad1.08×0.95mm_HandSolderC2180759
1 ampD1Diode_SMD:D_SOD-123FC126484
5.1 vD2Diode_SMD:D_SOD-123C151576
I/O ConnectorJ1Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalC3348967
ISP ProgJ2Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalC3348967
LCD ConnJ3Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalC3338160
PHB21N06LT,118Q1Package_TO_SOT_SMD:TO-263-2C552623
10MR1Resistor_SMD:R_0603_1608Metric_Pad0.98×0.95mm_HandSolderC2653999
1kR2,R3Resistor_SMD:R_0603_1608Metric_Pad0.98×0.95mm_HandSolderC1870265
ATtiny85-20SU1Package_SO:SOIC-8W_5.3×5.3mm_P1.27mmC615549
LM1085-5.0U2Package_TO_SOT_SMD:TO-263-3_TabPin2C434505

I have also added this to github here.

The top of the PCB

Front of PCB
Back of PCB

Leave a Reply

Your email address will not be published. Required fields are marked *