Notices
Series I Do It Yourself Forum Wanna save some coin or time/money in the shop? Read up on Do-It-Yourself custom mods and repairs & post your own here.

DIY: Adding new Parameters (sensors) to OBD2 for logging.

Thread Tools
 
Search this Thread
 
Rate Thread
 
Old 06-08-2016, 03:40 PM
  #1  
Registered
Thread Starter
iTrader: (3)
 
Harlan's Avatar
 
Join Date: Mar 2011
Location: Bay City Tx
Posts: 1,041
Likes: 0
Received 3 Likes on 2 Posts
DIY: Adding new Parameters (sensors) to OBD2 for logging.

Here is a quick guide on how I use an Arduino Uno and a CAN shield to log things the car did not come with like boost pressure, oil temp, or oil pressure.


I found the orignial code here Arduino OBD2 Simulator


and I'll attach my modified code as well.


Attached Files
File Type: rar
code.rar (2.5 KB, 1514 views)

Last edited by Harlan; 06-08-2016 at 05:09 PM.
The following 2 users liked this post by Harlan:
3toedSloth (03-23-2021), motodenta (04-26-2020)
Old 06-08-2016, 09:52 PM
  #2  
Registered
Thread Starter
iTrader: (3)
 
Harlan's Avatar
 
Join Date: Mar 2011
Location: Bay City Tx
Posts: 1,041
Likes: 0
Received 3 Likes on 2 Posts
Now don't you all chime in at once. I thought people would be more excited about the possibility of adding any 0-5volt sensor to the existing OBD2 logable stuff. I've been using this method for almost a year now.
Old 06-08-2016, 10:36 PM
  #3  
Boosted Kiwi
iTrader: (2)
 
Brettus's Avatar
 
Join Date: Apr 2006
Location: Y-cat-o NZ
Posts: 20,523
Received 1,491 Likes on 839 Posts
Yeah ... very cool . Come to NZ and get mine set up !
Old 02-15-2017, 07:53 PM
  #4  
Registered
 
Reoze's Avatar
 
Join Date: Feb 2017
Location: Austin, TX
Posts: 448
Received 50 Likes on 41 Posts
I've been wondering how to do this for weeks. Glad I saw your video.
Old 03-24-2018, 07:11 AM
  #5  
New Member
 
Victor Romero's Avatar
 
Join Date: Mar 2018
Posts: 1
Likes: 0
Received 0 Likes on 0 Posts
Hi, please can you re-upload the code?
Old 02-11-2023, 07:23 AM
  #6  
Registered
 
ciprianrx8's Avatar
 
Join Date: Apr 2020
Location: Romania, Europe
Posts: 211
Received 94 Likes on 67 Posts
I got time on my hands to build this thing and read oil pressure and temp from external sensors.



It seems that free version of Torque, Car Commander and similar smartphone apps do not allow you to define custom sensors(those that are NOT attached to the OEM Mazda ECU).



I plan to launch it for sale as a complete kit, but more info on that when I sort out everything. Will pretty much be a small box with wires and this as its brain. Reusing hardware from another project, but hey - it does all one can wish for.
5 inputs, for either 4 temperatures(oil/air/fuel) and 1 pressure(oil/air/fuel) , or 4 pressures and 1 temperature, or anything in between.


Todo: find a way of having mazdaedit log boost and emap. Actually that's what I wanted to do from the beginning but figured that the use case is way too limited just for that.

Last edited by ciprianrx8; 02-11-2023 at 07:29 AM.
Old 02-11-2023, 11:54 PM
  #7  
No respecter of malarkey
iTrader: (25)
 
TeamRX8's Avatar
 
Join Date: Apr 2005
Posts: 26,719
Received 2,007 Likes on 1,636 Posts
awesome job on that for a Mazda ECU, 10 or more years ago I’d have been all over having it …
.
Old 03-09-2023, 01:41 PM
  #8  
New Member
 
weeblebiker's Avatar
 
Join Date: Mar 2023
Posts: 4
Likes: 0
Received 0 Likes on 0 Posts
I'm doing something similar with a '19 MX5 RF except bypassing the torque app and the smartphone as display. I have an ESP32 connected to the obd port and a esp8266 on the ancillary sensors both transmitting over ESP-NOW to a receiver ESP8266 driving a display. I have an ethanol sensor and oil temp sensor transmitting to my display via ESP-NOW already and wireless code uploading (since the microcontrollers are embedded)
I think I'm close and will be up and running with CANbus communication as soon as I integrate Task Scheduler into the code. my ultimate goal is to parallel a ESP8266 or ESP32 to drive the infotainment display and use that to display whatever code I want. Torque Gauge style info and such right on the infotainment screen. (Mazda AIO doesn't work on newer firmware)


I have other things I'd like to transmit on CAN, like turning on and off the DRLs without having to drill down through the infotainment settings.

I'd like to tag along and have a few questions.

There is a lot of Torque PID info out there to do a whole bunch of stuff engine parameters, lighting, TPMS sensors etc,,,,

What I can't get my head wrapped around is how to translate Torque PID parameters back to CAN frame and haven't found good examples. seems people just skip that part and post what the Torque fields need to be instead of the raw CAN frame and torque PID.

this is an example of a Torque PID I'd like to read off the bus and transmit the integers to my display:

