Torque

Forums

Forums

Guest  

Show or hide header
Welcome Guest, posting in this forum require registration.




Torque » Torque OBD ECU Scanner » Torque Discussion / Ideas » How many arduino extraPID can the app handle?

Pages: [1]
Author Topic: How many arduino extraPID can the app handle?
Guafa
Member
Posts: 9
Post How many arduino extraPID can the app handle?
on: April 10, 2020 (GMT)

Hello,

I am able to send up to 5 sensors (PID´s) from my Arduino to the app. I can compile succesfully the scketch with up to 20 sensors, but my HC-05 bluetooth module, can´t stablish comunication with torque, after adding the sixth.

Clue: If i name the 5 PID´s with a very short name (three characters), i can stablish comunication. on the other hand, if i use a long name, it only allows me to send 4 PID´s.

symptom: The “bluetooth” icon turns to orange color and a message of (no OBD comunication pops up).

My string declaration below:

const String sensors[SENSORSSIZE] = {
“0”, DIGITAL, IS_INPUT, “-“, “RPM”, “Og0”, “x1”, “0”, “1”, //Pin A0 (23 físico)
“1”, DIGITAL, IS_INPUT, “-“, “MAP”, “Og1”, “Kpa”, “0”, “1”, //Pin A1 (24 físico)
“2”, DIGITAL, IS_INPUT, “-“, “ECT”, “Og2”, “C”, “0”, “1”, //Pin A2 (25 físico)
“3”, DIGITAL, IS_INPUT, “-“, “IAT”, “Og3”, “C”, “0”, “1”, //Pin A1 (24 físico)
“4”, DIGITAL, IS_INPUT, “-“, “O2”, “Og4”, “v”, “0”, “1”,
/*
“5”, DIGITAL, IS_INPUT, “-“, “RPT”, “Og5”, “”, “0”, “1”, //Pin A0 (23 físico)
“6”, DIGITAL, IS_INPUT, “-“, “DOL”, “Og6”, “”, “0”, “1”, //Pin A4 (27 físico)
“7”, DIGITAL, IS_INPUT, “-“, “DOC”, “Og7”, “”, “0”, “1”, //Pin A0 (23 físico)
“8”, DIGITAL, IS_INPUT, “-“, “PW”, “Og8”, “”, “0”, “1”, //Pin A5 (28 físico)
“9”, DIGITAL, IS_INPUT, “-“, “STP”, “Og9”, “”, “0”, “1”, //Pin 0 (2 físico)

“6”, DIGITAL, IS_OUTPUT, “0”, “K”, “K”, “bit”, “0”, “1”, //Pin 1 (3 físico)
“7”, DIGITAL, IS_OUTPUT, “0”, “L”, “L”, “bit”, “0”, “1”, //Pin 2 (4 físico)
“8”, DIGITAL, IS_OUTPUT, “0”, “M”, “M”, “bit”, “0”, “1”, //Pin 3 (5 físico)
“9”, DIGITAL, IS_OUTPUT, “0”, “N”, “N”, “bit”, “0”, “1”, //Pin 4 (6 físico)
*/ };

Mechanical engineer, electronic enthusiastic, microcontroller programing enthusiastic, cars lover, in process of create my own PCM (fuel control checked, spark control in process)

Guafa
Member
Posts: 9
Post Re: How many arduino extraPID can the app handle?
on: April 10, 2020 (GMT)

By the way, all PID’s were imported from other microcontroller through I2C, so there shouldn’t be any compatibility issue with pin assignement (pins are not being use).

Mechanical engineer, electronic enthusiastic, microcontroller programing enthusiastic, cars lover, in process of create my own PCM (fuel control checked, spark control in process)

moreause
Member
Posts: 637
Post Re: How many arduino extraPID can the app handle?
on: April 11, 2020 (GMT)

i don’t know the specific about this project

but i did a little obdii sniffer project in the past

in my case a was blowing up the memory of the arduino i suspect

so you have to be carefull in your variable declaration and number use to use the minimum possible

Guafa
Member
Posts: 9
Post Re: How many arduino extraPID can the app handle?
on: April 11, 2020 (GMT)

Thanks for your prompt response.

Program memory (flash) is about 36% and sram about (43%). I have gotten in other scketches the message “insuficient memory space” when it reaches something beyond 73% of sram memory (not this case).

I am going to traslate my comentaries to english and then i’m going to post the scketch.

Meanwhile, i’m going to play around your idea of insuficient memory.

Mechanical engineer, electronic enthusiastic, microcontroller programing enthusiastic, cars lover, in process of create my own PCM (fuel control checked, spark control in process)

moreause
Member
Posts: 637
Post Re: How many arduino extraPID can the app handle?
on: April 12, 2020 (GMT)

don’t know if you find the issue

one way you can downsize the variable

instead of declaring all the sensor in one shot …

if possible declare each sensor one after the other in a for loop or something to reduce the amount of data into memory

was aloo wondering if there is a caracter limit in string probably wayyyyy long lol

stroker88
Member
Posts: 2
Post Re: How many arduino extraPID can the app handle?
on: April 14, 2020 (GMT)

Please try this:

“5”, DIGITAL, IS_INPUT, “-“, “RPT”, “Og5”, “-“, “0”, “1”, // Pin A0 (23 físico)
“6”, DIGITAL, IS_INPUT, “-” , “DOL”, “Og6”, “-“, “0”, “1”, // Pin A4 (27 físico)
“7”, DIGITAL, IS_INPUT, “-“, “DOC”, “Og7”, “-” , “0”, “1”, // Pin A0 (23 físico)
“8”, DIGITAL, IS_INPUT, “-“, “PW”, “Og8”, “-“, “0”, “1”, // Pin A5 (28 físico)
“9”, DIGITAL, IS_INPUT, “-“, “STP”, “Og9”, “-“, “0”, “1”, // Pin 0 (2 físico)

