|
Software Tuning Discuss all software tuning topics. |
|
Thread Tools | Search this Thread |
07-07-2020, 09:10 PM | #1 |
Member
Join Date: Jun 2012
Drives: MT GB BRZ Limited
Location: Seattle, WA
Posts: 76
Thanks: 0
Thanked 28 Times in 17 Posts
Mentioned: 1 Post(s)
Tagged: 0 Thread(s)
|
Feasibility of figuring out current gear, clutch pos over CAN/OBD2?
(EDIT: RESOLVED)
Hi there! First off, a disclaimer - this is not exactly about tuning, but there's enough overlap that I think this is the best forum to ask about it in. Okay - so as a little hobbyist project, I want to build a cheap, stupid device that will show me "if you downshift from CURRENT_GEAR to CURRENT_GEAR-1, what should your target RPM be?" Basically, a little helper for rev-matching. Current plan is: - ELM327 OBD2 reader communicating over BT to... - an ESP32 (or some such hobbyist chip) displaying on a cheap display The logic would be pretty simple on the ESP32. A quick and dirty pseudocode representation: Code:
def main(): while True: if(was previously in gear, and we just clutched out): desired_downshift_rpm = calculate_downshift_rpm(last_observed_gear, last_observed_rpm) update_display(desired_downshift_rpm) # probably some timeout last_observed_gear = OBD2.read_gear() last_observed_rpm = OBD2.read_rpm() def calculate_downshift_rpm( last_observed_gear: int, last_observed_rpm: int, gear_ratios: Dict[int, float], ): last_ratio = gear_ratios[last_observed_gear] next_ratio = gear_ratios[last_observed_gear - 1 /* excluding first gear */] return last_observed_rpm / last_ratio * next_ratio def test(): # Going from 1000rpm @ 2nd -> 1600 rpm @ 1st assert calculate_downshift_rpm( last_observed_gear=2, last_observed_rpm=1000, gear_ratios=hardcoded_gear_ratios ) roughly_equals 1657 hardcoded_gear_ratios = { 1: 3.626, 2: 2.188, # etc etc 5: 1.000, 6: 0.767, } I've messed around with OBD2 readers on my phone, and it can definitely read RPM (and the latency is surprisingly not bad), but I haven't seen if there are PIDs for: - what's my current gear? (manual transmission if it counts) - what's the clutch pedal position?
__________________
すばらしい。いや、スバルしい。
Last edited by Stu L Tissimus; 07-08-2020 at 11:56 AM. |
The Following User Says Thank You to Stu L Tissimus For This Useful Post: | RedReplicant (01-25-2024) |
07-08-2020, 12:13 AM | #2 |
Senior Member
Join Date: Apr 2019
Drives: 86 GT
Location: Malaysia
Posts: 358
Thanks: 218
Thanked 205 Times in 105 Posts
Mentioned: 2 Post(s)
Tagged: 0 Thread(s)
|
Techstream has a number of information that is shown, however I'm not sure whether those are communicated via OBD2 PIDs or via some other means. I've did some tinkering in the past by sniffing the communication between the ECU and Techstream to identify the PID and replaying the transmits and responses in hex values to understand how they are derived.
I'm sure it's possible on our cars (it was a long time ago, I've lost all the software) but if those values you're looking for are available in Techstream, chances that you would be able to pull it from your OBD2 reader. |
07-08-2020, 02:04 AM | #3 |
Senior Member
Join Date: Mar 2015
Drives: 2014 GT86
Location: Latvia, Riga
Posts: 4,333
Thanks: 696
Thanked 2,085 Times in 1,436 Posts
Mentioned: 53 Post(s)
Tagged: 1 Thread(s)
|
As there is no sensor (except maybe reverse, as rear camera & backup lights switch on immediately when putting in reverse gear) for gear position and even for car dash gear indication itself position gets calculated only after gear switch and letting out clutch pedal (and it gets calculated wrong for guys with different FD, if they don't also adjust calculation ratios in ecu tune), with lag, from engine rpm readings & wheel speed sensors, and even for clutch IIRC there was just sensor if clutch pedal is on or off (for keyless start sake i guess), i don't think you'll be able to get needed readings from twins stock sensors.
Maybe some custom aftermarket sensors can be added to clutch and gearbox, but have no info on those. |
07-08-2020, 08:18 AM | #4 |
Banned
Join Date: Dec 2013
Drives: FT86
Location: Australia
Posts: 7,998
Thanks: 1,035
Thanked 4,987 Times in 2,981 Posts
Mentioned: 598 Post(s)
Tagged: 2 Thread(s)
|
As above the ECU calcualtes the gear from rpm and speed data. There is no gear sensor.
Note you can get auto blip rev matching on these cars with ecutek tunes, ie it blips throttle for you on downshift, and full throttle upshift, all in software |
The Following User Says Thank You to steve99 For This Useful Post: | DarkPira7e (07-08-2020) |
07-08-2020, 10:04 AM | #5 | |
TRACKBREAD
Join Date: Mar 2016
Drives: 2013 BRZ
Location: Florida
Posts: 3,929
Thanks: 2,660
Thanked 4,024 Times in 1,895 Posts
Mentioned: 30 Post(s)
Tagged: 0 Thread(s)
|
You have speed, RPM, and clutch position in OBD. That should be all you need to figure out the current gear.
Oh and this : Quote:
Last edited by Yoshoobaroo; 07-08-2020 at 10:16 AM. |
|
07-08-2020, 11:56 AM | #6 |
Member
Join Date: Jun 2012
Drives: MT GB BRZ Limited
Location: Seattle, WA
Posts: 76
Thanks: 0
Thanked 28 Times in 17 Posts
Mentioned: 1 Post(s)
Tagged: 0 Thread(s)
|
Thanks guys!
I recognize the Ecutek can auto-blip for me, but I'm doing this more for the fun of building it
__________________
すばらしい。いや、スバルしい。
|
The Following User Says Thank You to Stu L Tissimus For This Useful Post: | steve99 (07-08-2020) |
07-08-2020, 01:01 PM | #7 |
TRACKBREAD
Join Date: Mar 2016
Drives: 2013 BRZ
Location: Florida
Posts: 3,929
Thanks: 2,660
Thanked 4,024 Times in 1,895 Posts
Mentioned: 30 Post(s)
Tagged: 0 Thread(s)
|
|
07-08-2020, 06:50 PM | #8 |
Member
Join Date: May 2015
Drives: BRZ
Location: Vancouver, BC
Posts: 33
Thanks: 5
Thanked 13 Times in 10 Posts
Mentioned: 1 Post(s)
Tagged: 0 Thread(s)
|
You won't be able to request the calculated gear over OBD2, but you can access it under the regular CAN bus:
ID: 0x140 Offset: 6 bytes Length: 4 bits Mask: 0x0F (i.e. you only care about the 4 least significant bits on that byte) These 4 bits match the gear display, and reads 7 (0b0111) when nothing is displayed, between shifts, neutral, etc.. Obviously you could compare vehicle speed vs. engine speed, which would be faster I think. You can also get those off the CAN bus, which is quicker and less intrusive than over OBD2. Vehicle speed: ID: 0x0D1 Offset: 0 bytes Length: 2 bytes (little endian) Multiplier: 0.05747 for kph, 0.3571019137 for mph Engine speed: ID: 0x140 Offset: 2 bytes Length: 2 bytes (little endian) Mask: 0x3FFF EDIT: You can see how well comparing vehicle speed vs. engine speed works here: https://streamable.com/sqk9h8 It's much faster than using the gear data on the CAN bus because you don't necessarily have to wait for clutch out like the ECU does in the car. Last edited by 7c8; 07-09-2020 at 11:36 AM. |
07-17-2020, 08:11 PM | #9 |
Member
Join Date: Jun 2012
Drives: MT GB BRZ Limited
Location: Seattle, WA
Posts: 76
Thanks: 0
Thanked 28 Times in 17 Posts
Mentioned: 1 Post(s)
Tagged: 0 Thread(s)
|
(I finished a super hacky quick-and-dirty version here!)
__________________
すばらしい。いや、スバルしい。
|
The Following 2 Users Say Thank You to Stu L Tissimus For This Useful Post: | Compelica (07-18-2020), Yoshoobaroo (07-17-2020) |
07-22-2020, 12:15 PM | #11 |
Senior Member
Join Date: Jun 2020
Drives: 2017 Toyota 86
Location: Fort Worth, TX
Posts: 261
Thanks: 200
Thanked 184 Times in 110 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
|
Somewhat related, I've noticed the gear indicator on the gauge cluster sometimes isn't there and occasionally is even wrong - it may say 4 when I'm in 5th. Is this normal? Its not like I actually need this, but I found it odd.
|
07-23-2020, 09:18 AM | #12 |
Senior Member
Join Date: Jul 2019
Drives: 2018 Subaru BRZ Limited with PP
Location: Phildalphia, Pennsylvania
Posts: 975
Thanks: 2,123
Thanked 609 Times in 391 Posts
Mentioned: 4 Post(s)
Tagged: 0 Thread(s)
|
If you've changed wheel diameter from stock or changed the FD then this would be your issue.
|
07-23-2020, 09:22 AM | #13 |
Senior Member
Join Date: Jun 2020
Drives: 2017 Toyota 86
Location: Fort Worth, TX
Posts: 261
Thanks: 200
Thanked 184 Times in 110 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
|
|
07-23-2020, 09:28 AM | #14 |
Senior Member
Join Date: Jul 2019
Drives: 2018 Subaru BRZ Limited with PP
Location: Phildalphia, Pennsylvania
Posts: 975
Thanks: 2,123
Thanked 609 Times in 391 Posts
Mentioned: 4 Post(s)
Tagged: 0 Thread(s)
|
|
|
|
Thread Tools | Search this Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cruise control and current gear suddenly not working, but suddenly worked again | btan219 | Issues | Warranty | Recalls / TSB | 2 | 06-30-2018 01:09 AM |
Car will not go into gear after new clutch install?! | Amartinez99 | Engine, Exhaust, Transmission | 15 | 01-15-2018 01:25 PM |
is it ok to slip my clutch often in 2nd gear when my rpm is below 2k? | awhatzable | Scion FR-S / Toyota 86 GT86 General Forum | 88 | 06-17-2015 06:12 PM |
clutch/gear box getting softer | zERoTu | Issues | Warranty | Recalls / TSB | 3 | 06-05-2014 08:18 AM |
Display current gear without clutch engaged? | cfusionpm | Scion FR-S / Toyota 86 GT86 General Forum | 45 | 03-26-2013 04:08 PM |