FAQFAQ SearchSearch MemberlistMemberlist UsergroupsUsergroups RegisterRegister
ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in

 
Proper data logging on OBD1 via Arduino (OBduino?)

 
Post new topic   Reply to topic    TunerPro User Forum Forum Index -> Bosch
 
Hairyscreech



Joined: 20 Jun 2017
Posts: 112

PostPosted: Mon Nov 27, 2017 6:59 am    Post subject: Proper data logging on OBD1 via Arduino (OBduino?) Reply with quote

After some trouble over the weekend getting the car to run well it is clear the biggest issue we face is not being able to log data properly from these ECUs.

The hit tracing is good but is never going to provide the level of detail that we need to find faults and 1 man tune these early motronic ECUs.

I was thinking about how to resolve this and came up with the idea of using an arduino to log signals and output the information via a normal OBD2 output.

This would essentially piggyback onto the ECU and monitor several inputs, most likely creating a couple of calculated channels (i.e. calculated load) and then spitting them out on demand to a normal OBD2 interface.

I did a bit of research and found that someone has created a OBD2 stimulator that throws out random OBD2 signals for testing OBD2 readers.
This was based on an arduino and has a lot of what we need baked into it.
The big change would be to make it sense and calculate the outputs rather than generating them at random.

An Arduino Mega2560 has all we need to do this job and they are cheaper than a pint in some london pubs. I think this can be done for way less than 100 but I know I am going to need help programming and testing this thing.

So who's in?

I have the following so far:

Arduino Mega2560 Generic - 8
CAN BUS shield Elec freeks - 6
EML327 OBD2 interface - 10
Dual VR sensor board - 18

Signals
- All input signals need to be limited to 5v max.
- TPS 0-5v signal, generally 0.4-4.5v - Might be ok to just tap as not as precise as we expect.
- MAF 0-5v signal, generally 2-5v - Sugested to use OP-amp buffer to prevent altering the voltage.
- IAT - As TPS?
- CLT - As TPS?
- WBO2 0-5v - Comes direct from gauge, probably just feed it in.
- Crank VR signal - Fine to feed direct but needs diode clamps to prevent over voltage.
- Cam Hall effect, 0-5v max. - Not really needed if V drop of coil 1 is used as reference? Square wave so just tap in.
- Ignition Cyl 1, Grounded 12v signal, Replace Cam signal? Need to sense this without grounding coil. Use inductive sensor instead?
- Injector 1 pulse width, grounded 12v signal
- VSS VR signal? Same issues as crank sensor? Same issue if taken from output to clocks?
- Vanos simple 0-12v on/off signal, reduce to 5v and connect to digital i/o pin.

Issues
- VR sensor has posibility to over voltage, Meg2560 needs protection from over voltage (Clamps?) how is the stock ECU protected?
- WBO2 output needs to be incorporated, simple 5v signal? Is it worth logging the stock lambda sensor if WBO2 is available?
- Load signal big issue, need to figure out the eqation used and program this into the Mega2560, check Nefmoto?
- Can power the board from 12v using Vin pin but need to regulate to 12v max?
- Code code code!

Posibilities
Could provide sensor diagnostic without pluging into ECU
Can obviously data log and feed to tunerpro
Can provide true injector pulse width and spark timing
Could use switched output to activate add on systems like a piggyback
Could be used to correct fuel signal to OBC/dash
Could take single vanos signal and control dual vanos with it
Could be used to switch on warning lights or feed back warnings to the ECU
If we can disassemble enough code the ATmega2560 is capable of running modified motronic code natively
Could provide digi dash readouts
Ability to provide more live data than the ECU ADS system.
Could be made to replicate stomp test using TPS connection and feedback the blink codes?
Could interface with a CAN device to control it or/and prevent issues
Back to top
View user's profile Send private message
 

 
Hairyscreech



Joined: 20 Jun 2017
Posts: 112

PostPosted: Wed Nov 29, 2017 1:51 pm    Post subject: Reply with quote

Well with surprisingly little interest I have gone ahead and started anyway, the OBD2 reader turned up today so I popped that open (glued, not easy or pretty) and removed the resistor between the 2 CAN pins. It is not needed and ruins the communication on a lot of cars, the pins are notmally filtered with a resistor and capacitor but I doubt we will have much noise on the CANBUS given it is going direct to the Arduino CAN shield.

Speaking of which I broke the CAN high and CAN low pins out from the OBD socket so I can send them direct to the high and low on the CAN shield.

The Mega2560 should turn up by Friday along with the CAN shield hopefully so I will get onto that soon as it turns up.

The links I posed seemed to disappear, I assume spam protection of some kind but there are on a text document in my dropbox.
I will post them again and see if they go.

In the meantime have some pictures:
Edit - Holy pic size batman. Best to go with the link here: https://imgur.com/gallery/H06hP

