Thread: Light and Fast OS

  1. #1
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246

    Light and Fast OS

    I want to replace a car's ECU with a computer. This computer should read sensors data and send command to different parts of car. It needs a light and fast OS. So I can write my program base on that. What OS should I use? Any ideas about what I am going to do?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    > Any ideas about what I am going to do?
    Blow up the car would be my first guess

    The first step is to choose a real time operating system.
    http://en.wikipedia.org/wiki/RTOS
    http://en.wikipedia.org/wiki/Categor...rating_systems

    You thought the choice of desktop operating systems was varied
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    From an electrical engineering standpoint what you are wanting to do is not all that simple. It would be easier to just reprogram or reflash the existing ECU or ECM rather than use an entirely different chip. How the sensors communicate with the car's ECU and/or trans. ECM is very proprietary. Most cars use OBD 2 or a variant of OBD. You can download the specifications to OBD online from the standards association but they are not free.

    Once you get this information then you can recode the ECU to do what you want. Alternatively you can use add-on modules that perform different functions but that are already compatible with your ECU.

    It's not just as simple as plugging in a new chip like an x86 processor and going to town. The car's ECU is much different than the CPU in a computer. The architecture, I/O, etc, are all equally as different.

    I currently work in the automobile industry but moreso in the heavy equipment sector. The ECUs and ECMs we use on our vehicles alone have hundreds of different software versions and all communicate differently with the equipment onboard. You could not take one of our ECMs and make it work on a car and vice versa without some major design changes.

    And before you go reprogramming the ECU keep in mind it may work in tandem with a transmission ECM that allows the system to shift properly as well as monitor transmission fluid pressure, temperature, etc. In short if you go programming the ECU make sure you know what you are doing or you could very well at the least cause the car to stop working and at the worst blow the motor. Fuel pressure and atomization, fuel/air ratios, cylinder pressures, injector pressures at the cylinders, timing, crankshaft positioning, etc, etc. are all monitored by most ECUs. Unless you know a lot about the engine in question it probably would not be a good idea to change the values in the various tables used for engine control. Improving engine performance should not be done electronically via a chip without dynoing the car to monitor the improvements and side effects. Also there are multiple types of active and passive sensors on a car all employing different metholodologies for obtaining data. Without a schematic of the car in question everything is just a shot in the dark.

    For instance a crankshaft position sensor uses 'notches' on the shaft to sense position. When the notch is above the sensor the sensor is off and when the notch is below the sensor it is on. Due to the way the notches are arranged on the journal behind the flywheel the ECU can tell the exact timing and thus position of the engine at all times. This information is then used to determine other things like mixture, variable timing (if equipped), etc. etc.
    This sensor is usually an active sensor requiring a voltage from the ECU in order to generate a small magnetic field around the tip of the sensor. One wrong input from a sensor can send the whole engine into chaos depending on what system the sensor is monitoring.
    Last edited by VirtualAce; 09-11-2007 at 01:41 AM.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Bubba explains things well. I would just like to add that, assuming you are after improving the cars performance, rather than replacing a broken ECU, then I would suggest that you look at a "filter device", instead of replacing the entire ECU. The filter device would sit between the existing ECU and the engine. This has the benefit that you only need to modify things that you actually want to modify, leaving things that you don't care abotu to the existing ECU, like "measuring engine temp and deciding to turn on/off the radiator fan" or "measuring oil pressure to light up the red-light on the dashboard".

    An example of this technique is the Dynojet PowerCommander http://www.powercommander.com/eng_default.aspx
    - other companies make similar products (Yoshimura for example). I wouldn#t be surprised if these exist for cars too, but I'm more into motorcycles than cars.


    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    http://en.wikipedia.org/wiki/Chip_tuning
    Be aware of your local jurisdiction and insurance requirements. You can easily invalidate your insurance by doing this for example.

    > So I can write my program base on that.
    The embedded software in cars is written to a much higher standard than most people are ever likely to come across. Your typical PC software which gets regular network patches would just get laughed at and thrown away.
    If your tinkering causes death, then expect some serious explaining and consequences.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by siavoshkc View Post
    I want to replace a car's ECU with a computer. This computer should read sensors data and send command to different parts of car. It needs a light and fast OS. So I can write my program base on that. What OS should I use? Any ideas about what I am going to do?
    There are a lot of people fiddling around with this stuff, including a fair number of my friends. I'm not a big car buff so I'm not willing to spend the dough, but as an example of a project like this, have a look at MegaSquirt.

    As others have said, you may destroy your car by fooling with this stuff. But I wouldn't worry overly much about actually KILLING somebody. Modern cars have all kinds of safety interlocks to prevent catastrophe in the event of an ECU failure. Engine control software is indeed complex, well tested, and probably orders of magnitude higher quality than anything else you might encounter, but still not perfect.

    I can chip my VW to DOUBLE its horsepower. Too bad the chip costs about $2500, voids the warranty, and decreases engine life.

  7. #7
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    What I had in my mind was a program that exactly operates like a traditional ECU. So it would be safe and reliable.Then I could make it so to change values in different conditions or manually. The bigest problem for me is the hardware interface between car sensors and computer. I first thought of a PCI card. But PCI bus maybe slow and unreliable. If even not, I couldn't design a PCI card. So maybe I give up and do an ECU tuning in some way.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  8. #8
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Modern cars have all kinds of safety interlocks to prevent catastrophe in the event of an ECU failure....
    Yeah as in modern day cars cannot run without the ECU in any way shape or form.

  9. #9
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Why not leave the car as it is and add extra things? Like temperature gauges, magnetic sensors so you can see how much RPM each piston is running at? As for performance, rejet your fuel injector and call it a day.

    Over here in Australia you can buy ex-cop cars, which are pretty much standard V8 sedans with better ECUs, while these ECUs reduce economy and alike they do increase performance, you might be able to get one.

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    > Modern cars have all kinds of safety interlocks to prevent catastrophe in the event of an ECU failure.
    Do modern car designers take into account all the problems that an idiot with a screwdriver and a C compiler can cause?
    A programmer with a screwdriver is a very dangerous creature
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  11. #11
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Salem View Post
    > Modern cars have all kinds of safety interlocks to prevent catastrophe in the event of an ECU failure.
    Do modern car designers take into account all the problems that an idiot with a screwdriver and a C compiler can cause?
    A programmer with a screwdriver is a very dangerous creature
    Yes, I would expect that the ECU is a large part of those safety interlocks. For example, if you let go of the pedal in a "fly by wire" controlled throttle, but the ECU has locked up (but still operating enough to fuel the engine), the throttle might not close - so you're going full throttle on. Brakes will slow you down, but not quite as well as if you have the engine slow down too...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  12. #12
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Like temperature gauges, magnetic sensors so you can see how much RPM each piston is running at?
    This statement makes no sense. Since each piston is connected to the crankshaft via connecting rods this means that the RPM of the crankshaft represents the true RPM of the engine. Also since the up/down motion of the piston is transferred to the crankshaft and converted to a rotary torque it makes no sense to say the RPM of the pistons. Pistons do not have RPM but they do create RPM. Now you could compute the velocity of the pistons in the cylinders but I doubt this figure would mean much. If you want more horsepower you generally need either more air, more fuel, more displacement and thus more power, or a combination of those.

    These are usually achieved through such things as
    • Cold air intakes (cooler air is better)
    • Turbos (compressed air) with intercoolers (compressing air makes it hot - intercooler cools it back down to be useful for the engine)
    • Superchargers (same as turbo except runs off of an engine pully - thus parasitic drag - faster the engine=more drag)
    • Higher pressure or larger fuel injectors (more fuel)
    • Higher PSI rated fuel pump (more fuel - normally requires aftermarket injectors)
    • Headers - more efficient exhaust system whereby each cylinder has a separate 'tube' to use
    • Aftermarket downpipes - lots of restriction here on stock cars
    • Aftermarket catalytic converters - lots of restriction here on stock cars
    • Aftermarket exhaust systems - stock systems are far less than adequate for producing good horsepower
    • ECUs - OEM chips run the car 'as designed' by the engineers. Aftermarket companies employ engineers who help programmers code ECUs either to fit their aftermarket systems or to gain overall performance from the car w/o adding parts - this is NOT simple.
    • Valve train kits
    • New camshafts with higher lobe lifts and racing gears
    • Aftermarket underdrive pulleys


    Now to illustrate let's say you want to add more fuel to gain more horsepower. You will have several problems with just this one modification.
    • The stock pump or OEM pump may not be able to deliver the requested pressure
    • The stock injectors may not be able to handle the increased pressure
    • Since more pressure does not always equal more volume and more pressure does not always equal more atomization, it is possible the fuel will not atomize correctly in the cylinder.
    • If the air/fuel ratio is not correct you could run too lean and destroy the spark plugs or you could run too rich. Either way this increase in fuel != increase in horsepower because engine efficiency goes down the tubes.
    • Simply adding more fuel may cause a condition known as detonation. This is a condition in which the fuel ignites before the spark plug fires and is essentially like lighting off a firecracker on top of your piston. This will destroy your engine. The pressure from the fuel igniting will be pushing down on the piston..and thus the crankshaft, but the piston is being pushed up by the momentum of the crankshaft. Not a good situation. Also we are only talking about one cylinder. If all cylinders detonate and may if you increase the overall ECU fuel requests since the fuel pump feeds the entire engine....you will have a very bad day.
    • The increased fuel may cause cylinder pressures to exceed the OEM or stock head gasket ratings. You have static pressure and dynamic pressure. While the static pressure is determined by engine components such as piston and head design, dynamic pressure is determined by what is 'added' to the equation. For instance if you add a turbo you will increase dynamic pressure since you are adding compressed air. 1 atmosphere is equal to about 14.7 PSI. My Dodge Neon SRT4 will boost at 15 PSI giving it a max boost of about 1 atmosphere. Note that 1 atmosphere is already in the cylinder and I'm adding another atmosphere at max boost. If the compression ratio of the piston is extremely high the added pressure of the boost may exceed the max pressure rating of the head gasket. If this is true it will blow the head gasket as well as place excess strain on the valve train components, piston, connecting rod, crankshaft, clutch components(OEM clutches rarely can handle any modifications to horsepower), flywheel, transmission, etc. Adding fuel can also increase dynamic pressure to a point since you get a bigger bang for your buck.
    • Adding horsepower to a stock car may place excess strain on the CV axles (if equipped), suspension components (since they must deal with putting and keeping the extra power down on the ground), driveshaft (if equipped), differential (if equipped), etc.
    • Adding horsepower to a stock car may cause a front wheel drive car to experience torque steer so bad the car may be impossible to control. I've been in cars that were overpowered and literally would steer into the left lane during acceleration. Not good. Wheelspin was terrible.
    • The fuel filter may not be able to filter the new volume of fuel (given that your new pressure does result in more volume) and may need to be replaced with a higher flowing filter.


    There are more side effects that could happen by changing fuel input. For this reason most forums recommend keeping the stock fuel programming in the ECU as is unless you really know what you are doing. You can buy a higher flow pump but if your computer never requests more fuel it won't do much good.

    Modding a car is possible and is done everyday by people worldwide, but you'd better know what you are doing or know someone who does. The ECU code is about the LAST place you would start. Now adding a performance chip programmed by professionals who know what they are doing is just fine. Coding your own is not a good idea.
    An automobile is a system and in order to produce a more efficient system it requires looking at the system as a whole and not just one or two components.

    Now my Neon SRT 4 can be upgraded via a chip but that is because it is ready for this from the factory. It already has stage 1 injectors from the factory floor and the pump can handle the new pressures. As well the rest of the engine is tuned rather well and can handle the new settings. But I could not handle a stage 2 ECU with my current components. I would need to change quite a few engine components before upgrading to a stage 2 ECU, not to mention I may have to move to using 100 octane fuel which means buying a new catalytic converter....or ditching it altogether......thus making it illegal on the street. Anything above a true MOPAR stage 1 Neon SRT4 is not street legal.
    Last edited by VirtualAce; 09-12-2007 at 02:53 AM.

  13. #13
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by Bubba
    This statement makes no sense. Since each piston is connected to the crankshaft via connecting rods this means that the RPM of the crankshaft represents the true RPM of the engine. Also since the up/down motion of the piston is transferred to the crankshaft and converted to a rotary torque it makes no sense to say the RPM of the pistons. Pistons do not have RPM but they do create RPM. Now you could compute the velocity of the pistons in the cylinders but I doubt this figure would mean much. If you want more horsepower you generally need either more air, more fuel, more displacement and thus more power, or a combination of those.
    Sorry I don't know much about cars , I guess I should keep my mouth shut.

  14. #14
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    I know what processor would be good:
    http://www.dailytech.com/article.aspx?newsid=8577
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  15. #15
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by maxorator View Post
    I know what processor would be good:
    http://www.dailytech.com/article.aspx?newsid=8577
    But it would probably be better to us a device that has some I/O capabilities and perhaps a built-in memory controller...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Frustum cull is too accurate
    By VirtualAce in forum Game Programming
    Replies: 12
    Last Post: 01-25-2006, 12:35 PM
  2. A Common Scientific Belief
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 03-29-2002, 05:54 PM