Author Topic: M42 Datalogger Progress  (Read 6051 times)

bmwman91

  • Administrator
  • Legendary
  • *****
  • Thank You
  • -Receive: 33
  • Posts: 2798
    • View Profile
    • http://www.e30tuner.com/
M42 Datalogger Progress
« on: November 08, 2006, 11:18:17 AM »
OK, so I know everyone is excited about the MAF conversion.  You may be thinking, "Geez why is this guy working on a datalogger when the MAF conversion is not even done?!"  Well, I have had to develop a logger in order to debug the MAF Converter...I want to see WTF is going on with the converter output, EGO levels and TPS when the "hiccup" occurs.

So, I have had to self-teach myself PIC assembly, which is actually pretty simple.  Microchip Inc. supplies their full development environment, FREE!  Assembly is actually quite easy, is the most efficient you can get as far as execution time and allows precise control of operation timing (it can be harder in higher level languages).

So, basically this has left me with some very quick, very accurate routines for getting ADC values and kicking data out at 38400baud, with an error of .998% which is WELL within the tolerances of what a PC needs.  These routines can be reused pretty easily on "bigger" microcontrollers as most PIC's share a similar archeitecture, and more variables can be logged.  RPM will still be a challenge, but from my MegaSquirt experience, I at least have an idea of how to tackle it.  I will only worry about RPM (along with ~10 other variables) with the next generation of logger that I do after the MAF conversion, which will be a product of its own.

From here, I just need to write an executable for Windows to capture 2 8-bit numbers from the serial COM port, adding tabs and line breaks as needed and saving it all to a text file.  My programming is a little rusty...but Google can EASILY provide the answers to this.  If anyone has experience and wants to toss over a simple program that does something similar I would appreciate it!

Once the software is all done, I just need to build a circuit, program the PIC and log away!

06/05/2011 - 212,354 miles
Visit HERE for a plethora of 318iS stuff and some other randomness.  Would you say I have a, plethora, of pinatas?

Alpine003

  • Hero Member
  • *****
  • Thank You
  • -Receive: 0
  • Posts: 848
    • View Profile
M42 Datalogger Progress
« Reply #1 on: November 08, 2006, 03:10:09 PM »
Have you tried http://www.pgmfi.org  ?

Mainly Honda ECU hack programming but there are guys all over the world and some are pretty decent programmers that can lend a helping hand, especially if they have the same vehicle as you.

I would ultimately like to modify our own ECU to do custom ignition/fueling maps as well as datalogging.

I was able to do all this from my factory Honduh ecu a couple years ago with about $20 in modification parts.

bmwman91

  • Administrator
  • Legendary
  • *****
  • Thank You
  • -Receive: 33
  • Posts: 2798
    • View Profile
    • http://www.e30tuner.com/
M42 Datalogger Progress
« Reply #2 on: November 08, 2006, 06:22:06 PM »
Yeah, maybe someday I could find a way to pick out real-time variables from the EPROM-MCU data bus, or even directly from the file registers.  Someday.......

06/05/2011 - 212,354 miles
Visit HERE for a plethora of 318iS stuff and some other randomness.  Would you say I have a, plethora, of pinatas?

bmwman91

  • Administrator
  • Legendary
  • *****
  • Thank You
  • -Receive: 33
  • Posts: 2798
    • View Profile
    • http://www.e30tuner.com/
M42 Datalogger Progress
« Reply #3 on: November 15, 2006, 01:44:10 PM »
OMG the PIC programmer is arriving tonight!  OMG OMG

So, I can begin doing some logging finally.  Unfortunately, one chip on my old MAF converter blew, so I am going to have to wait for the E-Bay'ed oscilloscope to arrive before building my new one.  V3 will use an entirely different approach as far as conditioning the signal, but end in the same result.  So close!!!!

06/05/2011 - 212,354 miles
Visit HERE for a plethora of 318iS stuff and some other randomness.  Would you say I have a, plethora, of pinatas?

bmwman91

  • Administrator
  • Legendary
  • *****
  • Thank You
  • -Receive: 33
  • Posts: 2798
    • View Profile
    • http://www.e30tuner.com/
M42 Datalogger Progress
« Reply #4 on: December 16, 2006, 01:56:33 AM »
Alrighty, update time.

I FINALLY got all the code sorted out properly and that jazz...the first version is working.  I built it solely to troubleshoot the MAF converter lol.
 Talk about a project that was damn near as hard as the MAF one, just to support it!

It reads 4 channels, and samples them 800 times a second.  That is definitely overkill as far as what my NEEDS are, but I guess the enthusiast mindset of "hell, why not?" is prettymuch in control.  At least now I can accurately resolve indiviual intake pulses at 7200RPM if need be lol.

