Car dashboard SSD1306 automotive gauges read & display speed sensor

hello_world
after my cars dashboard has crashed I would like to use my nano and my 128x64 SSD1306 display to display the missing values.
I am not experienced in this and can't get to where I need to be so I was hoping that someone here could give a helping hand?

  1. read tach signal and display rpm
  2. read the digital impuls of my transmission to calculate speed in km/h and accumulative distance in km.
  3. measure and display voltage via voltage divider
  4. measure and display oil pressure via voltage divider
  5. measure and display coolant temperature via voltage divider
  6. read pin high and calculate accumulative engine running hours
  7. permanently store accumulated travelled distance and running hours

I have copied some example code and I am trying to get this to suit my project:

#include "Wire.h"
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"

int oilp = 0;
int Data = 0;
const int analog_Pin1 = A0;

//int rpm = 0;
//int Data = 1;
//const int analog_Pin2 = A1;

//#define OLED_RESET 4
//Adafruit_SSD1306 display(OLED_RESET);

Adafruit_SSD1306 display(-1);

#define DIS_WIDTH 128 // OLED display width, in pixels
#define DIS_HEIGHT 64 // OLED display height, in pixels

#define IMG_HEIGHT   128
#define IMG_WIDTH    64

static const uint8_t  PROGMEM makerguides [] PROGMEM = {
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0x82, 0x08, 0x3c, 0x3c, 0x1f, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff,
  0x87, 0x1c, 0x3c, 0x3c, 0x1f, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xf3, 0xff, 0xff,
  0x8f, 0x1e, 0x3c, 0x3c, 0x1f, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xf3, 0xff, 0xff,
  0x87, 0x1c, 0x3c, 0x1c, 0x1f, 0x1f, 0x1f, 0xfd, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff,
0x86, 0x0c, 0x3c, 0x98, 0x1c, 0x07, 0x18, 0xf0, 0x78, 0x1e, 0x6f, 0xfd, 0xdf, 0x13, 0xe3, 0xf1, 0x82, 0x0c, 0x3c, 0x98, 0x18, 0x47, 0x11, 0xe2, 0x38, 0x18, 0x8e, 0x79, 0xde, 0x43, 0x99, 0xcd, 0x82, 0x0c, 0x3c, 0x99, 0x1c, 0xe7, 0x03, 0xc7, 0x18, 0xf3, 0xce, 0x79, 0xdc, 0xf3, 0xbc, 0xcf, 0x82, 0x0c, 0x3c, 0x89, 0x1f, 0xc7, 0x03, 0xc7, 0x18, 0xf3, 0xee, 0x79, 0xdd, 0xf3, 0x3c, 0xcf, 0x82, 0x0c, 0x3c, 0xc1, 0x1c, 0x07, 0x03, 0xc0, 0x18, 0xf3, 0xee, 0x79, 0xd9, 0xf3, 0x00, 0xe3, 0x82, 0x0c, 0x3c, 0xc3, 0x18, 0xe7, 0x01, 0xc7, 0xf8, 0xf3, 0xee, 0x79, 0xd9, 0xf3, 0x3f, 0xf9, 0x82, 0x0c, 0x3c, 0xc3, 0x18, 0xe7, 0x19, 0xc7, 0xf8, 0xf3, 0xee, 0x79, 0xdd, 0xf3, 0x3f, 0xfc, 0x82, 0x0c, 0x3c, 0xc3, 0x18, 0xc7, 0x18, 0xc3, 0x18, 0xf9, 0xce, 0x79, 0xdc, 0xf3, 0xbf, 0xfc, 0x82, 0x0c, 0x3c, 0xe3, 0x18, 0x03, 0x1c, 0xe0, 0x38, 0xf8, 0x0f, 0x01, 0xde, 0x03, 0x80, 0xc1, 0xc7, 0x1c, 0x3c, 0xe7, 0xbc, 0x37, 0x3e, 0xf8, 0x7d, 0xff, 0xef, 0x8d, 0xdf, 0x1b, 0xe1, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};

