The BS2 as a fuel injection ECU?
Wynand
Posts: 39
I am a newbie, but having said that have some experience with programming and electronics. I have an idea to use the Basic Stamp·2 as a Electronic Control Unit to·drive·a fuel injector on a small gasoline engine. I would have to interface it with a (home built) air mass sensor, RPM sensor, and the·fuel injector itself.·I was thinking that the process control would run something like this :
·· Check engine running
···Wait for valve open indication (crankshaft at right position to inject fuel)
·· Read Air·mass sensor (to determine how long to open fuel injector)
···Read·engine load sensor (to determine if more fuel is needed)
···Look up fuel injector timing according to mass sensor data and engine load (data table made up from physical experiments with engine to get·stoichiometric data)
···Send pulse to fuel injector
I have most of the stuff in my head, and am trying to get it onto paper, so that I can start to fabricate and engineer.
So sorry, I have a BSP2, with the board of education.
I would appreciate to hear from the community, and I welcome any and all suggestions, comments and criticism
·· Check engine running
···Wait for valve open indication (crankshaft at right position to inject fuel)
·· Read Air·mass sensor (to determine how long to open fuel injector)
···Read·engine load sensor (to determine if more fuel is needed)
···Look up fuel injector timing according to mass sensor data and engine load (data table made up from physical experiments with engine to get·stoichiometric data)
···Send pulse to fuel injector
I have most of the stuff in my head, and am trying to get it onto paper, so that I can start to fabricate and engineer.
So sorry, I have a BSP2, with the board of education.
I would appreciate to hear from the community, and I welcome any and all suggestions, comments and criticism
Comments
If you can live with all of that, you can do it, but I doubt you can live with all of that. An ECU is kind of a real 'real-time' application. Probably requires WAY more processor speed than the BS2 has.
The SX52 processors can be used, though.
Ok, so here is my feedback to your comments.
1.) the BS2 runs at 4000 instructions per seccond, or so I am to believe from their website and data sheets.
2.) the engine only operates at 3000 rpm (max) and that means that the time between fuel cycles is 0.04 secconds. (40 ms).
3.) the injector timing could be doen with the pulsout command, since we are looking at milliseccond timing due to the pressure in the fuel line and the size of the injector.
4.) I am sure that the entire program can cycle in 0.04 secconds, after all, it is a point to point instruction set to be followed.
5.) valve open timing is just a simple hall efeect sensor on the fly wheel f the engine, to tell the stamp when to start the whole cycle.
6.) yes, and no. I was thinking, how fast can a RCtime command be run? That should do for both the air mass and for the egine load.
Ok, so that is me all done, but please, keep the comming......
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why didn't I think of THAT!!!!
The instruction execution speed is not based on statements. A given statement may result in any number of instructions depending on the complexity of the statement. That reduces the effective statement execution speed that you might be thinking in terms of.
There is a significant downside to missed events or mis-timed events. The engine can misfire or run rough at the least.
The Propeller has enough processing power to do this sort of thing very well. It can do the analog to digital conversions by itself (with a couple of passive components) and do extremely accurate multiple timings. The Stamp is marginal at best unless you offload the more demanding functions.
OK, I understand your comments. I did a little reading and I think it could work. (a project to be done just because it is there)
I totally agree with you on the timing issue, but with at the least 40 milliseconds to work with, and a straight forward top to bottom approach to programming, I think that it could be done.
Sorry that it sound as if I am just spouting the same lines over and over again, but I really believe that the Stamp2 can do it for a one cylinder engine running up to a maximum of 3000 rpm.
I thank you for your comments, but I think I will foolhardy stammer into the continuum that is stamp programing. Later, wen I have hit my head more that the prerequisite amounts of time I think I will bow down to your knowledge of trail and error and experience, and follow to the propeller chip. If the stamp doesn't work.
But like I said, if any body (including you Mike) have any suggestions and comments and criticisms, please let me know.....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why didn't I think of THAT!!!!
Actually, the lack of interrupts shouldn't be a problem. The engine cycle is just that. It repeats constantly with events occurring in order. There's really nothing to interrupt this cycle. Any events that might force some action can be worked into the same cycle and need not be serviced instantly. My main concern is that some kinds of actions (like issuing a control pulse or reading various sensors as resistors) take considerable time to perform if the Stamp does them itself and there might not be enough time left in the cycle for other control code to execute. This is easily solved by offloading the timekeeping for the pulses and/or using a simple external analog to digital converter for the sensors (like an ADC0834).
I like the way you are thinking, that is exactly what I had in mind, the stamp is just the brains behind the whole operation, and the menial stuff like the reading of sensors can be left to 'dumb' (not literary, but in terms of the BS2) devices such as the ADC0834. Then all that is left for the stamp is to decide exactly how long the injector should be held open. So all the stamp has to do is to read the ADC0834 when it needs, and then continue with the rest of the cycle. Based on preliminary calculations, the longest time the injector would have to be open is 0.005 seconds, giving the engine the most gasoline that it can stoichiometrically use.
So gents (and ladies) that is my plan, please don't stop with the suggestions, and comments, I need all the constructive criticism that I can get......
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why didn't I think of THAT!!!!
You could use a external PWM curcuit to drive your injector and then have the stamp sed it update signals only when a change is needed so the BS2 is not slowed down by the Pulseout or PWM command. It should only cost a little to build a PWM curcuit and then use another Micro like the SX to control it or a simpler design you could use a digital pot to control the PWM curcuit to control the injector. I have some simple curuits I can suggest..also I would like to build a EFI engine here at my shop so let me know what type of engine you plan to use...
I want to use a Honda GX160 engine for my initial experiment, just because it is a very easy engine to take apart. Actually, any old single cylinder engine would do, I happen to have a new GX160 lying around doing nothing (except tempting me). It is rated at 3000 RPM (optimum) and to tool a new intake manifold to accept the air mass sensor will be easy to make. The injector I have is from a Toyota 2.7i 4x4 truck, so it should do nicely, not have to be open for very long, because the makers tell you have to have a 50% duty cycle (50% of the time open and 50% of the time close) otherwise the injector overheats and damages the internal coil.
Enough about my parts pile. A soon as I have the GX160 working, I would like to update my quad bike to EFI, just because it can be done.
So o summarize, the Honda engine will be the prototype to bigger and better things, and I will share any and all knowledge with you. I was thinking of using a ATmax48 as the muscle, and he stamp just as the brains of the operation.
All ideas welcome people........
Wynand.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why didn't I think of THAT!!!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I have some 555 curcuits that work like that but a dual nand gate curcuit Beau gave me works very well for Digital pot and PWM and is 100% duty capable. The Sx could be used the same way and it could talk to the BS2 with serial instead of the digital pot having to be used which is just more parts..
If I was going to make this work I would use a MAP sensor for manifold pressure readings and a hall effect sensor for RPM. Then make a table to have the PWM change compared to data the sensors read. This is want Chevy used on its TBI systems.
They also use temperature sensors to change Idle quality at different temps which could be added later.
Do you plan to use something like a IAC (Idle air Control) to change the minimal throttle setting? on the cheap you might use a servo..
I like this project keep it comming...I am still looking for a cheap motor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I think Nick and the other in here are just interested in making it work on a small engine first then working to a larger scale with a better charging system and more cylinders with maybe even upgraded electronics on the way to an open source EFI. I have a we sight you can get a motor from on the cheap if you plan to spend 200 dollars Nick..
http://www.surpluscenter.com/sort.asp?UID=2007051523063801&catname=engines&keyword=NEGH
Good luck...
the simplest form is alpha n, which basically i a throttle position and fuel pressure system, they work fairly well for flat out power (racing), but require
all sorts of tweaking to tune in for temp changes, baro pressure etc. they also are not known for good and reliable idle or part throttle .
the map system is a step up in my opinion, basically with a manifold pressure sensor you can determine engine load and tailor the fuel rate for
idle, part throttle and full throttle and various loads.
mass air flow systems are a step above the map systems, and more complex.
if it were me i would work toward the map system, using as many of the gm components as you can, they are readily available and cheap
and work off of a 5 volt system
the ford style mass air systems use pwm schemes and work well but are more complex in my opinion.
i guess it all comes down to what you want to do.
several years ago i worked up an alpha n system (full mechanical) to fuel a caddy 500, but lost interest because of the complexity and a divorce [noparse]:)[/noparse]
with the stamp or maybe a couple of stamps i might revisit the possibility of finishing the project
ideally i would love a system useing 4 single throat tbi off of 4 bangers on a sheetmetal intake for the 500
that would be killer [noparse]:)[/noparse]
if i could get it to great wot performance i would happily sacrifice some idle quality or mid range drivability.[noparse]:)[/noparse]
neat project
bob g
Anywho, I've used a BS2 for a high speed servo loop before. It was just running relays to provide crude positioning while checking for a stalled motor. I eventually got the servo loop running at 70Hz. The code is NOT pretty. every cycle through the loop checks one of two RC command pulse inputs, (the sync point) does a quick RC time, does a 1ms count of pulses from a hall sensor, then updates the state machine and relay outputs. (it also toggles a pin so I can measure the execution rate) So, I'd say that if an external ADC is used for sensors a BS2 will be able to keep up with what you've described.
Even with all that I still second Mike's recommendation to use a Propeller. Processor overkill is a GOOD thing. Having everything work the first time at full speed would've saved me a lot of time wasted developing code.
my two cents,
Marty
I am with you I have a V8 truck I would like to make a custon EFI on. I also have Visual studio and could work up a GUI interface to tune our EFI.
I like the SX and think it could be used as a coprocessor working with a BS2 or another SX as the main CPU. A propeller is still real new to alot of the guys interested in this project.
Post Edited (bennettdan) : 5/16/2007 10:10:16 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why didn't I think of THAT!!!!
Please take some pictures of you Honda motor and post them. I have a pretty good fab shop and might help out with an aluminum intake just buy the EFI bung and send me your old intake and what you plan to use as a throttle body and then we can go from their.
What do you plan to use as a throttle body? Something small like off a EFI motorcycle? anyone know of any small throttle bodies out their?
I will post some code that works with the PWM circuit I have and will also post the diagram of the hardware it uses a digital pot and a couple of nand gates to make the PWM and it will maintain its position untill the BS2 tells it to change so you only update it if it needed instead of generating the pulses all the time.
Post Edited (bennettdan) : 5/17/2007 9:04:12 PM GMT
I was planning on using the existing butterfly from the carburator installed in the new intake as the throttle body. Since it is already the perfect size, and all that is needed is to position it in the center of the new intake with two bushes. I will post the pictures of the engine a little later today (straight after work). It is realy a very small and simple little engine. easy to work on. I am very interested in your code............
Wynand.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why didn't I think of THAT!!!!
·· Here is a curcuit that you can use the BS2 to set the digital pots wiper to maintain the PWM duty cycle on the injector this is a modified motor circuit running at 20khz you really dont need that to drive the injector you the cap values could be less..
The code I have not rewrote to work but the WAM text has examples on how to control the Digital Pot which controls the PWM.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why didn't I think of THAT!!!!
It will be hard to find an Injector to run a real small engine like the honda you have and the BS I have but you can run it at a lower duty cycle and lower gas pressure and it still might get by. I have found some 9.6lbs/hr fuel injectors from Bosch part# 0-280-150-997 so if you figure a (9.6lbs/hr*.85)/.50 then it is for a max of 16.32hp I think my 5hp motor might not be big enough to run with even the smallest injector I can find but I might cut back on the fuel pressure and run a less than 85% duty cycle and if it wont work I have an old riding lawn mower with a 18hp BS engine on it I might use....
I guess you are right, my injector was made for a 675cc (2.7liter / 4 = 0.675 liter) engine, and now I will be running it on a 160cc engine, one quarter of original, so I guess I will have to cut back on the duty cycle and the fuel pressure. I have to admit that I haven't yet looked at the specs (Japanese brand injector, me a little lazy [noparse]:([/noparse] ) so Do not as yet know the flow capacity of the injector. I will make work of it today, just as soon as blue monday-work-headaches pass....... In my fever to get this project going, I clean forgot about the fuel pump, as soon as I am home I will rummage in the scrap yards to find a cheap seccond hand one, since new ones run to about (N$3500.00) in my country. Since you are mentioning it, I might also get my hands on a 18hp engine from a Hobart welding machine. Those engines are almost indestructible!!!!!!
I was absolutely facinated by your circuit diagram, so simple, so practical.....
Wynand.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Why didn't I think of THAT!!!!
The circuit to make the PWM with the 74hc132 nand gates was give to me by Beau and I added the digital pot I had in a WAM parts kit and then used it to control a DC motor but the injector will work fine off this I believe.
I have an old Chevy truck with a TBI injection system I am going to tr this comming week to get my oscope hooked to the injectors all look at the signals. I also plan to look at the map sensor readings and see how it works. I have a good set of prints on this pickup so this might help us ou and I can take live voltage