Arduino - PI Carputer

the place to discus in car computers
The forum Administrator has chosen to advise you that this topic is 1 year and 8 months old and that you may wish to begin a new topic or use the search feature to find a similar but newer topic.
User avatar

Topic author
pinch
Posts: 13
Joined: 13/06/08 21:38
Years of MR2 Ownership: 10
MR2's Owned: 5
Location: Sladegreen

Arduino - PI Carputer

Post by pinch »

Hi Guys! With the current state of the world at the moment I have a lot more spare time on my hands. So I have been thinking of dabbling in a new Carputer project for MR2 Turbo Rev3.

I am not going to lie I don't now a lot about chipboard electronics, but i am not scared to learn and i pick things up very quickly. I know a little bit of programming and also have a basic understanding of car electronics/wiring and have wired many alarms and sound systems in my MR2's.

My basic plan for my project is to be feed any sensor readings (Speedo, Rev Counter, Boost, etc...)to a customisable HUD screen. Working slowly through one readout at a time with maybe an end goal of having a DIY OBDII style connector at the end of the project for all my readings.

I am sure this has been tried before but based on some brief research i have been doing it doesn't seem anyone has tried with Arduinos/Pi's before in MR2's.

So number 1 on my list to get working is a Digital Speedo displaying on a TFT screen. My plan for this is to use a higher power CPU Arduino to power a High refresh rate TFT to give me a Decent digital speedo.

Where i get a little confused is to where i take the reading from the current speedo wiring system to feed into my Arduino. My understanding is that there is 3 cables that come from my gearbox (1 Live, 1 Ground, 1 Pulsing Signal) But i am not sure if i tap into the cable between the gearbox and Speedometer to feed the Arduino or is there a better feed to tap into after it goes into the cars speedo. As from my understanding the cars speedo calibrates the signal for other systems (Power steering, Cruise control, ECU etc)?

I also understand that the speedo signal cable produces pulses per minute which the Arduino will be able to turn into real data which i will figure out when i find the best feed to tap into. I will also aim to have a data output from the Arduino which will provide the converted signal into data for a Raspberry PI to use later in the project.


User avatar

benckj
Posts: 305
Joined: 05/04/06 1:00
Gender: Male
Years of MR2 Ownership: 5
Location: Alexandra, New Zealand
Been thanked: 3 times

Re: Arduino - PI Carputer

Post by benckj »

Somebody did a similar project like this to create a digital dash. Might pay to troll through the US forums to see what was done and problems encountered.

I’ve used my EMS to run data gauge display onto a 7” Droid touch screen. Nice to have a modern feel to cabin along with capability to adjust or add gauges on demand.

Jim
User avatar

Topic author
pinch
Posts: 13
Joined: 13/06/08 21:38
Years of MR2 Ownership: 10
MR2's Owned: 5
Location: Sladegreen

Re: Arduino - PI Carputer

Post by pinch »

Hi guys just an update on what i have done so far.

I have received all of my Arduino kit now and I have been tinkering over the last couple of days to get my head around the coding. During my trawling on the web i came across this little gem.

Image

I know i originally said i wanted to look into a TFT screen to run the speedo. But when looking around online it seemed that it may not refresh quick enough to be usable in a real world environment. But the segment display can refresh really quick.

I also really liked the outer LEDS which i thought could be utilised for my Tacho later on. But I did not like the colours already on there so i started replacing them today with clear blue ones. There is 16 LED's in total on the tacho so i decided i would divide them all up into 500 & 1000 segments with 2 Red LEDs at the end representing 1000 each. I don't currently have clear versions of the red LED's at the moment but when I get hold of some i will provide updated pictures. I also removed the speaker that was attached to this as i wont be using it on this board.

Image

When i got everything connected to my Aruino I managed to create a sample of what it could look like.
[media]https://photos.app.goo.gl/c5jddLZJE51p9taw5[/media]

I also managed to adapt this to update the display every 5 seconds with a count of button presses. Which i can then hopefully adjust the maths to show me my MPH/RPM when i finally work out how i will handle the input signals from the car.

[media]https://photos.app.goo.gl/WWxd9Gqde8mcQsJi8[/media]

stanneh
Posts: 28
Joined: 01/04/20 16:21
Has thanked: 1 time

Re: Arduino - PI Carputer

Post by stanneh »

Hey sorry I was only tonight pointed in the direction of this part of the forum.

Try this first it's a nice simple way to get data from your car for your first attempt.

The following code will return your RPM's, in this example using pin 15 (Adjust the pin to to a suitable pin of your choice) of your arduino/esp32/8266...

from that pin connect it to the IGN output of your DIAG port in the engine bay.

pay attention to the "void printData(int v)" method, once a reading has happened this is the last action in code where we interpret what the rpm is in an easy to read format and this is where you need to add code to out put it to that cool little board you have.

Have fun with this this by the time you have that working I'll have documented how to get all the rest of the information in another thread.

Just realised you have a rev 3 you should have an OBD port, this is a well documented standard and all of the information you need to obtain that is out there.