void setup(){
  Serial.begin(9600);
  //Initialize display by providing the display type and its I2C address.
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }
  delay(2000); // Pause for 2 seconds

  display.clearDisplay();

  Serial.println("Display Bitmap Image");
  show_Bitmap();
  Serial.println("Display Print Message");
  Print_msg();
  Serial.println("Display Print Message Scroll");
  Print_msg_scroll();
  Serial.println("Display Rectangle");
  Rect_Blank_filled();

}
void loop()
{
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("OIL P");
  Serial.print("OIL P :");
  oilp = analogRead(analog_Pin1);
  Data = map(oilp, 0, 1023, 0, 500);
  //display.setCursor(30, 16);
  display.print(Data);
  Serial.println(Data);
  delay(1000);
  display.setCursor(0, 32);
  display.println("RPM");
  Serial.print("RPM :");
  display.setTextSize(1.5);
  display.setCursor(0, 47);
  display.println("SPEED");
  Serial.print("SPEED :");
  display.setCursor(0, 55);
  display.println("KM");
  Serial.print("KM :");
  display.display();
}
// Shows fn bitmap
void show_Bitmap(void) {
  display.clearDisplay();
  display.drawBitmap(0, 0, makerguides, IMG_HEIGHT, IMG_WIDTH, WHITE);
  display.display();
  delay(1000);
}
// Shows fn print string
void Print_msg() {
  display.clearDisplay();
  display.setTextSize(2);             // The fontsize
  display.setTextColor(WHITE);    // Draw white text
  display.setCursor(5, 10);           // Start at top-left corner
  display.print("Makerguides.com");
  display.display();
  delay(3000);
}
//shows fn msg scroll
void Print_msg_scroll() {
  display.clearDisplay();
  display.setTextSize(2);             // The fontsize
  display.setTextColor(WHITE);        // Draw white text
  display.setCursor(0, 16);           // Start at top-left corner
  display.print("Starting  Turbine");
  display.display();
  delay(5000);

  display.startscrollleft(0x00, 0x0F);
  delay(2000);
  display.stopscroll();
  delay(1000);
  display.startscrollright(0x00, 0x0F);
  delay(2000);
  display.stopscroll();
  delay(1000);
  display.startscrolldiagright(0x00, 0x07);
  delay(2000);
  display.startscrolldiagleft(0x00, 0x07);
  delay(2000);
  display.stopscroll();
  delay(3000);
}

// Shows fn Rectangle display
void Rect_Blank_filled() {
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.drawRect(30, 16, 60, 36, WHITE);
  display.display();
  delay(2000);

  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.fillRect(30, 16, 60, 36, WHITE);
  display.display();
  delay(2000);
}

It’s quite an advanced project and a ā€œhelping handā€ is not enough. Start by managing smaller projects.

You need to find out and tell about the sources You intend to read and display.

Example from where, doing what?

Schematics will be most likely become interesting.

2 Likes

Maybe start by reading the pinned post re 'How to get the most from the forum'.
Remember we are not a design or coding shop, you create the project and when you have a problem we can give you some pointers.

1 Like

That sounds like an interesting project that could be a lot of fun! However it is not a beginner project. Without some background you will forever be spinning your wheels. Also what background do you have in automotive electronics? Is this vehicle going to be on the road?

Please keep in mind that we are not a free design or code-writing service. We’re more than happy to help with your design or code, but we need you to make an initial attempt. Please design and write your code, then post it along with an annotated schematic and an explanation of what’s not working properly. There is also a for hire section if you want to pay for it. What you need to do!

Show Your Work First: Before asking for assistance, make an attempt to design or write the code yourself. Share your work along with details about what isn’t working. That includes a preliminary schematic that you drew.

  1. Provide Clear Documentation: Since we can’t see your project, share an annotated schematic (best) or a clear drawing of your setup. Clear Pictures are welcome, but avoid using Fritzing diagrams as they are wiring diagrams, not schematics, and are not ideal for troubleshooting.

  2. Include Technical Details: If there is specific hardware involved, include links to technical information. There are often many versions of similar components, so precise details are essential. I will assume the processor is a UNO. Many times the processor is stated as ESP32, please state which one and post a link to it.

  3. Reference Resources: For additional help, check out useful links and tutorials: Useful Links on Arduino Forum. Of course one of the better sources of information (in my opinion) is the Arduino Cookbook. Skim it cover to cover and stop on any project that interests you.

  4. Be sure to get a copy of the Arduino Cookbook, it will be a great help in your other projects.

wow thank you. there is a lot of great people here, I didn't expect so many helpful answers.
I am not a total beginner, I have tackled some smaller projects.

my nano is up and running with the display.
Now I just need to make it display what it is reading.

I have uploaded this tach code and it is working.
I just somehow have to fugure out how to integrate this into the first code posted above:

// Easy Peasy Tachometer
//James Rovere 2020
#include <Wire.h>
#include  <Adafruit_SSD1306.h>// You may have to edit library for 128x64,
//  default is  128 x 32.

#define OLED_WIDTH 128
#define OLED_HEIGHT 64

#define  OLED_ADDR   0x3C // A very common address for these displays.

Adafruit_SSD1306  display(OLED_WIDTH, OLED_HEIGHT);


float value=0;
float rev=0;
int  rpm;
int oldtime=0;        
int time;

void isr()          //interrupt  service routine
{
rev++;
}