Anyway, I will be monitoring the following:
- EGO from the Wide-Band unit
- Throttle Position
- MAF Output
- MAF Converter Output

Once I know WHY the car bogs at WOT between 2500-3000RPM, I can try to troubleshoot the issue.  I still want to say it is a harmonic resonance issue that is just due to the intake system's geometry, but who knows.

So, once the MAF is working fully, I will work on turning this into an 8+ channel unit with a real interface.  Presently, the interface consists of Windows Hyperterminal that captures all serial input to a text file.  The text is pasted into MS Excel and analyzed in there.  It is sort of a pain in the rear lol.  If only I knew anything about writing Visual Basic pprograms...I know exactly what I WANT in an interface, but definitely do not know how the hell to create it!  Any programming wizards in here?

The future version will log:
- RPM
- TPS
- EGO
- Battery Voltage
- Coolant Temp.
- Intake Air Temp. (just before TB)
- Ambient Air Temp. (in the brake duct)
- Air Flow Rate
- Injector Duty Cycle
- Injector Pulsewidth
- Ignition Advance
- Vehicle Speed
- Manifold Pressure

That should keep me busy for a while..........

EDIT:
Attached in the links are some shots I took of the sampled data.  The RS232 port from my PC adds a crap-load of noise...I need to figure out a way to isolate the noisy ground pin from the serial port.  Anyway, for my purposes it is good enough to diagnose the MAF issue.

The shots were taken from my test-bench setup.  I was varying the input voltage to CH3 with my power supply, and had even voltage dividers (resistors) between the other 3 channels to make sure everythign was reading and tracking properly.

http://www.e30tuner.com/other4/log01.gif
This is the full measurement span with me playing with the input voltage.  All seems to be working.

http://www.e30tuner.com/other4/log02.gif
I have zoomed-in a little.  The time is 100 milliseconds (0.1 seconds).  The Voltage axis is still full-range.

http://www.e30tuner.com/other4/log03.gif
The time axis in this one is 25ms (.025sec).  The voltage is 250mV (.25V).  I'd say it is sensitive enough for my needs.

Aaah, the toils of a bored engineer..........
« Last Edit: December 16, 2006, 03:34:27 AM by bmwman91 »

06/05/2011 - 212,354 miles
Visit HERE for a plethora of 318iS stuff and some other randomness.  Would you say I have a, plethora, of pinatas?

bmwman91

  • Administrator
  • Legendary
  • *****
  • Thank You
  • -Receive: 33
  • Posts: 2798
    • View Profile
    • http://www.e30tuner.com/
M42 Datalogger Progress
« Reply #5 on: December 16, 2006, 10:01:58 PM »
I got it installed on the car today and did some logging.  Needless to say, I need to devise a way to gather RPM...it is not a simple analog signal like all the other stuff though.  It will be a PITA to get.

Anyway, I put up a bunch of other plots in the MAF Conversion V3 thread thatwere pertinent to the project.  The one below is at idle.  The scale on the right is the AFR, left is the rest according to the legend.  There is a lot of noise coming through from the Serial COMM port...but I am just getting started with signal filtering and whatnot so it will get cleaner!

Green - AFR (Right Axis)
Orange - MAF Converter Output
Magenta - MAF Output
Blue - TPS %

06/05/2011 - 212,354 miles
Visit HERE for a plethora of 318iS stuff and some other randomness.  Would you say I have a, plethora, of pinatas?

AL GReeNeRy

  • Sr. Member
  • ****
  • Thank You
  • -Receive: 0
  • Posts: 323
    • View Profile
M42 Datalogger Progress
« Reply #6 on: December 17, 2006, 06:14:24 AM »
"But what does it all meeeaaan, Basil?" - Austin

haha keep up the good work
1991 318is : brilliantrot

nuvolarossa

  • Sr. Member
  • ****
  • Thank You
  • -Receive: 1
  • Posts: 468
    • View Profile
M42 Datalogger Progress
« Reply #7 on: December 17, 2006, 10:16:21 AM »
Great stuff!
I need a datalog but don't want to pay for a innovate lma-3!
It's good the logging for a wideband lambda (it's 0-5 volt), so I can buy only the Innovate LC-1 without modules for datalog it...

For what you know will this works in my M44?:D

bmwman91

  • Administrator
  • Legendary
  • *****
  • Thank You
  • -Receive: 33
  • Posts: 2798
    • View Profile
    • http://www.e30tuner.com/
M42 Datalogger Progress
« Reply #8 on: December 17, 2006, 11:34:06 AM »
This little thing will read ANY 4 analog voltages (0-5V only).  The hard part is knowing exactly what the 4 voltages mean.

