Re: Anyone to waste time on DIY engine control unit?

ppressle wrote:

Hey, you said BMW crank sensor.  smile  They don't have the optical thing like you have.

There is an opinion that mine is Hall... But I really have no idea. Op-amp usually comes into play to handle http://en.wikipedia.org/wiki/Variable_reluctance_sensor - the one which handles toothed stuff? Apparently I am a bit confused.

Re: Anyone to waste time on DIY engine control unit?

Those look like Hall senders in the distributor in the first post. If they are magnetic that's a good hint.

I don't think you want an operating system  in between your coding and the ecu. Any os hiccup means possibly bad things for the engine, a dead engine or a car that won't start. Make sure whatever stuff you use can handle voltage spikes of 80v (starter solenoid collapse spike)

-Killer B's (as in rally) '84 4000Q 4.2V8. Audis never win?

Re: Anyone to waste time on DIY engine control unit?

jrbe wrote:

Those look like Hall senders in the distributor in the first post. If they are magnetic that's a good hint.

I don't think you want an operating system  in between your coding and the ecu. Any os hiccup means possibly bad things for the engine, a dead engine or a car that won't start. Make sure whatever stuff you use can handle voltage spikes of 80v (starter solenoid collapse spike)

RTOS (real time OS) not an average OS. The particular one is tiny,

Re: Anyone to waste time on DIY engine control unit?

Or I am.  smile  So I guess I should study up a bit more before posting.  Google tells me that the BMW CPS sender I called a hall effect, is actually a variable reluctance as you guys seem to already know.   And, I have no idea what yours is, only that it looks quite different than the BMW CPS.

The RTOS you are using is associated with the board you are using?  Any pointers to info on it?

Thanks.

Re: Anyone to waste time on DIY engine control unit?

ppressle wrote:

Or I am.  smile  So I guess I should study up a bit more before posting.  Google tells me that the BMW CPS sender I called a hall effect, is actually a variable reluctance as you guys seem to already know.   And, I have no idea what yours is, only that it looks quite different than the BMW CPS.

The RTOS you are using is associated with the board you are using?  Any pointers to info on it?

Thanks.

This RTOS is a totally independent entity - I believe the main guy there is in academia in Italy. http://www.chibios.org/dokuwiki/doku.ph … hitectures
It actually supports some MegaAVR - does it support your arduino?

I am now heading to a junk yard to grab a variable reluctance dizzy so that I can work on the input circuitry.

Re: Anyone to waste time on DIY engine control unit?

Russian,
I have lots of experience with the discovery board.
Our car (The Flying Lumberjacks) has a digital dash backed by one.
You can't make out anything but the fuel gauge on video.  http://www.youtube.com/watch?v=KwcOhuL-yRU
What we're currently monitoring is:
  Battery voltage
  Oil temp
  Oil pressure (switch only, no actual sensor)
  Water temp
  Fuel level

There's lots of inputs left on the board I made.  The board has seven analog ins + battery voltage montitor and 10 digital ins.  the display is a 240x64 pixel graphic LCD, it's not great but you can see it in the car pretty OK.  Future upgrades will include data logging to a USB thumb drive.

Looking at your schematic for the input in post #2, your pull up resistor should be going to 3.3v not 5v.  Most of the inputs onthe STM32F4 are tolerant of 5V but not all of them.  There should also be diode clamps to protect the CPU from voltage spikes.  A unidirectional 3.3v transorb is better still.

Once you start using the A/D converters you should note that the reference voltage on the board is 3.0v, the only way to find that is to look at the schematic of the board.  It took me a little bit to find that when all of my sensor inputs were off by 10%.

For something as simple as an ECU I wouldn't bother with an OS, it doesn't supply solutions for any problems you have.  The ST supplied peripheral driver libraries handle setup of the hardware just fine.

Re: Anyone to waste time on DIY engine control unit?

In one of my street cars I run Autronic SM4  nice system  data logs everything I need and uses a wide band o2 sensor and has knock control.

Re: Anyone to waste time on DIY engine control unit?

erich wrote:

For something as simple as an ECU I wouldn't bother with an OS, it doesn't supply solutions for any problems you have.  The ST supplied peripheral driver libraries handle setup of the hardware just fine.

Cannot agree with you. It's way easier to program if you have threads, and by using the OS api not the ST api I hope to modify less code when I would need to port my code from f4 to f5 f6 or whatever happens next. I just to not want to hard-code any particular microprocessor.

34 (edited by russian 2013-09-01 05:16 PM)

Re: Anyone to waste time on DIY engine control unit?

ppressle wrote:

Google tells me that the BMW ... is actually a variable reluctance

I did not find any VR distributor yesterday, at least I did not find anything I was sure is a VR distributor. Got myself a VR crankshaft position sensor and got a chance to play with an oscilloscope - it's a piece of magic, it does show the wave it should show if I wave an impact socket in front of it.