void setup()
{
 display.begin(SSD1306_SWITCHCAPVCC,  OLED_ADDR);
 display.clearDisplay();
   
digitalWrite(2 ,HIGH);// Instead  of using a pull up resistor
attachInterrupt(0,isr,RISING);  //attaching the interrupt

}

void  loop()
{
delay(2000);// 2 second delay
detachInterrupt(0);           //detaches  the interrupt while calculating
time=millis()-oldtime;        //finds the time  
rpm=(rev/time)*60000;         //calculates rpm
oldtime=millis();             //saves  the current time
rev=0;

  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);// Vertical, Horizontal.
  display.println("RPM:");
  display.setTextSize(5);
  display.setTextColor(WHITE);
  display.setCursor(0,25);
  display.println(rpm); 
  display.display();
  

  attachInterrupt(0,isr,RISING);


}

To use this code in real car tachometer it needs to be rewritten completely.

And I think that 0.96" display is too small for all that info you going to present on dashboard. It would be better to looking up a spare dashboard on automotive trash site.

I think you are kidding yourself. If you put all that information on a SSD1306, and try to read it while driving, you will be well on your way to crashing the rest of the car. The digital speedo alone on my Fairlane was bigger than 1306 and, by virtue of its specific job, rather indicative of the physical size you need.

This would be quite a job, definitely not for a beginner, and I submit your time, intellect, and resources would be far better employed fixing the dashboard you have.

If your entire dashboard "crashed" as you imply, you might start by checking the fusebox....

2 Likes

Seriously, this looks like oddball code. A delay of 2000 is an eternity, and mixing it with a millis window can't possibly be a good idea.

1 Like

Hi @dom2tec
Welcome to the forum.

Is this project for a road registered vehicle?
If so then you may find regulations about odometer and speed readings, in particular total road distance and storage.

Tom.... :smiley: :+1: :coffee: :australia:

As currently configured with the 0.96" display I don't have any problems reading what I need to reed.
Two things I'd like to read is my oil pressure and water temperature.
I don't need to see the speed nor the accumulated distance driven.
The distance I just need to determine when to do my next oilchange.

no that car is not for a pubic road, it never leaves the garage, I am just learning and studying by this project.

I bought the displays in bulk and have 5 of them.
Yesterday I connected a second display and I can see and read everything just fine on my 0.96" displays, thanks for your concern though.

I cleaned up the code a bit but I am struggling getting both displays to work.
I copied a code and confirmed that both dispays work fine by displaying "A" and "B" on each of them.

`#include "Wire.h"
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"

int Pot_Value = 0;
int Data = 0;
const int analog_Pin = A0;

//#define OLED_RESET 4
//Adafruit_SSD1306 display(OLED_RESET);

//Adafruit_SSD1306 display(-1);

#define DIS_WIDTH 128 // OLED display width, in pixels
#define DIS_HEIGHT 64 // OLED display height, in pixels

#define IMG_HEIGHT   128
#define IMG_WIDTH    64
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
Adafruit_SSD1306 display2(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {  
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Default OLED address, usually
  display2.begin(SSD1306_SWITCHCAPVCC, 0x3D); // Second OLED address, via onboard jumper
  
  
 // display.clearDisplay();
 // display.setTextSize(1); 
 // display.setTextColor(WHITE);
 // display.setCursor(0,0);
 // display.print("Display A");
 // display.display();

   display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("OIL P");
  Serial.print("OIL P :");
  Pot_Value = analogRead(analog_Pin);
  Data = map(Pot_Value, 0, 1023, 0, 500);
  //display.setCursor(30, 16);
  display.print(Data);
  Serial.println(Data);
  delay(1000);
  display.setCursor(0, 32);
  display.println("RPM");
  Serial.print("RPM :");
  display.setTextSize(1.5);
  display.setCursor(0, 47);
  display.println("SPEED");
  Serial.print("SPEED :");
  display.setCursor(0, 55);
  display.println("KM");
  Serial.print("KM :");
  display.display();
//}
  
  


    display2.clearDisplay();
  display2.setTextSize(2);
  display2.setTextColor(WHITE);
  display2.setCursor(0, 0);
  display2.println("OIL P");
  Serial.print("OIL P :");
  Pot_Value = analogRead(analog_Pin);
  Data = map(Pot_Value, 0, 1023, 0, 500);
  //display.setCursor(30, 16);
  display2.print(Data);
  Serial.println(Data);
  delay(1000);
  display2.setCursor(0, 32);
  display2.println("RPM");
  Serial.print("RPM :");
  display2.setTextSize(1.5);
  display2.setCursor(0, 47);
  display2.println("SPEED");
  Serial.print("SPEED :");
  display2.setCursor(0, 55);
  display2.println("KM");
  Serial.print("KM :");
  display2.display();
}



void loop() {
}`

