Thread: Small Engine ECU, EFI Moped Using An Audrino UNO

  1. #1
    Registered User
    Join Date
    Jan 2012
    Location
    Las Vegas, NV
    Posts
    9

    Lightbulb Small Engine ECU, EFI Moped Using An Audrino UNO

    After some days of thinking about electronic fuel injection for a moped, ive decided to take it on. Parts come up to $80, and the rest is programming. I have never before programmed in c, c++, java, nothing! I'm quick to adapt and learn, might make some rookie mistakes but heres what I have so far. I'm programming for an Audrino UNO Board so really limited program space, but definitely doable at 300,000 cps hardware wise. ( I know spacing is atrocious but I've only been learning for 8 hours now, lol)

    So Heres the question: I do not know where to begin with the loop program, I need pin6 to fire after every other highlow reading on A0. on top of that, simultaniously, i have to monitor pin A2 for a integer optimal reading of around 65 (each integer from the A/D converter is = to 4.9milli volts) int range of the A/D converter is 0-1023. if the reading is not 65, then the engine is running too lean or too rich. should i use an "if do" statement, and how would I have the program adjust the pulse width (on/off time) of the fuel injector to the right amount? would i have to make a int table, and do a little R/D as to how long with an int reading of 65 on pin A2 the solenoid opens? I don't even know what i should startoff with. below is the boot up to prep and start the engine with everything warmed up and primed

    Code:
    /*Goal is to manage the fuel system of a small displacement gasoline engine
    using an open loop system, only anaylzing the exhaust gases through an O2 sensor.
    The object is to have Audrino anaylze the voltage readings of the O2 sensor and adjust
    the pulse width of the fuel injector to control the amount of fuel entering the engine.
    Audrino has to be self correcting, and quick to adapt to different engine displacements of a
    small range. The timing mechanism will be an analog magnetic pickup coil. The injector needs
    to fire every other pass of the magnet on the flywheel
    Pin labels
    3=O2 Sensor Heater
    4=Ready to fire LED
    5=fuel pump
    6=fuel injector solenoid
    7=starter solenoid
    8=warning LED, engine not ready
    A0=RPM sensor
    9=O2 sensor input
    */
    
    
    void setup()
    {  
        digitalWrite(3,HIGH);    //Turns O2 Sensor Heater On
        while(3,HIGH){digitalWrite(8,HIGH);delay(1000);digitalWrite(8,LOW);delay(1000);}
        digitalWrite(5,HIGH);    //Activates Fuel Pump
        delay(3000);             
        digitalWrite(6,HIGH);    //Fuel injector primes engine
        delay(500);             
        digitalWrite(6,LOW); 
        delay(10500);           //delay for the 02 sensor to finish warming up
        digitalWrite(3,LOW);
        digitalWrite(4,HIGH);   //Indicates Engine is ready to fire
        digitalWrite(7,HIGH);   //turns engine over
        delay(5000);            
        digitalWrite(7,LOW);    //Kills Starter solenoid
        analogRead(0);          //sets A0 to read engine RPMS
        analogRead(9);          //reads o2 sensor voltage level
    }  
    void loop() 
    {
    }
    Last edited by Sean Armstrong; 01-26-2012 at 02:25 AM. Reason: forgot to put the question i had in there

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Sean Armstrong View Post
    So Heres the question: I do not know where to begin with the loop program, I need pin6 to fire after every other highlow reading on A0. on top of that, simultaniously, i have to monitor pin A2 for a integer optimal reading of around 65 (each integer from the A/D converter is = to 4.9milli volts) int range of the A/D converter is 0-1023. if the reading is not 65, then the engine is running too lean or too rich. should i use an "if do" statement, and how would I have the program adjust the pulse width (on/off time) of the fuel injector to the right amount? would i have to make a int table, and do a little R/D as to how long with an int reading of 65 on pin A2 the solenoid opens? I don't even know what i should startoff with. below is the boot up to prep and start the engine with everything warmed up and primed
    First you need the basic structure of your program. I like to do that with words first, before programming begins:
    Code:
    initialize engine
    while i want to keep running
        do a reading
        if it's time for an A2
            do something if it's too rich or too poor
        otherwise if it's not time for an A2
            do whatever it is you do
    Just something like that, to get an idea of how it's actually supposed to work. (Normally I'd try to write out a full working description of what I want to do, but you've basically done that.) The above is basically the pseudocode step. It's not really code, but it resembles it roughly, so I can get an idea if it looks good.
    Code:
    int main( void )
    {
        setup(); /* have setup defined some place */
        while( some_condition )
        {
            readpins();
            handlepins();
        }
        return 0;
    }
    Now of course you may need to return some appropriate values from those functions, or pass them arguments, or what have you, but that's a general idea of how I'd work it out.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Awesome project! You say moped, which I imagine as a bicycle with a small motor. Do they come with electric starters now or do you mean a scooter, like a little Vespa or something? Is there a throttle and throttle body, or just a "dumb" air intake with no speed/power control? The ECUs would be wildly different. A few general notes:

    • Sensors aren't always linear. Look at the specs for the O2 sensor and make sure you properly adjust for readings that are farther away from your ideal reading of 65. If it's non-linear, a lookup table with some simple interpolation would be good here.
    • Look at your injector, fuel pump specs and throttle body specs. You will need to know the pressure of your fuel pump, the open and close time of the injector and it's flow rate at that pressure to figure out how much fuel you're getting.
    • You will need to know the flow rate of your throttle body or intake manifold or whatever to know how much air you're getting.
    • You want a ratio of a little more than 14:1 air:fuel (by mass, not volume or whatever).
    • I've never used a analog mag pickup, at least not one that spits out engine speed. I'm used to something like a missing tooth on the flywheel that makes a pulse in the mag pickup. If that's how your pickup works, you probably need to digitize that signal and tie it into one of the interrupt pins on your board. I'm no electrical engineer, but a high pass filter, a Schmitt trigger and a few resistors to get you in to the right logic levels would probably be enough for your moped.
    • Some of the delays in your setup function seem way too long, particularly the fuel pump, and the starter, and maybe the O2 sensor. I'm not familiar with whatever moped/engine you have, and I don't know what sensors, etc you have, but it just seems long to me.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Quote Originally Posted by Sean Armstrong View Post
    ...
    So Heres the question: I do not know where to begin with the loop program, I need pin6 to fire after every other highlow reading on A0. on top of that, simultaniously, i have to monitor pin A2 for a integer optimal reading of around 65 (each integer from the A/D converter is = to 4.9milli volts) int range of the A/D converter is 0-1023.
    What kind of micro are you using for doing this and can you post a schematic?
    Quote Originally Posted by Sean Armstrong View Post
    if the reading is not 65, then the engine is running too lean or too rich. should i use an "if do" statement, and how would I have the program adjust the pulse width (on/off time) of the fuel injector to the right amount? would i have to make a int table, and do a little R/D as to how long with an int reading of 65 on pin A2 the solenoid opens? I don't even know what i should startoff with. below is the boot up to prep and start the engine with everything warmed up and primed
    How about an interrupt service routine (ISR) which is executed everytime reading == 65?

  5. #5
    Registered User
    Join Date
    Jan 2012
    Location
    Las Vegas, NV
    Posts
    9
    Quote Originally Posted by quzah View Post
    First you need the basic structure of your program. I like to do that with words first, before programming begins:
    Code:
    initialize engine
    while i want to keep running
        do a reading
        if it's time for an A2
            do something if it's too rich or too poor
        otherwise if it's not time for an A2
            do whatever it is you do
    Just something like that, to get an idea of how it's actually supposed to work. (Normally I'd try to write out a full working description of what I want to do, but you've basically done that.) The above is basically the pseudocode step. It's not really code, but it resembles it roughly, so I can get an idea if it looks good.
    Code:
    int main( void )
    {
        setup(); /* have setup defined some place */
        while( some_condition )
        {
            readpins();
            handlepins();
        }
        return 0;
    }
    Now of course you may need to return some appropriate values from those functions, or pass them arguments, or what have you, but that's a general idea of how I'd work it out.


    Quzah.
    Okay, basically i need something that works like this:
    Code:
    void loop() 
    {
      if{A2=int65};
      (keep pulse width on pin6 the same)
      else{A2<65}
      (increase pulse length on pin6)
      else if{A2>65}
      (decrease pulse length on pin6)
    }
    im not familiar on how to define an input as an integer, get the program to take in the integer number, and depending on the reading, change how much longer or shorter the fuel injector needs to pulse, plus how to get the program to take in the adjusted number and only make the injector fire every other rotation

  6. #6
    Registered User
    Join Date
    Jan 2012
    Location
    Las Vegas, NV
    Posts
    9
    Quote Originally Posted by anduril462 View Post
    Awesome project! You say moped, which I imagine as a bicycle with a small motor. Do they come with electric starters now or do you mean a scooter, like a little Vespa or something? Is there a throttle and throttle body, or just a "dumb" air intake with no speed/power control? The ECUs would be wildly different. A few general notes:
    • Sensors aren't always linear. Look at the specs for the O2 sensor and make sure you properly adjust for readings that are farther away from your ideal reading of 65. If it's non-linear, a lookup table with some simple interpolation would be good here.
    • Look at your injector, fuel pump specs and throttle body specs. You will need to know the pressure of your fuel pump, the open and close time of the injector and it's flow rate at that pressure to figure out how much fuel you're getting.
    • You will need to know the flow rate of your throttle body or intake manifold or whatever to know how much air you're getting.
    • You want a ratio of a little more than 14:1 air:fuel (by mass, not volume or whatever).
    • I've never used a analog mag pickup, at least not one that spits out engine speed. I'm used to something like a missing tooth on the flywheel that makes a pulse in the mag pickup. If that's how your pickup works, you probably need to digitize that signal and tie it into one of the interrupt pins on your board. I'm no electrical engineer, but a high pass filter, a Schmitt trigger and a few resistors to get you in to the right logic levels would probably be enough for your moped.
    • Some of the delays in your setup function seem way too long, particularly the fuel pump, and the starter, and maybe the O2 sensor. I'm not familiar with whatever moped/engine you have, and I don't know what sensors, etc you have, but it just seems long to me.
    Its more like a vespa, just modernized. the newer scooter/mopeds have a vaccum advance carbuereator, electronically controlled ignition via a CDI box, which measures pulses off the magnetic pickup coil, kindof the opposite of what your used to, with a hall effect sensor. Then sends a charge from a capacitor to a step up coil to make the spark plug "spark".
    Im working on prototyping a new intake system, which would roughly be a metal tube with a butterfly valve controlling air flow, and the fuel injector attached right next to the head, psudo throttle body. The specs from delphi say an ideal reading would be around 320mv, which is a slightly more rich reading of say around 14.5:1. a lower voltage means too rich, and a higher voltage would mean too lean. the board converts analog signals to digital signals as long as you define the input as an integer, each single integer would mean a defference of 4.9mv from the last one. so an int of 65 from pin A2 would be close to 320mv, and a reading of 66 would mean a reading of 324.9 ect ect. im hoping to not have to monitor the intake vaccumm or mass by only monitoring the output of the engine to change what goes in. the whole fuel pump delays aand all are just to build pressure of around 30psi for the injector to work properly. the rest of the delay is for the O2 sesor to heat itself up completely to give an accurate reading once the engine starts to turn over. Logic voltages on the board are 0v for low, 5v for high. the analog converter will digitize the 1.3v reading of the mag pickup to 5v. anytime the magnet on the flywheel isnt passing beneath the coil, there is no voltage reading. Theoretically it should work, i think....

  7. #7
    Registered User
    Join Date
    Jan 2012
    Location
    Las Vegas, NV
    Posts
    9
    Quote Originally Posted by itCbitC View Post
    What kind of micro are you using for doing this and can you post a schematic?

    How about an interrupt service routine (ISR) which is executed everytime reading == 65?
    Never heard of an ISR, how does that work?
    do you need a schematic of the "ECU" board, or the whole system setup? I have both

  8. #8
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Quote Originally Posted by Sean Armstrong View Post
    Never heard of an ISR, how does that work?
    Well you can read about 'em here!
    Quote Originally Posted by Sean Armstrong View Post
    do you need a schematic of the "ECU" board, or the whole system setup? I have both
    Yep! it'd be nice if you could post both the schematics. Never worked with an Audrino UNO board, so not sure what micro or compiler it uses.
    Last edited by itCbitC; 01-27-2012 at 01:44 PM. Reason: Added tags

  9. #9
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Sean Armstrong View Post
    Okay, basically i need something that works like this:
    Code:
    void loop() 
    {
      if{A2=int65};
      (keep pulse width on pin6 the same)
      else{A2<65}
      (increase pulse length on pin6)
      else if{A2>65}
      (decrease pulse length on pin6)
    }
    im not familiar on how to define an input as an integer, get the program to take in the integer number, and depending on the reading, change how much longer or shorter the fuel injector needs to pulse, plus how to get the program to take in the adjusted number and only make the injector fire every other rotation
    Well basically you should have some way to get values from whatever you are reading. Just like you are able to send values. Looking at your first post:
    Code:
        analogRead(0);          //sets A0 to read engine RPMS
        analogRead(9);          //reads o2 sensor voltage level
    Those read apparently, so I'm assuming then that there is a variable already declared some place, that ends up getting the result of that. You just need to find out what it's called, and compare it to whatever you expect.
    Code:
    void loop( void )
    {
        int everyother = 0;
        while( 1 )
        {
            if( everyother ) 
            {
                analogRead( SOMEPIN );
                if( WHATEVER < 65 ) /* to use a constant integer value, just put the value like so */
                    increase( PIN6 ); /* however you do that, and according to whatever formula you have */
                else
                if( WHATEVER > 65 )
                    decrease( PIN6 ); /* as per above */
                /* else it is 65, so don't do anything */
            }
            everyother = ! everyother; /* flip this from 0 to 1 or 1 to 0 */
            /* do you need a delay here? */
        }
    }
    Basically you're looking at something like this. WHATEVER is whatever you have that stores the values you've just read from your analogRead.


    Quzah.
    Hope is the first step on the road to disappointment.

  10. #10
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Sorry, this turned out to be quite a long-winded reply!

    Quote Originally Posted by Sean Armstrong View Post
    Its more like a vespa, just modernized. the newer scooter/mopeds have a vaccum advance carbuereator, electronically controlled ignition via a CDI box, which measures pulses off the magnetic pickup coil, kindof the opposite of what your used to, with a hall effect sensor. Then sends a charge from a capacitor to a step up coil to make the spark plug "spark". Im working on prototyping a new intake system, which would roughly be a metal tube with a butterfly valve controlling air flow, and the fuel injector attached right next to the head, psudo throttle body. The specs from delphi say an ideal reading would be around 320mv, which is a slightly more rich reading of say around 14.5:1. a lower voltage means too rich, and a higher voltage would mean too lean. the board converts analog signals to digital signals as long as you define the input as an integer, each single integer would mean a defference of 4.9mv from the last one. so an int of 65 from pin A2 would be close to 320mv, and a reading of 66 would mean a reading of 324.9 ect ect. im hoping to not have to monitor the intake vaccumm or mass by only monitoring the output of the engine to change what goes in. the whole fuel pump delays aand all are just to build pressure of around 30psi for the injector to work properly. the rest of the delay is for the O2 sesor to heat itself up completely to give an accurate reading once the engine starts to turn over. Logic voltages on the board are 0v for low, 5v for high. the analog converter will digitize the 1.3v reading of the mag pickup to 5v. anytime the magnet on the flywheel isnt passing beneath the coil, there is no voltage reading. Theoretically it should work, i think....
    You can control the engine solely from the O2 sensor, but it's not going to work very well. The O2 sensor just isn't responsive enough, and it's happening after the fact. It will work well enough in steady state, like idling or cruising with the throttle at a fairly constant position. As soon as you open or close the throttle much, or go up or down hill, your control system will start to break down. You need some "before the fact" controls. The O2 sensor should be used in addition to your main control system, which is currently the carburator. The carb that's on there now adjusts the fuel rate based on your throttle position through metering rods and complicated little fluid tunnels, and it probably has an accelerator pump that dumps extra fuel in there when you crank the throttle hard to accelerate quickly. Your throttle body and EFI system should try to replicate this.

    I would say the bare minimum for a good control system would be throttle position, air flow and O2, though air flow may not be practical in your little scooter. Your main control loop adjusts fuel rate based on the air intake and throttle position. The O2 sensor is used to trim that up or down depending on how rich/lean you're running. The throttle position sensor (TPS) is also used to detect large changes in throttle position, for quick acceleration or returning to idle. If you go from idle to wide-open throttle, you need to open the injectors extra long to simulate the accelerator pump, or as you let the engine spin down naturally, you only need the bare minimum of fuel. You could hook up a simple potentiometer to your butterfly valve and tie that into one of your analog inputs as a crude TPS. Most fancier ECUs use two sensors for measuring air intake, manifold absolute pressure (MAP) and manifold air flow (MAF). I think both sensors are always used, but under different conditions you rely on one more than the other. IIRC, the MAP is used more for idle and low speeds when air isn't being forced into the throttle body by the movement of the vehicle. The MAF is relied on more at higher speeds, though the MAP is still used as it helps correct for altitude and ambient temperature, which affect the density of the air. I think they're fairly expensive, and will probably be tough to fit onto your custom throttle body. You could possibly just take some air flow measurements for your throttle body based on how open the butterfly valve is, and take your best guess at air flow based on the TPS. You can keep the previous reading and the current reading of the TPS to detect how big the change was, in case you need to inject extra fuel.

    The sensor on the flywheel (crank position sensor, CPS) sounds like what I'm used to, a simple Hall effect sensor. I misunderstood your initial post, and thought you had some sensor that gave a varying analog reading that corresponded to engine speed, e.g. 0V = 0RPM, 3V = 4500RPM, etc. Whether a missing tooth or a magnet, it's all about the same. The CPS generates a pulse (or lack of pulse) that at a fixed point in the engine's rotation, and is usually expressed as being some number of degrees before/after top-dead-center (TDC). The engine specs should tell you in degrees from TDC when each cylinder is on which part of the combustion cycle, so you know when to inject fuel (in direct-port or multi-port injection) and when to fire the spark plugs. The CDI box does exactly that for the spark. Lucky for you, since you're doing throttle body injection, you don't really have to worry about timing your injector. In fact, many of the first fuel injection systems on cars were throttle body injectors that constantly sprayed fuel, varying the pressure or flow rate to the injector based on the air intake amount. There was no timing involved. You can if you want, however, only open the injector when the cylinder is on it's intake stroke, or probably just before. This would require a bit more tuning, but would probably result in better fuel efficiency and possibly tighter control of the fuel/air mixture meaning better efficiency. That should be good for a 1 cylinder engine, but I'm not sure how practical this is if you have 2 cylinders. Putting this on an analog input or A/D converter is probably not the best way to get your pulse though. That signal has to be converted to a digital value, which is much slower than running it through some logic gates, and you'll have to do more work at the code level to read the analog signal and make sure it's a large enough value to constitute a pulse, and not just noise you're detecting. Besides, I'm not sure if the Uno will let you trigger an interrupt on an analog signal.

    As for the delays, right now, from the moment you start your scooter to the time it's ready to go, you have to wait nearly 20 seconds, which is a really long time. Half of that is the O2 sensor warming up. I would turn it on and record the current time as reported by the millis() function, and have something in your main loop periodically check the millis() function and if >= start_time+10500, and turn off the O2 sensor heater there. I might not even bother warming the thing up until the engine is running. That also goes along with not using the O2 sensor as your only or primary source of control. You probably don't need to wait 3 seconds for the fuel pump to build pressure. I think half a second there would be good. Also, don't just crank the engine for 5 seconds. Turn on the crank and grab the millis() reading. Then keep polling in a loop and if you detect the engine starts up (perhaps by checking the CPS), or you've been cranking for 5 seconds, stop the starter. Repeat 3 or 4 times, and if you don't get an engine start, then give up, you'll kill the battery and starter motor otherwise.

    You probably want the bare minimum in your setup() function, like configuring the A/D converters, which pins are inputs and output, etc, and save all the actual ECU logic for a big state machine in your main loop. Here's the rough approach I might take:
    Code:
    void setup()
    {
        set A/D converter and GPIO
        mode = pre_start
    }
    
    void loop()
    {
        curr_time = millis()
        
        read sensors
        
        switch (mode)
            case pre_start:
                crank_count = 0
                enable fuel pump
                delay 500ms
                mode = try_crank
                
            case try_crank:
                open injector
                enable starter
                crank_stop_time = millis() + 5000    // try to crank for 5s
                crank_count++
                mode = continue_crank
    
            case continue_crank
                if engine_speed > 500 // some number significantly faster than the speed the starter cranks at
                    // engine started, it's spinning at idle speed
                    disable starter
                    enable O2 heater
                    o2_heater_enabled = true
                    o2_heater_stop_time = millis() + 10500
                    mode = engine running
                else if curr_time >= crank_stop_time
                    close injector
                    disable starter
                    crank_stop_time = millis() + 5000    // give the starter a 5s break from cranking
                    mode = pause_crank
                // else, we just stay in this mode and come back here
                // to check if we started up or not
    
            case pause_crank:
                if crank_count > 5
                    can't start engine, bail out
                else if curr_time >= crank_stop_time
                    // break's over, back to work
                    mode = try_crank
                    
            case engine_running:
                if (o2_heater_enabled && curr_time >= o2_heater_stop_time)
                    disable heater
                    o2_heater_enabled = false
                // here is where your control code goes
                
            case error:
                stop fuel pump
                close injector
                disable O2 heater
                disable starter
                // just stay here until the system is reset somehow
    }

  11. #11
    Registered User
    Join Date
    Jan 2012
    Location
    Las Vegas, NV
    Posts
    9
    Quote Originally Posted by itCbitC View Post
    Well you can read about 'em here!

    Yep! it'd be nice if you could post both the schematics. Never worked with an Audrino UNO board, so not sure what micro or compiler it uses.
    Heres the arduino development page:
    Arduino - HomePage

    Heres the board schematic
    http://arduino.cc/en/uploads/Main/Ar...-schematic.pdf

    Heres a distributors site with the board i have in mind
    Arduino Uno - R3 - SparkFun Electronics

    Heres a compiler with debugging built in, very nice. Made specifically for programming arduino
    Arduino - Software

    Below is the way I'm hooking up all sensors and such
    I've made some modifications to the original plan, But im sticking to these ones for sure
    Small Engine ECU, EFI Moped Using An Audrino UNO-wiring-schematic-png

  12. #12
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Does the potentiometer represent the O2 sensor and the inductor represent the solenoid in the injector? What about the fuel pump, starter solenoid, O2 sensor heater and mag pickup?

    It looks like your LEDs are wired backwards. The cathode (the side with the bar at the tip of the triangle) should be connected to ground. Think of it like an arrow in the direction the current goes (from + to -). Flip them and insert a current limiting resistor in series with each one, between the IO pin and the LED. Google "LED current limiting resistor" to read up on why you need them and find links that will calculate the resistor you need.

    Double check that the Uno can source enough current to open/close the fuel solenoid, you may need to use a power FET to supply enough current.

    Could we get some more info on the scooter and other parts, manufacturer and model number or some such?

  13. #13
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Hi, I'm only really skimming your thread but I can tell this will be very relevant:
    » Pin I/O performance JeeLabs
    digitalRead(), digitalWrite(), etc. are very slow, it's much faster to use bitRead() and bitWrite()

    Edit: You might also consider using a different, faster device:
    http://leaflabs.com/devices/maple/
    Some MIT grads basically copied the Arduino and replaced the slow, primitive Atmel chip with a 32-bit ARM chip with a much higher clock speed (72 MHz vs. 16 MHz). It uses the Wiring language as well.

  14. #14
    Registered User
    Join Date
    Jan 2012
    Location
    Las Vegas, NV
    Posts
    9
    Quote Originally Posted by anduril462 View Post
    Does the potentiometer represent the O2 sensor and the inductor represent the solenoid in the injector? What about the fuel pump, starter solenoid, O2 sensor heater and mag pickup?

    It looks like your LEDs are wired backwards. The cathode (the side with the bar at the tip of the triangle) should be connected to ground. Think of it like an arrow in the direction the current goes (from + to -). Flip them and insert a current limiting resistor in series with each one, between the IO pin and the LED. Google "LED current limiting resistor" to read up on why you need them and find links that will calculate the resistor you need.

    Double check that the Uno can source enough current to open/close the fuel solenoid, you may need to use a power FET to supply enough current.

    Could we get some more info on the scooter and other parts, manufacturer and model number or some such?
    Yes, the potentiometer represents the 02 sensor, figured using the program that I am, a potentiometer would be the closest electrical component, and the inductor represents the fuel injector. lol, I kindof threw together the whole diagram in 5 minutes, wasnt paying too much attention to polarity or anything. If the UNO board doesnt supply enough power, i was planning on using a tipi relay, or thats what someone else told me would work. As far as model numbers, pretty much its the most common engine in the world. Its a honda clone 139QMB engine, used on typically every model currently made. lookup VIP moped or Sunny moped, and thats what they look like. Ive posted a wiring diagram to help you get a better view of the whole electrical system on the moped. Ive changed my mind on having the computer work the whole moped as far as starting it and all automatically. I am just going to have a blinking yellow LED come on for fourteen seconds, and have the program turn off the yellow led and have a green one turn on solid after the 02 sensor sets itself up. Sorry I havent posted in a few days been away from the computer (probably for good measure, this whole project had me distracted at work looking a one of our bikes while i was on the clock, testing different components for output and all when I shouldve been repairing the thing, lol)

    Im going to make a separate post with the whole complete wiring diagram the way it should be shortlySmall Engine ECU, EFI Moped Using An Audrino UNO-wiring-2_640-jpg

  15. #15
    Registered User
    Join Date
    Jan 2012
    Location
    Las Vegas, NV
    Posts
    9
    Quote Originally Posted by Epy View Post
    Hi, I'm only really skimming your thread but I can tell this will be very relevant:
    » Pin I/O performance JeeLabs
    digitalRead(), digitalWrite(), etc. are very slow, it's much faster to use bitRead() and bitWrite()

    Edit: You might also consider using a different, faster device:
    leaflabs.com
    Some MIT grads basically copied the Arduino and replaced the slow, primitive Atmel chip with a 32-bit ARM chip with a much higher clock speed (72 MHz vs. 16 MHz). It uses the Wiring language as well.
    Had no idea they had another open source board like audrino out there!!!Ive been looking into the board you just sent me, hopefully the compiler is decent and all. Good lookin man, definitely a hell of a lot more powerful the the uno board

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what is an Engine..
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-09-2003, 12:50 PM
  2. what's an engine?
    By blight2c in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2002, 08:09 PM
  3. A small problem with a small program
    By Wetling in forum C Programming
    Replies: 7
    Last Post: 03-25-2002, 09:45 PM
  4. 3d engine
    By Unregistered in forum Game Programming
    Replies: 0
    Last Post: 01-08-2002, 10:01 PM
  5. What's a 3D engine?
    By Garfield in forum Game Programming
    Replies: 6
    Last Post: 12-18-2001, 04:06 PM

Tags for this Thread