Also the info links missing from the first post:
Mega2560 documentation - https://www.arduino.cc/en/Main/arduinoBoardMega2560/
CAN BUS shield infromation - https://www.elecfreaks.com/wiki/index.php?title=CAN-BUS_Shield
CAN BUS Shield store link - http://www.elecfreaks.com/estore/can-bus-shield.html
ELM327 data sheet - https://cdn.sparkfun.com/assets/learn_tutorials/8/3/ELM327DS.pdf
OBD2 protocall information - https://en.wikipedia.org/wiki/OBD-II_PIDs
Guide for OBD2 simulator - http://techtinker.co.za/forum/viewtopic.php?f=14&t=10
Guide for OBD2 simulator - http://www.instructables.com/id/Arduino-OBD2-Simulator/
Op-amp buffer - https://www.eecs.tufts.edu/~dsculley/tutorial/opamps/opamps5.html
Speeduino dual VR board - https://diy-efi.co.uk/home/17-dual-vr-conditioner-speeduino-compatible.html
Notes on tapping Motronic signals - https://www.reddit.com/r/AskElectronics/comments/2p4hyg/car_ecu_question_if_i_tap_into_sensor_wires_in/
M44 OBD2 datalogging - http://m44.wikia.com/wiki/Data_logging
Sample ananlogue read code - https://www.arduino.cc/en/Tutorial/ReadAnalogVoltage
Speeduino code overview - https://speeduino.com/wiki/index.php/Code_overview
Back to top
View user's profile Send private message
 

 
Mykk



Joined: 05 Sep 2015
Posts: 81

PostPosted: Wed Nov 29, 2017 1:59 pm    Post subject: Reply with quote

Absolutely in, just don't have much to contribute as this is over my head. I have heard of people making standalone efi arduino units called Speeduino.

Last edited by Mykk on Wed Nov 29, 2017 2:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
 

 
Hairyscreech



Joined: 20 Jun 2017
Posts: 112

PostPosted: Wed Nov 29, 2017 2:20 pm    Post subject: Reply with quote

I have been wondering if and arduino could be a data logger for a while, seeing the speeduino stuff just confirmed it.

Going to put together a speeduino for a friends M52 drift car soon. Will see how it goes as it seems to have killed off the low range megasquirt units completely. You can build one here for ~220 which is a lot of unit for not much cash.

Also, don't assume this is not totally over my head either, I'm just willing to go in with both feet and figure out the swimming bit when I know how deep the water is. Laughing
Back to top
View user's profile Send private message
 

 
Mykk



Joined: 05 Sep 2015
Posts: 81

PostPosted: Wed Nov 29, 2017 7:16 pm    Post subject: Reply with quote

https://www.youtube.com/watch?v=c_UQWqbNXgM
Back to top
View user's profile Send private message
 

 
Hairyscreech



Joined: 20 Jun 2017
Posts: 112

PostPosted: Sat Dec 02, 2017 8:09 am    Post subject: Reply with quote

Its interesting to see that several similar projects have been done before but none quite all the way to a full OBD2 compatible output.

Its looking like a lot of the work maybe figuring out where they could have been improved and then working out how to integrate them.

I ordered a canbus shield and didn't spot that it was coming from China. Doh, so that's not going to be here until January, fortunately I spotted that and ordered another in to UK at 2.5x the price which turned up today.
The mega2560 that's coming form the UK hasn't appeared yet either and I wanted to get on with it this weekend so I just stumped up the 30 for a genuine arduino from maplins.
My time this weekend is defenatly worth 30.

Also picked up the bits to make some of the signal conditioners so I will try to bang the hardware together tonight and begin coding over the next week.

It does mean I will have 80% of the bits needed to put a second one together or a spare for the 3d printer.
Back to top
View user's profile Send private message
 

 
Hairyscreech



Joined: 20 Jun 2017
Posts: 112

PostPosted: Wed Dec 06, 2017 6:37 am    Post subject: Reply with quote

Got the Mega2560 and the CANBUS shield all fitted up together and wired to the OBD2 output.

Had quite a bit of trouble getting the shield initialized, turns out the pin assignment is a little different on the arduino uno they were designed for and the Mega2560.
A bit of jumper wiring of pins 10-13 to pins 50-53 and a small change to the code got it working.

I uploaded the OBD2 simulator code I had and got a working OBD2 output from the interface.

So far so good, I have not touched it more yet as I have been updating the M3.3.1 stuff with all of the new info over the last few days,

From here it is a case of putting some code together to read the pins and output the results to the CAN shield. From looking at the sample code I used to test it it may not be too much of a difficult thing to do.

Olafu mentioned something the other day that made me wonder if I can pick up a true load signal from the auto gearbox interface, going to see if that is possible a it will be more accurate than a back calculated simulated load output.
Back to top
View user's profile Send private message
 

 
Mykk



Joined: 05 Sep 2015
Posts: 81

PostPosted: Wed Dec 06, 2017 8:09 am    Post subject: Reply with quote

Very cool stuff.