The Wide-Band Lambda meter IS nice with its programmable 0-5V output (I am using the LC-1).  The air flow sensors and stuff, I had to figure out their flow vs. voltage properties experimentally in the flow lab at my college.

Could you possibly take some pictures of your M44's MAF sensor setup and the way it is connected to the intake manifold?  Also, could you possibly take it off and get a picture of what the inside/flow area looks like?  The M42 has some nasty backflow issues, and I would like to see how the M44 solved them.  Thanks!

06/05/2011 - 212,354 miles
Visit HERE for a plethora of 318iS stuff and some other randomness.  Would you say I have a, plethora, of pinatas?

nuvolarossa

  • Sr. Member
  • ****
  • Thank You
  • -Receive: 1
  • Posts: 468
    • View Profile
M42 Datalogger Progress
« Reply #9 on: December 17, 2006, 12:02:30 PM »
I can take all pics that you want... if you go ahead with your little datalog project:D
Can you take some pics of your datalogger and email me them?:D
Now I'll remove my MAF for take some pics for you!:cool:

So if I know that, for example, 0,273 volt is 20 kPa of absolute pressure of a MAP sensor I can hook up it to your datalogger and make a formula in excel for see it in psi!!!:)
I have many schedules of MAPs and their voltages...

How you are downloading the text to PC? Have you done a software?
How much will be for a beta working of your datalogger for try it?

I need soon to log RPMs, TPS, MAP and AFR together for tune my car...
What you're thinking for take the RPM signal, if it can see only 0-5 volts?

If you want talk in private, this is my email:     roberto.bmw @ gmail.com    (remove spaces near @)

bmwman91

  • Administrator
  • Legendary
  • *****
  • Thank You
  • -Receive: 33
  • Posts: 2798
    • View Profile
    • http://www.e30tuner.com/
M42 Datalogger Progress
« Reply #10 on: December 17, 2006, 02:25:57 PM »
So far I have not made a program for this.  I use Windows Hyperterminal to capture the text to a file, then copy it into Excel and snip off the first/last readings since they are usually missing a value or 2.

This can do anything that is a 0-5V analog signal.  The RPM is another matter though...it is a amplitude-varying sinusoidal signal that can peak at 50V.  It requires its own conditioning circuit, and a lot of code to make sense of it.

The logger is pretty rudimentary.  It is very prone to internal signal noise and has virtually no conditioning for the inputs.  It needs work...the stuff I have gathered so far is messy at best.

Anyway, once I get the MAF thingy sorted out I can devote some time to this.  I will keep you all posted on this.  When I have time I can make the plans/code for this unit available.  If you want to 100% DIY you will need a PIC programmer, otherwise I can program the chips up and mail them out for a small fee (they are not free afterall!).  Do not hold your breath for it though...the MAF thing is #1 at the moment.

06/05/2011 - 212,354 miles
Visit HERE for a plethora of 318iS stuff and some other randomness.  Would you say I have a, plethora, of pinatas?

Gunni

  • Sr. Member
  • ****
  • Thank You
  • -Receive: 0
  • Posts: 277
    • View Profile
M42 Datalogger Progress
« Reply #11 on: December 17, 2006, 02:47:10 PM »
the E30 tacho signal is a 12v Square wave,
This I had seen a number of times,
the tacho gives out a 12v signal to the #9 (c101) the ecu then closes and opens it according to engine speed, to ground, if you put a resistor on the tacho signal you should be able to get it down to 5v signal coming on and off and you can datalogg that,


bmwman91

  • Administrator
  • Legendary
  • *****
  • Thank You
  • -Receive: 33
  • Posts: 2798
    • View Profile
    • http://www.e30tuner.com/
M42 Datalogger Progress
« Reply #13 on: December 17, 2006, 03:42:33 PM »
Awesome.  Thanks a million.

As far as RPM calculation, you need a circuit to detect zero-crossings of voltage that will put out a little 5V square pulse each time.  The LM1815 chip is designed to exactly that, and I worked with it when I did a Megasquirt conversion on my first M42.  It does not have the best documantation, but with an oscilloscope and some trial & error it is probably not too bad.  Check out:
http://megasquirt.sourceforge.net/extra/setup-wheel.html
For some info.

There is a programmer on Microchip's website (PIC uC manufacturer http://www.microchip.com ) called the PICKit 2.  It is cheap and very useful for this.  They provide a software package called the MPLAB IDE on their site too...it allows you to write code in assembly (or C if you want), assemble it and silulate it.  Very useful.
« Last Edit: December 17, 2006, 03:45:26 PM by bmwman91 »

06/05/2011 - 212,354 miles
Visit HERE for a plethora of 318iS stuff and some other randomness.  Would you say I have a, plethora, of pinatas?