pid: 222A05
name: Tire 1 Pressure
sName: T1Press
Min: 0
Max: 50
Scale: x1
Unit: psi
Equation: ((A * 1373) / 1000) * 0.145037738
Header: 720


Can ya help a fella out with what the CAN frame would look like and why?

Last edited by weeblebiker; 03-09-2023 at 02:10 PM.
Old 03-09-2023, 02:47 PM
  #9  
Registered
 
ciprianrx8's Avatar
 
Join Date: Apr 2020
Location: Romania, Europe
Posts: 211
Received 94 Likes on 67 Posts
pid: 222A05

22 would be the OBD2 mode
2A would be the PID address
05 no clue - there shouldn't be anything there... unless that car uses extended 29 bits can frames. I don't know.
Old 03-10-2023, 05:17 AM
  #10  
New Member
 
weeblebiker's Avatar
 
Join Date: Mar 2023
Posts: 4
Likes: 0
Received 0 Likes on 0 Posts
I haven't come across "pid mode" or "pid address" before.
How do I format it as CAN frame header, HEX, DEC, bytes like this for coolent temp?

0x7Df, 05, 5, 1
how does the above translate to torque format?

pid:0551
header: 7DF
?
what is the Torque PID for coolent temp?

isn't all the OBD returns between CAN frame headers 0x7DF and 0x7F0 or something like that?

maybe the tire pressure CAN frame would be:
0x720, 22, 2A, 05
or
0x720, 2, 22, A0, 5
?

it doesn't seem like Torque "pid" and header format match CAN frames for OBD header, hex, dec, byte so I'm confused how to parse the Torque pid to what the CAN frame format would look like.

what CAN frame are you transmitting from the Arduino for oil temp and pressure sensors and what Torque setting are you using to read the CAN frame return?

Last edited by weeblebiker; 03-10-2023 at 05:23 AM.
Old 03-10-2023, 02:16 PM
  #11  
Registered
 
ciprianrx8's Avatar
 
Join Date: Apr 2020
Location: Romania, Europe
Posts: 211
Received 94 Likes on 67 Posts
No offence, but this CAN business is pretty well documented online. Also, I have mad respect for the OP of this thread because I feel he is trully the one to come up with the idea of expanding the list of PIDs one can grab from CAN. His source code attached in the first picture should answer all your questions; there's no point in me answering every line of your questions because that's just me developing your use-case, but with extra steps.
Old 03-12-2023, 08:05 AM
  #12  
New Member
 
weeblebiker's Avatar
 
Join Date: Mar 2023
Posts: 4
Likes: 0
Received 0 Likes on 0 Posts
I'm not trying to have someone develop for me, just don't need Torque or an elm327 obd dongle at all and was having trouble finding code examples that don't use them or their CAN frame shortcuts.
I watched the video more closely and it's starting to click.
This really doesn't need a propriety board.
This sparkfun board gets ya there, even has a voltage regulator up to snuff to handle car voltage.
I'm using a LOLIN c3 mini (esp32 D1mini) and d1 mini power shield to wirelessly transmit analog sensors from the engine bay to a Oled display. it's tiny and fits in the engine bay fuse box so doesn't need an enclosure either. I already have an esp32 OBD dongle I checked out some of the other ESP32 OBD dongle examples and found the similarity in the examples and I finally got requesting and receiving coolant temp so I have a really really short punt for this part of the project of transmitting on CAN. I do want to send commands like turning on the DRLs or roll the windows up or down when the roof closes or opens. though this gives me the idea of getting my kids old nobi android tablet to upload code changes and datalogging with it.

Last edited by weeblebiker; 03-12-2023 at 08:28 AM.
Old 04-06-2023, 01:51 PM
  #13  
New Member
 
weeblebiker's Avatar
 
Join Date: Mar 2023
Posts: 4
Likes: 0
Received 0 Likes on 0 Posts
Originally Posted by ciprianrx8
pid: 222A05

22 would be the OBD2 mode
2A would be the PID address
05 no clue - there shouldn't be anything there... unless that car uses extended 29 bits can frames. I don't know.
https://en.wikipedia.org/wiki/OBD-II...it)_bus_format (duh on me)

22 is mfr /vehicle specific byte and always 2 following bytes

The CAN request frame would be:
ID: 0x720 (mazda instrument cluster)
Byte0: 0x03 (bytes following)
Byte1: 0x22 (mfr custom request)
Byte2: 0x2A
Byte3: 0x05
Bytes 4-7: 0x00
I'm using a macchina A0 ESP32 based OBD dongle and various ESP modules wirelessly communicating. it's not a big deal to send sensor info to the dongle and transmit it.

Last edited by weeblebiker; 04-06-2023 at 01:54 PM.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
DannyR3
Series II Interior, Audio, and Electronics
3
07-26-2018 10:07 PM
rotorocks
Series I Tech Garage
47
05-11-2016 03:23 PM
R80MAV
RX-8 Multimedia/Photo Gallery
3
03-04-2014 07:40 AM
Davidjf
RX-8 Discussion
35
06-12-2013 03:22 PM
rickeo
General Automotive
20
05-06-2013 04:41 PM



You have already rated this thread Rating: Thread Rating: 0 votes,  average.

Quick Reply: DIY: Adding new Parameters (sensors) to OBD2 for logging.



All times are GMT -5. The time now is 05:23 PM.