As for VR input circuit, I've found this board you can use for your RPM decoder - http://www.jbperf.com/dual_VR/v2_1.html

Re: Anyone to waste time on DIY engine control unit?

russian wrote:

Cannot agree with you. It's way easier to program if you have threads, and by using the OS api not the ST api I hope to modify less code when I would need to port my code from f4 to f5 f6 or whatever happens next. I just to not want to hard-code any particular microprocessor.

There is absolutely no use for threads in a ECU.
EVERYTHING will be triggered by interrupts, and the vast majority of output (injectors & spark) by timers.
An ECU is a hard real time problem.  Programming solutions for hard real time systems are controlled by the worst case performance of all operations.  ChibiOS is a 'soft' RTOS, it has no methods for guaranteeing anything, it simply makes a 'best effort'.  Like I said, it doesn't have solutions for any of your problems. 

I understand why you want the OS.  I also know that you will not succeed unless you understand the hardware and know how to make it dance to your tune.   Looking at the ChibiOS section on timers, it doesn't even have the concept of the timer output going to a pin.  Either you need to set that up yourself (straight to the hardware) or a more complicated solution with callbacks triggered by timers to toggle outputs which will also be less accurate.

Granted, the amount of code required to run an engine is tiny and will present no hard real time issues so long as you don't write it in perl :-)

One thing you will need is a better A/D converter for the mass airflow sensor.  They run square law output for linear airflow so light thottle at low rpms will have very little output change.  I'd look for something with at least 16 bits of data.

Re: Anyone to waste time on DIY engine control unit?

erich wrote:

Looking at the ChibiOS section on timers, it doesn't even have the concept of the timer output going to a pin. ...

One thing you will need is a better A/D converter for the mass airflow sensor.  They run square law output for linear airflow so light thottle at low rpms will have very little output change.  I'd look for something with at least 16 bits of data.

I think they use the term 'PWM driver' for the hardware timers - http://chibios.sourceforge.net/html/group___p_w_m.html - and the term 'timer' for timers with just 'time'

Do you have a favorite 16 bit ADC chip, ideally in DIP case? On the other hand, who cares about light throttle at low rpms smile

Re: Anyone to waste time on DIY engine control unit?

I've always been partial to Analog Devices and Burr Brown (now TI) data converters.  Good luck finding anything good in DIP, I have a hard time finding anything good these days in anything as large as SOIC.

PWM outputs aren't good for much beyond idle solenoid control.  You need one shots.  Lots of one shots.  Most of the outputs you need to generate are specific length pulses that end at a specified time.  For spark you need an N ms pulse (dwell time) that ends exactly when you want the coil to fire.  For fuel you want a precise length pulse that ends in a specific relation to the valve close event.  PWM outputs generally don't have that kind of control.

If I was building my own ECU, I'd build in ion knock sensing, it's the right way of monitoring peak cylinder pressure and all the cool kids are doing it.  With ion sensing you can even auto tune the ignition timing.  Find out where your engine makes peak power and move the spark around until it lines up.

Re: Anyone to waste time on DIY engine control unit?

Anybody who makes fuel injection cheaper and easier is OK in my book!!!

GO BIG Russian GO!!!!

'ported, relieved, with bored-out arm rests, and oversize seat covers.

Re: Anyone to waste time on DIY engine control unit?

Red Lemons Racing wrote:

In one of my street cars I run Autronic SM4  nice system  data logs everything I need and uses a wide band o2 sensor and has knock control.

Very cool. I run an Autronic SM4 in my jetski.

Re: Anyone to waste time on DIY engine control unit?

erich wrote:

PWM outputs aren't good for much beyond idle solenoid control.  You need one shots.  Lots of one shots.  Most of the outputs you need to generate are specific length pulses that end at a specified time.  For spark you need an N ms pulse (dwell time) that ends exactly when you want the coil to fire.  For fuel you want a precise length pulse that ends in a specific relation to the valve close event.  PWM outputs generally don't have that kind of control.

I've made some measurements on how accurately I can control times - more details http://rusefi.com/articles/pwm_performance/

Re: Anyone to waste time on DIY engine control unit?

russian wrote:

I've made some measurements on how accurately I can control times - more details http://rusefi.com/articles/pwm_performance/

I've signed up on your forum.  I'll pollute that space instead of here :-)

Re: Anyone to waste time on DIY engine control unit?

TrackGeeks_Chris wrote:

I've been wanting to do this and add FI to my lawnmower.

No, seriously.

You can buy a kit for that:

http://www.ecotrons.com/Small_Engine_EFI_PNP_kit.html

If you want more freedom, Freescale has an eval board for small engine/motorcycles. Look here:

http://www.freescale.com/webapp/sps/sit … mp;fsrch=1

Maximum Leader, Ruler for Life,
Dirty Rotten Cheating Bastards Racing

Re: Anyone to waste time on DIY engine control unit?

