The five inch gauge petrol electric loco 'Michigan' has been running quite successfully at Bristol's Ashton Court Railway for a few years, and has been proved a sound design. Run on most public running days, the loco has proved very useful.
Previously, the engine speed had been set using a manual cable connected linkage giving the driver direct control of the engine. While this worked well enough, it was easy to leave the engine revving noisily in the station when no power was required. It was also easy to forget to rev up the engine before pulling away, leaving the fairly small batteries delivering all the power.
The 50cc Honda petrol engine belt drives a vehicle alternator, generating an essentially constant 26 volts. This combination is capable of delivering higher power at higher speeds. Therefore a means of automating engine speed adjustment is desirable both to improve efficiency and to make driving simpler.
The project over winter 2017/18 has been to automate control of the Honda 50cc engine. This has been achieved using a model control servo driving the Honda control linkage - the servo is driven by a new computer control board, built using one ST Nucleo F303K8 computer board and a handfull of inexpensive electronic components.
The computer is 'Mbed Enabled' - meaning all software could be developed and downloaded using the FREE online 'mbed' compiler, provided by ARM of Cambridge. I'll put a link to the software listing later.
How it works is quite straightforward.
The wire between the drivers speed control and the motor controller was cut and re-routed via the new computer system. As a safety consideration, a design specification was that "Output to motor controller can never be higher than signal from drivers speed control". This preserved the 'Dead Mans' function while allowing the computer to limit or reduce the demand signal sent forward.
A digital ammeter module (Hobbytronics ASC709-75A) monitors current drawn from the alternator. The computer reads this to determine how fast the engine needs to be running in order to easily deliver this current. Should the algorithm decide more revs are needed, the servo is advanced to open the throttle while limiting the signal sent forward until desired revs are reached.
Similarly, as current demand falls, engine revs are reduced, to a tickover when stopped at the station.
Now well into the 2018 running season, minor software tweaks are ongoing. One reported problem was that advancing the speed control too fast could stall the engine. This has been solved by introducing a time constant to stretch the time taken internally for the demand signal to rise, giving the engine a little time to rev up. Another slight annoyance rather than problem was that under heavy load conditions, the engine speed would settle into an unstable rising and falling 'hunting' pattern. This has now been fine-tuned out.
One problem, reported several times, was "no response". This is reported to occur occasionally when attempting to pull away. This problem never manifests in my presence - I have never seen it, and have therefore, no idea what to look for. It may be the problem is a myth, or it may be real. In searching, we are to fit a LED to the control panel, the computer will flash this rapidly as the main control loop repeatedly executes. Then the next time anyone reports "no response", hopefully they can also tell me the state indicated by the LED.