More progress made today, I connected up the alternator to the engine to begin testing it under load. This was pretty successful, and the ECU all performed as expected, with only a few tweaks to the PID controller parameters to improve the AFR control. I restricted the range of fuelling down to as restricted as possible to prevent the system setting wildly large or small fuelling amounts under certain conditions. I finally managed to get the PID to maintain the AFR slightly rich within a few percent under steady state conditions.
I also added a new calculation for the way the throttle position value is calculated. The throttle position sensor is simply a potentiometer attached to the throttle butterfly valve. I use a 10 bit ADC to read this value, hence it ranges between 0 and 1024. Since the throttle won’t close any more than 129, and is completely WOT (before closing again) at 827, I used the Arduino map() function to remap this range to between 0 and 100 percent.
I mapped the engine across a range of loads and speeds so that I could use the predetermined map to control the fuelling instead of either controlling it manually or from the lambda sensor. To do this, I switched all my load light bulbs on, and opened the throttle until the engine was at around 6000 RPM. I allowed the fuelling to be controlled with the lambda sensor, and once the engine had settled to a steady speed and lambda reading, I then saved the fuelling at the given engine speed and throttle position into the map. I then reduced the throttle by 1 %, waited for the engine to settle and again stored the fuel value in the map. I continued this until the engine was about to stall (0% throttle). I then switched the load off and repeated. This gave me a range of fuel values for maximum load and for 0 load. I then roughly interpolated the fuelling values across the map to provide a complete map.
The engine seems to run pretty well from the map, and performs better under big step changes and on rapid throttle opening (with just lambda control, it would suffer from fuel starvation for about 5 seconds until the PID had caught up).
Currently the load can only draw about 15 amps, which equates to about 15 A x 12 V = 180 Watts, and the engine is rated at 2.5 Hp, which is 1.86424968 kilowatts, so at the moment we’re not even using 10 % of the engine’s rated maximum output (ignoring any losses in the drive train and alternator inefficiency). The alternator is off of a Ford Sierra, and is probably rated for about 70-80 Amps, which would provide a maximum load of 70 A x 12 V = 840 W, which is still only about half of the available engine power. At any rate, I’m hoping to get a bit closer that that value to see how things go.