Casper_Milquetoast wrote:
TrackGeeks_Chris wrote:

I've been wanting to do this and add FI to my lawnmower.

No, seriously.

You can buy a kit for that:

http://www.ecotrons.com/Small_Engine_EFI_PNP_kit.html

If you want more freedom, Freescale has an eval board for small engine/motorcycles. Look here:

http://www.freescale.com/webapp/sps/sit … mp;fsrch=1

Yea, that would be much more practical for the mower compared to what I did to the jetski.

Re: Anyone to waste time on DIY engine control unit?

I can help you out with some conceptual info and a huge amount of source code ( fairly poorly documented ) for a Ford EEC-V V8 system circa 1998.

The table methods they used are creative and easy to conceptualize and might help.

Also the strategy guides for these when available give great insight into the requirements for the engine.

Hard bits for pure general purpose CPU is the hard realtime requirement.

El Capitan de los Bastardos De Lemons
1993 Linco Mark Ate
1957 Renault Dauphine
Driver with LemonSpeed's V6 Mustang

Re: Anyone to waste time on DIY engine control unit?

TheHeckler wrote:

I can help you out with some conceptual info and a huge amount of source code ( fairly poorly documented ) for a Ford EEC-V V8 system circa 1998.

The table methods they used are creative and easy to conceptualize and might help.

Also the strategy guides for these when available give great insight into the requirements for the engine.

Hard bits for pure general purpose CPU is the hard realtime requirement.

I'm interested, I'll pm you my email. Of if you want u can create a thread of rusefi.com/forum smile

Re: Anyone to waste time on DIY engine control unit?

roflcopter has described his even simpler approach at http://rusefi.com/forum/viewtopic.php?f=5&t=224 - I wonder if anyone has enough understanding to comment this here or there.

Re: Anyone to waste time on DIY engine control unit?

TheHeckler wrote:

I can help you out with some conceptual info and a huge amount of source code ( fairly poorly documented ) for a Ford EEC-V V8 system circa 1998.

The table methods they used are creative and easy to conceptualize and might help.

Also the strategy guides for these when available give great insight into the requirements for the engine.

Hard bits for pure general purpose CPU is the hard realtime requirement.

This is exactly what I started from, I was using an EEC-IV to look at what strategies are being used and figure out how bare bones I can get.  Which in the end I decided to slim it down as much as possible, then try to add things in later as I run into limits with that plan.

Anyone who wants to look through my code, it's available on Russian's forum and I'd love to hear peoples suggestions and critiques.  My timing strategy is what a poster on here was describing I believe, which offloads all of the timing responsibility to hardware and leaves the processor to do very little work.

Re: Anyone to waste time on DIY engine control unit?

I don't know much on the coding side. I have decent experience on the tuning, sensors, troubleshooting, etc. side of things. I may join but might not remember to go look at your forum Russian.
I know standalone ecu programmers spend a huge amount of time and effort on coding the ecu and getting the code as tight and short as possible. Not sure you guys are going this way but having any os will probably effect timing accuracy and repeatability. Working in an os I think you will find its limitations of accuracy fairly quickly.

-Killer B's (as in rally) '84 4000Q 4.2V8. Audis never win?

49 (edited by russian 2013-10-29 12:15 PM)

Re: Anyone to waste time on DIY engine control unit?

jrbe wrote:

I don't know much on the coding side. I have decent experience on the tuning, sensors, troubleshooting, etc. side of things. I may join but might not remember to go look at your forum Russian.
I know standalone ecu programmers spend a huge amount of time and effort on coding the ecu and getting the code as tight and short as possible. Not sure you guys are going this way but having any os will probably effect timing accuracy and repeatability. Working in an os I think you will find its limitations of accuracy fairly quickly.

I don't know much about tuning, but I know a lot about coding. From what I have seen, it really seems to me that most of the existing things were done by tuners and/or wrenches who have forces themselves to code.

Back in the days of 8 bit 12MHz cpus, it was one thing. Now with 168MHz things I think approaches should be different.

You see, engine size or engine output has not changed much over the last 50 years. What do we have, a 50% gain? a 100% gain in output per cubic inch per gallon? In the CPU universe, the gain is 4000% between the hardware of MS1 and now. The change is much larger and that should not be ignored as it is ignored now.

Re: Anyone to waste time on DIY engine control unit?

I understand processor speeds have gone up a huge amount. I was talking about current high end standalone ecus. I think the problem comes when it's referencing coolant temp, air temp, sensors 5, 6, 7, & 8 and referencing fuel, ignition, etc. tables and making timing exact. If you're firing 8 injectors, 8 coils, and anything else hooked up those on for exactly x time ending at y and engine position calculations get tricky. The ecus also can handle 20,000 rpm iirc so maybe it's not as bad as I think for civilized engines.

-Killer B's (as in rally) '84 4000Q 4.2V8. Audis never win?