If you do not have the diagnostic port in the engine bay the IGN is basically your igniter signal wire.



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

//RPM--------------------------------------------------------------
const int rPMPin = 15; arduino pin to hook up to IGN.
const int sensorInterrupt = 0;
volatile unsigned long lPt; //Last pulse time
volatile unsigned long interval = 0; // pulse interval

int rpm;
int rpmlast = 3000;

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


void setup(void) {
//Start serial.
Serial.begin(115200);
Serial.println("Stytem Started");
Serial.print('\n');

//Set RPM Signal Settings
pinMode(rPMPin, INPUT);
attachInterrupt(digitalPinToInterrupt(rPMPin), &sensorPulsing, RISING);
lPt = 0;
}

void loop() {

//RPM--------------------------------------------------------------
if(rpm >= 0) { //ignore minus Values

//set rpm min max
rpm = constrain (rpm, 0, 9000);

//if rpm = 0 I.E the ignition is on but the engine is not running return 0 as RPM Value
if ((micros() - lPt) < 5e6 ) {
rpm = rpm;
}
else {
rpm = 0;
}
// is there any point accounting for 250? I mean seriously?
if (rpm < 250)
rpm = 0;
}
//-----------------------------------------------------------------

printData(rpm);
}

//on every detected pulse from IGN sensorPulsing() routine is run
ICACHE_RAM_ATTR
void sensorPulsing() {
unsigned long now = micros();
interval = now - lPt;
if (interval > 5000){
rpm = 61000000UL/(interval * 2);
lPt = now;
}
}

//interperate the rpms to meaningful values and display them however you want to.
void printData(int v) {
int state;
state = digitalRead(rPMPin);

Serial.print('\n');
Serial.write("Pin State = ");
Serial.print(state);
Serial.print('\n');
int ones;
int tens;
int hundreds;
int thousands;
Serial.print('\n');

// display RPM
Serial.write("RPM: ");
ones = v%10;
v = v/10;
tens = v%10;
v = v/10;
hundreds = v%10;
v = v/10;
thousands = v%10;

int rpms = ((byte)thousands * 1000 + (byte)hundreds * 100 + (byte)tens * 10 + (byte)ones);

//Now print the number digit by digit
//mydisplay.setDigit(0,4,(byte)thousands,false);
Serial.print((byte)thousands);
//mydisplay.setDigit(0,5,(byte)hundreds,false);
Serial.print((byte)hundreds);
//mydisplay.setDigit(0,6,(byte)tens,false);
Serial.print((byte)tens);
//mydisplay.setDigit(0,7,(byte)ones,false);
Serial.print((byte)ones);
Serial.print('\n');

// Ignore this I am working on a digital recreation of the OEM MR2 Turbo guage cluster on a Nextion HMI Display
//if(rpms > 1000){
//devide the rpms x 43.5 and send to Nextion mr2dash.rev.val=(rpms / 43.5)
//}
//else{
//Devide the rpms x 50 and send to Nextion mr2dash.rev.val=(rpms / 50)
//}


}
User avatar

gavsdavs
Full Member
Full Member
Posts: 977
Joined: 10/08/10 12:30
Gender: Male
Years of MR2 Ownership: 0
MR2's Owned: 1
Location: London
Has thanked: 7 times
Been thanked: 8 times

Re: Arduino - PI Carputer

Post by gavsdavs »

I do a load of dataloggiing of my car with a carpc and linux and obdgpslogger.

It's all headless, there's no guages or buttons to press, it just records obd and gps when the car is running. And I do find it really useful for keeping a track on the health of the car.

I like what you've done so far, keep posting as you work new things out..

stanneh
Posts: 28
Joined: 01/04/20 16:21
Has thanked: 1 time

Re: Arduino - PI Carputer

Post by stanneh »

gavsdavs wrote: 26/11/21 12:51 I do a load of dataloggiing of my car with a carpc and linux and obdgpslogger.

It's all headless, there's no guages or buttons to press, it just records obd and gps when the car is running. And I do find it really useful for keeping a track on the health of the car.

I like what you've done so far, keep posting as you work new things out..
If it's the obd1 data logging you need then the following project has that in the bag.

https://github.com/hyperion11/toyota-obd-1

Now be warned its Russian but if needed I can refine that code and re comment it all in English.

It was a much older version of the above code that I ended up refining for myself.

I believe this dude was using it on a Camry.
User avatar

gavsdavs
Full Member
Full Member
Posts: 977
Joined: 10/08/10 12:30
Gender: Male
Years of MR2 Ownership: 0
MR2's Owned: 1
Location: London
Has thanked: 7 times
Been thanked: 8 times

Re: Arduino - PI Carputer

Post by gavsdavs »

Nope. i can use obd2 in my car.

This is quite an interesting project
https://github.com/Ircama/ELM327-emulator

but my python skills are terrible so I tend to use obdgpslogger as I can make it work

Quick Reply

   
The forum Administrator has chosen to advise you that this topic is 1 year and 8 months old and that you may wish to begin a new topic or use the search feature to find a similar but newer topic.

Return to “Carputers”