Guafa
Member
Posts: 9
Post Re: How many arduino extraPID can the app handle?
on: April 15, 2020 (GMT)

Hi guys, I`m sorry for delay in response.

I tried what you suggested with no sucess.

I am attaching the scketch in order to please you help me by trying at your side.

The main differences with Ian scketch are:
*I am using hardware serial, instead of software serial (I also tried with software serial with no sucess).
*I am not reading directly the pin. I am taking an average value and then sending it to torque (see “get sensors”, id ==3)
*I am receiving all values (except id = 3) from other micro through I2C.

The scketch was proved before paste it in here. If i just change sensorsize from 9*5 to 9*6 and include the sixth sensor in string declaration, it compiles but wont work.

Thanks in advance.

Edit: Is not allowing me to post it complete.
My email: guafa678@gmail.com

Mechanical engineer, electronic enthusiastic, microcontroller programing enthusiastic, cars lover, in process of create my own PCM (fuel control checked, spark control in process)

Guafa
Member
Posts: 9
Post Re: How many arduino extraPID can the app handle?
on: April 16, 2020 (GMT)

Hi guys,

I have proved that like moreause said, it´s a memory space issue. The more code i put into the scketch, the less quantity of sensor i can handle.

I am using a ATmega 328p (2kbytes). it starts to blows up memory above 66% (more than 3 sensor in my today updated scketch).

It is time to start a new thread related to my findings. Now i am trying to take the complete string declaration to flash program (instead of RAM program like in original Ian program).

Cheers.

Mechanical engineer, electronic enthusiastic, microcontroller programing enthusiastic, cars lover, in process of create my own PCM (fuel control checked, spark control in process)

moreause
Member
Posts: 637
Post Re: How many arduino extraPID can the app handle?
on: April 17, 2020 (GMT)

don’t know if it will help

String doesn’t seem to work well with arduino

Char seem’s to be the safer option for some reason

const string should use less ram but, that way out of my programming skills

passed a couple of hours reading into this … and it can get very complexe rapidly

Guafa
Member
Posts: 9
Post Re: How many arduino extraPID can the app handle?
on: April 18, 2020 (GMT)

You are right moreause. It is kind of complexe for me also.

What i am trying to do next, is using “PROGMEM”. I have done it before in other projects, taking lots of data (bytes, integers, charts). That way, i have reduce SRAM space use up to 40%.

The challenge for me from now on, is take all this big “strings” to flash memory (it seems PROGMEM does not have any effect in Strings). It works with “chars” (in fact, with chars i got a reduction from 64% to 39%) but Ian scketch is based on strings (some of the fuctions don´t recognize chars).

My goal is not to change this atmega328p. If i make it, i´ll let you know.

Best regards.

Mechanical engineer, electronic enthusiastic, microcontroller programing enthusiastic, cars lover, in process of create my own PCM (fuel control checked, spark control in process)

moreause
Member
Posts: 637
Post Re: How many arduino extraPID can the app handle?
on: April 18, 2020 (GMT)

just for fun on what are you using this project on ???

personnaly i did a small project on a car … i just inserted some sensor into the can bus itself

i used the arduino to answer instead of the car for the boost sensor output that was higher than the 255 kpa max in the standard

but finaly found the correct pid so the arduino was removed

Guafa
Member
Posts: 9
Post Re: How many arduino extraPID can the app handle?
on: April 18, 2020 (GMT)

My project has some stages:

1. I converted a vintage carburettor car into a mpfi one. The circuit has until now two micro controllers (one in charge of fuel delivery and the second in charge of comunication). So many challenges into this stage. The car now is running like charm and starting at the very first time you turn the key on.

2. Comunication itself is my second challenge. To set up fuel delivery, i had to watch 25 engine variables at a time. So that I am using “bluetooth terminal” app (which allows me to see all of them, but is not a “friendly” visualization way). So i decide to deal with torque app.

Due to i have 25 variable to watch, my suggestion for torque app was relate to the combination of some variables in just one indicator eg. TargetRPM vs actualRPM, Map vs RPM vs AFR, Map vs RPM vs VE.

3. My near future challenge, is going to be spark timming with a third microcontroller (or integration of three in a single one).

Regards.

Mechanical engineer, electronic enthusiastic, microcontroller programing enthusiastic, cars lover, in process of create my own PCM (fuel control checked, spark control in process)

Guafa
Member
Posts: 9
Post Re: How many arduino extraPID can the app handle?
on: April 20, 2020 (GMT)

Hi guys, we´ve made it!!!

I could send more than 15 PID`s in my cheap atmega328p and using only something about 3% of SRAM memory (instaed of 50%).

I had to change significantly the scketch. Basically i eliminated PID´s string declarations and Inserted them “manually” in “sensor definition” function.

Thank you all guys for your time and support.

P.S. email me if i can help someone about this topic (Arduino/atmega328p).
email: guafa678@gmail.com

Mechanical engineer, electronic enthusiastic, microcontroller programing enthusiastic, cars lover, in process of create my own PCM (fuel control checked, spark control in process)

Pajo
Member
Posts: 37
Post Re: How many arduino extraPID can the app handle?
on: April 23, 2020 (GMT)

Hi,
can you please send me your updated sketch?

I will try to make it work with 16×02 IIC display and show live data onto it.

My email is: hromada.miroslav@gmail.com

Thank you.

Pages: [1]
WP-Forum by: Fredrik Fahlstad, Version: 2.4
Page loaded in: 0.045 seconds.

  Follow me on twitter