I got started on putting together my own speeduino to sit in the DME case and utilize the 88 pin connector for stock wiring harness. So far I've got the Ardiuno Mega2560 and a gutted dme. Still awaiting the Sppeduino v0.4.4 board. Once the firmware is loaded on the arduino it connects and communicates with Tunerstudio.

You could spend some time with the speeduino.ini file and Tunerstudio to give you the visual layout you want for the data logging and live gauges. No DTC's however.
Back to top
View user's profile Send private message
 

 
Evil



Joined: 18 Jul 2017
Posts: 102
Location: France

PostPosted: Wed Dec 06, 2017 11:32 am    Post subject: Reply with quote

Maybe it is possible To pick up load signal with the econometer output?
Back to top
View user's profile Send private message
 

 
Hairyscreech



Joined: 20 Jun 2017
Posts: 112

PostPosted: Thu Dec 07, 2017 12:43 am    Post subject: Reply with quote

The speeduino mates with tunerstudio the same way that the megasquirt does, not sure how that is but it won't port across to Tunerpro.

I believe I need to sort out an ADX file for tunerpro but I will cross that bridge later.

As far as I am aware the econometer output is just a square wave pulse that is based on injector pulse width and speed, possibly only pulse width as the clocks already know speed and the OBC wires through the clocks.

It is something I would like to be able to adjust actually as I like having the calculated consumption and range outputs on the E30 one.

The auto box ECU is a more likely candidate as that does actually need to know load due to the kickdown and other functions the auto box needs to be able to do.
Olafu is right though that it may need some sniffing of the connection unless I can find the info I need out there already.
I do wonder if this is active on the manual cars but the checks for the auto box are just disabled? It would make more sense than them programming two whole variants of the code and I have not heard of people needing a specific "auto" ECU.
I know the M60 auto ECU works ok in manual config but throws a trouble code/possibly limps because it cannot detect the autobox, other than that it seems to be fine which is what makes me think it is just an enable/disable checks thing.
Back to top
View user's profile Send private message
 

 
Evil



Joined: 18 Jul 2017
Posts: 102
Location: France

PostPosted: Thu Dec 07, 2017 7:02 am    Post subject: Reply with quote

Hairyscreech wrote:


As far as I am aware the econometer output is just a square wave pulse that is based on injector pulse width and speed, possibly only pulse width as the clocks already know speed and the OBC wires through the clocks.

It is something I would like to be able to adjust actually as I like having the calculated consumption and range outputs on the E30 one.


I have seen somewhere that the cluster was receiving load signal for econometer. Don't remember where, I've seen that totally accidentally when searching for something else Laughing

Moreover, speed signal comes first to the cluster and then is dispatched to "accessories" (wipers relay, DME, etc). It should be more logical for the calculation for consumption to be done in the cluster than in the DME.

But like you, it could be a good thing to adjust for me with the E85 conversion, for the moment I have a 6l/100 in cruise where I was at 8.5 with fuel Laughing Laughing
But it could be interesting to know anyway for any application.
Back to top
View user's profile Send private message
 

 
Hairyscreech



Joined: 20 Jun 2017
Posts: 112

PostPosted: Thu Dec 07, 2017 11:18 am    Post subject: Reply with quote

I am pretty sure the conversion does happen in the cluster.

I think (means I need to check) that the speed signal is sent to the cluster first and is just a pulse from the trigger at the rear, the clocks turn this into a speed pulse for the OBC and the ECU, the E30 pulses are the same as the E36 but wheel size and thus speed is different.

The quantity of fuel being used is spat out to the clocks from the ecu and the clock turn these two signals into M/G.

What I do not know is if the ECU spits out the pulse width and the clock does the pulse to volume calculation based on the coding plug or if the ECU spits out a calculated fuel quantity signal using what injector scaling we know of.
Back to top
View user's profile Send private message
 

 
olafu



Joined: 26 Jul 2016
Posts: 65
Location: Finland

PostPosted: Mon Dec 11, 2017 7:54 am    Post subject: Reply with quote

Why not to get direct data from K-line to Tunerpro? Needs some work to log RS232 data and clear it, but then we know how scan tool "asks" data from ECU.
Back to top
View user's profile Send private message
 

 
Hairyscreech



Joined: 20 Jun 2017
Posts: 112

PostPosted: Mon Dec 11, 2017 1:16 pm    Post subject: Reply with quote

I believe the serial transmission is too slow for live data.

I think it has been tried on an 8051 generation chip and they are way too slow, I don't think the 80196 is much better in that regard.

It was one of my first thoughts when I saw it had a serial port.
Back to top
View user's profile Send private message
 

Display posts from previous:   
View previous topic :: View next topic  
Post new topic   Reply to topic    TunerPro User Forum Forum Index -> Bosch All times are GMT - 9 Hours
 
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 


Powered by phpBB © 2001, 2002 phpBB Group
RedSquare theme 1.0.3 © DoubleJ(Jan Jaap)