this easy peasy tachometer will give me RPM and KM/H:

// Easy Peasy Tachometer
//James Rovere 2020
#include <Wire.h>
#include  <Adafruit_SSD1306.h>// You may have to edit library for 128x64,
//  default is  128 x 32.

#define OLED_WIDTH 128
#define OLED_HEIGHT 64

#define  OLED_ADDR   0x3C // A very common address for these displays.

Adafruit_SSD1306  display(OLED_WIDTH, OLED_HEIGHT);


float value=0;
float rev=0;
int  rpm;
int oldtime=0;        
int time;

void isr()          //interrupt  service routine
{
rev++;
}

void setup()
{
 display.begin(SSD1306_SWITCHCAPVCC,  OLED_ADDR);
 display.clearDisplay();
   
digitalWrite(2 ,HIGH);// Instead  of using a pull up resistor
attachInterrupt(0,isr,RISING);  //attaching the interrupt

}

void  loop()
{
delay(2000);// 2 second delay
detachInterrupt(0);           //detaches  the interrupt while calculating
time=millis()-oldtime;        //finds the time  
rpm=(rev/time)*60000;         //calculates rpm
oldtime=millis();             //saves  the current time
rev=0;

  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);// Vertical, Horizontal.
  display.println("RPM:");
  display.setTextSize(5);
  display.setTextColor(WHITE);
  display.setCursor(0,25);
  display.println(rpm); 
  display.display();
  

  attachInterrupt(0,isr,RISING);


}

Question: What is the code so that I get my "OIL P" and "display.print(Data);" in the same line?

  display.setCursor(0, 0);
  display.println("OIL P");
  Serial.print("OIL P :");
  Pot_Value = analogRead(analog_Pin);
  Data = map(Pot_Value, 0, 1023, 0, 500);
  //display.setCursor(30, 16);
  display.print(Data);
  Serial.println(Data);
  delay(1000);

this is a very similar topic here in this link with lots of helpful information, I will have to look through this.

If it has crashed, then possibly it has Canbus comms.

What model and make is your car?
There are projects that use Canbus to display your cars vitals.

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

It's not a car anymore, I traded it in for a Twin Engine Cessna 310.

Now it's a digital impuls of an aircraft engine. on-off-on-off which I want to display on my arduino.

It is still the same arduino, the same display and the same idea.
I still want to display oil pressure via voltage divider and all the other things.

I live in North Korea and the federal aircraft aviation here has given me a green light to use an arduino.

It is still about an arduino, oil pressure, speed sensor tacho, but now I want to do it on my Cessna 310, It's not a car anymore.

It is even worse.. Your code is a mess of inconsistent lines, it cannot be used in any real word application at all.

I don't see any remarkable changes in the tachometer code. It steel blocking, so it impossible to combine it with the second code without rewriting.

What was the car, a Rolls Royce???


Do you have a pilots license?
Do you have the necessary qualifications to play around with vital aviation electronics?

Are you chucking us a Furphy?
What REALLY is your project or are you just stuffing us around?

Tom.... :smiley: :+1: :coffee: :australia:

The only thing he need from us - a full code. :slight_smile:

I’m unable to provide an answer on that topic due to legal and liability considerations. However, if you have any other questions or need help with a different matter, please feel free to ask!

you didn't ask me whether or not I had a cars driver license.

You don't need a license for a car that never leaves the garage. Is the Cessna going to stay in the hangar?

the cessna didn't make it, the engines blew up due to missing oil temperature display and missing engine-speed-tach.
you are all partially responsible :smiling_face_with_tear:

But I could save the arduino and installed it on my newly purchased, not road legal John-deere lawn-tracktor.

It has no OBD
I don't need a drivers license for it
It is not road legal
It leaves the hangar
My lawn has the color green

John Deere, color green, VIN 6235879562585654, tire pressure 1,3 bar rear, 1,0 bar front. OHC, compression ratio 10:1

the engines blew up because I couldn't read the tach-signal. I think you are directly partially responsible for withholding vital information.

I removed the cutting blades on the John Deere and cut the spark plug wire so that nobody can get hurt.

this is about an arduino and a magnetic pick-up and a 0.96" display :joy:

It's a magnetic pick up on a lawnmower now. It has full insurance :rofl:

I am starting to believe that you are just taking me for a ride?
I am giving you all the inormation that I can but you keep asking questions that I don't think are related to arduino and / or magnetic pick-ups and voltage divider temperature measurements nor olde 0.96" displays?

Or are they rellevant?

I am hoping that my guts are wrong.

I will clean up my code bit by bit.
My green John-Deere Lawn-tracktos is asking how I can get the spead read out (or temperature or whatever) and the description into the same line?
I'll do it step by step.

1 Like