Torque

Forums

Forums

Multiple serial str...
 
Notifications
Clear all

Multiple serial streams?

12 Posts
4 Users
0 Reactions
685 Views
(@toalan)
Posts: 9
Active Member
Topic starter
 

Hi,

I would like to use arduino to supply torque with some data, while at the same time my ECU sends it's data to torque, so that both sets of data are logged and displayed at the same time.

So would it be possible to use 2 serial streams at the same time?

Regards,

Alan To

 
Posted : 08/06/2017 12:02 am
(@moreause)
Posts: 650
Honorable Member
 

i don't know if there is another way

what i did is put the arduino on the bus

in a custom pid a program a standard PID that normally the ecu doesn't answer

arduino is monitoring that request and then respond in it's place like the ecu would normally do it

torque doesn't see any difference

 
Posted : 12/06/2017 3:11 am
(@moreause)
Posts: 650
Honorable Member
 

i don't know if there is another way

what i did is put the arduino on the bus

in a custom pid a program a standard PID that normally the ecu doesn't answer

arduino is monitoring that request and then respond in it's place like the ecu would normally do it

torque doesn't see any difference

here is an exemple of my code
/*********************************************************************
* Mechanic - Hacking your car
*
* Copyright (C) 2013 Joerg Pleumann
*
* This example is free software; you can redistribute it and/or
* modify it under the terms of the Creative Commons Zero License,
* version 1.0, as published by the Creative Commons Organisation.
* This effectively puts the file into the public domain.
*
* This example is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* LICENSE file for more details.
*/

#include

ObdInterface obd;
ObdMessage out;
ObdMessage in;

int SensorValue = 0;
float PsiValue = 0;
float Temp;
int ValuePID90xA;
int ValuePID90xB;
int ValuePID08xA;

void setup() {
Serial.begin(115200);
//while (!Serial);

Serial.println();
Serial.println();
Serial.println(" ADDR LN MO PI D0 D1 D2 D3 D4");
Serial.println("-------- -- -- -- -- -- -- -- --");

obd.setSlow(false);
obd.setExtended(false);
obd.setDebug(false);
obd.setNoFilter(false); // Show all messages, not just ECU answers
obd.begin();
out.address = 0x7e8;
out.mode = 0x41;

}

void loop() {
if (obd.receiveMessage(in)) {
Serial.println(in);

if (in.pid == 0x90) { // Si pid est 90 envoie la valeur courante
Serial.println("sending");

Serial.print(" PID 0x90,Sensor ");Serial.print(SensorValue);
Serial.print(" Psi: "); Serial.print(PsiValue);
Serial.print(" A: "); Serial.print(ValuePID90xA);
Serial.print(" B: "); Serial.println(ValuePID90xB);

out.address = 0x7e8;
out.length = 0x4;
out.pid = 0x90;
out.values[0] = ValuePID90xA;
out.values[1] = ValuePID90xB;
obd.sendMessage(out);

}

if (in.pid == 0x08) { // Si pid est 08 envoie la valeur courante
Serial.println("sending");

Serial.print(" PID 0x08,Sensor ");Serial.print(SensorValue);
Serial.print(" A: "); Serial.println(ValuePID08xA);

out.address = 0x7e8;
out.length = 0x4;
out.pid = 0x08;
out.values[0] = ValuePID08xA;
out.values[1] = 0;
obd.sendMessage(out);

}

}
// Valeur pour PID 0x90
SensorValue = analogRead(A0) + 1;
PsiValue = (45.6125*SensorValue/1024) + 0.148721; // 5 Volts ou 1024 = 45.6125 Psi, 0.148721 il y a un leger offset dans les valeurs
ValuePID90xA = (int) PsiValue;
Temp = (PsiValue - ValuePID90xA) * 100;
ValuePID90xB = (int) Temp;
/*
Serial.print(" PID 0x90,Sensor ");Serial.print(SensorValue);
Serial.print(" Psi: "); Serial.print(PsiValue);
Serial.print(" A: "); Serial.print(ValuePID90xA);
Serial.print(" B: "); Serial.println(ValuePID90xB);
*/
// Valeur pour PID 0x08
ValuePID08xA = map(SensorValue,0,1024,0,256); // 5 Volts ou 1024 = 45.6125 Psi et modifier en 0 a 255 et envoye comme pid de short trim bank 2
/*
Serial.print(" PID 0x08,Sensor ");Serial.print(SensorValue);
Serial.print(" A: "); Serial.println(ValuePID08xA);
*/
delay(20);
}

 
Posted : 12/06/2017 3:15 am
(@toalan)
Posts: 9
Active Member
Topic starter
 

bump

 
Posted : 19/06/2017 9:17 pm
(@moreause)
Posts: 650
Honorable Member
 

test for some reason i can't my answer

 
Posted : 21/06/2017 1:57 am
(@toalan)
Posts: 9
Active Member
Topic starter
 

It says there are several responses to this thread, but when I click on the thread I only see just my posts. Are there actual responses? If so can someone PM me the responses?

 
Posted : 21/06/2017 3:27 pm
(@lukanz)
Posts: 3
New Member
 

Hi

I would also be interested in this feature.

I would like to get oil and water temperatures from the OBDII port and the Oil pressure I would like to add through a custom PCB.

Can Torque support two Bluetooth adapters at the same time?

 
Posted : 28/06/2017 8:06 pm
(@lukanz)
Posts: 3
New Member
 

Bump. Anyone?

 
Posted : 11/07/2017 8:53 pm
(@capp777)
Posts: 2999
Famed Member
 

Have you looked at PLX iMFD devices? I
believe Ian has added support similar to
what you describe for these devices.

Search this forum for related threads.

https://torque-bhp.com/forums/?wpforumaction=viewtopic&t=5015.0

 
Posted : 12/07/2017 12:09 am
(@lukanz)
Posts: 3
New Member
 

Thanks.

I have done a quick search before posting, but it seems that most of those products are now discontinued?

https://www.plxdevices.co.uk/product/Automotive/Kiwi/PLX-0089/kiwi_imfd/PLX-Kiwi-2-iMFD-Adapter

It's really annoying because all I really want to add is oil pressure and nothing else.

 
Posted : 13/07/2017 4:35 am
(@toalan)
Posts: 9
Active Member
Topic starter
 

Still searching for the answer.

 
Posted : 12/02/2019 7:07 am
(@moreause)
Posts: 650
Honorable Member
 

you just have to send the data into the can bus with the arduino

and then read it with torque

i have done it a while ago

 
Posted : 14/02/2019 6:58 am
Share:

  Follow me on twitter