This page is a 'work in progress', so please check back often.
The loco is driven using a touch-screen computer module, the 'STM32F7 Discovery kit for STM32F746 MCU'. See Farnell or other distributor ffi, at time of writing this useful link for info worked.
13 Nov 2017 - the whole code has been published on the mbed site. You can see it here on the mbed.org site (opens in new tab) copy it and do what you like with it.
The code is a 'snapshot' of evolving code which has driven the loco - what I'm saying is it works!
The touch-screen controller has an interface board fitted behind it. This takes the raw loco power supply voltage (range 20v to 100v) and uses switched-mode technology to provide all the stabilised low voltage supplies needed, provides buffered inputs and outputs for interfacing to up to six brushless (or brushed) motor drive boards, output switches for horns etc.
The schematic diagram of the interface board is here.
Two cascaded switch mode voltage regulator systems are used, the first is a LTC7138 high voltage device used to take the incoming voltage anywhere between 20 and 100 volts providing a regulated 14 volt output. The schematic for this module is here.
The second regulator uses the MP2456 chip.The schematic for this module is here. This uses the 14v rail as input to provide a regulated 5v output. This powers the touch-screen computer and interface components on the back board.
This loco has two bogies, four axles in total, one motor per axle. The controller connects to four BMD032017 Brushless Motor drive boards.
The BMD032017 board schematic is here (new tab). This is driven by two pulse width modulated (PWM) signals, one determines upper limit voltage applied to the motor, the other sets the motor current limit. This gives flexibility and choice of control methodology. For my personal preference I do not like driving electric locomotives fitted with voltage, or speed, control. I prefer using torque demand control as this gives a more realistic 'feel' to the driving experience. Torque control is achieved by setting the voltage limit to max and driving by altering current limit. Likewise, 'speed' control is achieved by using the voltage control PWM leaving the current limit set to max.
How it Works - Control signals from the control computer are wired to connector P5. Four signals come to the BMD board, and are fed through opto-isolators U9 and U10. Two of these are PWM signals, used to set max motor voltage and max motor current, and are processed further and combined into a single composite PWM by PWM control chip U6. The other two use a binary code to determine one of four states: -
Run one way
Run other way
These two are wired to 'address' inputs of U4, a read-only memory chip used as a lookup table. Jumper J1 also takes one address line, and is used to swap motor direction. With the three signals from the brushless motor hall-effect rotor angle feedback unit, the 7 bit address so formed looks up the 6 bits required to drive the 6 power switching mosfets in U11 via mosfet drivers U1-3. The board can also drive ordinary brushed dc motors, when no hall-effect position sensor is found, the same function is implemented using two output connections instead of three. Motor current is sensed and turned to a voltage by U5. When driving a brushless motor, an opto isolated signal is available to feed back to the controller. This is used to implement a highly accurate speedometer.
Data on key chips used -
Regenerative Braking - Over-Voltage Protection
In a battery powered locomotive, a thought is that electrical power regenerated during braking can be put back into the batteries. This is true to an extent, but often the power regenerated is too great, there is a limit to how fast you can charge batteries. Trying to put too much back too quickly can cause the system voltage to rise well above nominal battery voltage, particularly so when the batteries are nearly fully charged. Without some means of detecting and limiting over-voltage, damage is likely.
With this petrol-electric design, there are no batteries available to mop up any regenerated power, so an electronic 'Power Dump' has been designed and included. Some similar system is a requirement in batteryless designs, and a worthwhile safety system for battery powered designs.
Schematic for the Power Dump is here (opens in new window).
At low voltages, the power dump draws negligible power, just enough to bias V1, a precision voltage reference.
A fraction of input voltage is compared to reference, as this rises a point is reached where op-amp U2 begins to bias mosfets Q1-Qn into linear conduction region. R2-R6 help equalise current share between mosfets.
As voltage rises further, the mosfets are biased to conduct more heavily to the limit where each mosfet sinks a current of around 2 Amp (with component values shown). Component values (R7, R18) are chosen in this case to cause over-voltage protection to start kicking in at about 54 Volt, and to apply max load at about 58 Volt. Each mosfet will be dissipating around 100W max. The mosfet part was copied another four times, one 'master' board driving itself and four 'slaves'. This gives a power dumping capacity of 2.5kW spread between 25 mosfets as fitted to this petrol electric loco.
You may wonder why not use wirewound resistors instead of mosfets. Simple. Mosfets are a lot cheaper !
Work In Progress - Nov 2017
At present loco is driven by keeping a finger on the touch screen, this complies with club requirements of a 'dead mans' function, take finger off and power drops to zero (but no brakes applied). Now adding a radio control receiver so that loco may be driven by radio control.
Also adding a model control servo connected to Honda engine throttle. This servo will be driven from the touch-screen and has no connection with the radio control. The purpose is simply to switch engine between mid-revs when power is being drawn, and tickover when not.
Will also have to give some thought to a body shell - this is a requirement before being able to use for public passenger hauling. Also, for use at Bristol SMEE Ashton Court track, some extra hardware to work the vacuum brakes fitted to their passenger trucks. Busy winter ahead.