A prototype project to create a WiFi controlled Bedford QLD lorry in 4mm scale.
Requirement
The purpose of this project is to create a motor vehicle that can be loaded and unloaded from a flat wagon. The requirement was simply to be able to drive it backwards and forwards at a controllable speed. On the layout it was due to be used on it would emerge from a building, drive along a loading dock onto a waiting flat wagon or Loriet. Since it only had to drive in a straight line no steering facility was required.
The vehicle
Rather than build a kit or scratch build a vehicle it was decided to start with an off the shelf model and do the necessary modifications to motorise it. The vehicle chosen as an Oxford Diecast Bedford QLD in RAF livery. The layout it was destined for being set in 1944/45.
The Plan
As far as possible I wanted to use off the shelf components; both for the drive mechanism and the electronics. I already had some experience using the little ESP8266 processors that have built in WiFi and knew they worked well and would fit in the back of the Bedford. This would allow me to control the vehicle speed and direction using a WiFi connection. A standard size board called a WeMOS board would give me what I wanted.
The Motor/Gearbox
I needed a motor and gearbox that was small enough to fit between the chassis rails of the Bedford, yet with a high enough gear ratio not to result in a lorry capable of breaking the land speed record. Fortunately, after some time searching I found exactly what I needed on an internet site in Poland.
This motor/gearbox is very small, the gearbox is just 6.2mm wide, however it still manages a 2016 to 1 gear ratio. This should give me good low speed running.
The axle are 1mm diameter and will need sleeving to take the original wheels.
Motor Interface
An H-Bridge device would allow two outputs from the processor to control the direction. By pulsing the outputs I could use PWM to control the speed of the motor. Small H-bridge breakout boards are readily available on well known internet auction sites.
This device is actually a dual H-Bridge that can run two motors, we will however only be using half of the device.
Power Supply
The WeMOS board can accept 5 volts and produces the 3.3 volts needed by the processor. This 3.3 volts would also work well for the motor/gearbox combination. Another board in the WeMOS range is a battery controller for LiPro batteries. These batteries must be used with care and must never be completely discharge. The controller board manages this and provides a charging circuit also.
Searching again on the same well known internet auction site I have a small LiPro battery designed to fit into one of the small drones that are available today. It is a perfect fit for my chosen lorry.
Fitting the Motor/Gearbox
Fitting the motor and gearbox in place was not too difficult. I made slots in the existing "bearings" that held the rear axle in placed and drilled out the rear screw hole that held the body to the chassis. The body of the motor would then sit in this enlarged hole and the gearbox would sit between the chassis rails. The wheels needed sleeving to fit the smaller diameter axles on the gearbox.
The motor and gearbox in place, with a cage built around it to hold it in place. I plan to add some bearing to improve the running and make sure the axle is held square.
Wiring the Electronics
With all the components gathered it was simply a case of wiring the various parts together. Since I was using their breakout boards then it was a simple case of wiring the blocks together as shown.
I had to remove the socket on the battery management board that was meant for the battery to connect to as my chosen battery had a different plug. This too was cut off and the wires soldered directly to the PCB. The battery management board and the WeMOS processor where soldered together to form a sandwich.
Fitting the boards
The boards where a good fit in the back of the Bedford. The two WeMOS board fit in the top of the load area, the H-Bridge edge on tucked down by the mounting pillar for the rear cover and the battery sitting on top of the motor.
I have yet to add a charging socket and switch to turn it off, however this is enough for me to run it as a prototype.
Software
All that was left was the software, again this was produced on the principle of using building blocks. The ESP8266 is support by the Arduino programming environment, with lots of libraries available that make it easy to build up the software you want. A simple WiFi server was added that would allow an external computer to connect and send commands to the lorry. In this case you type F to go forwards and a speed, B to go backwards, again with a speed and S to stop. The Arduino environment has built in code to support PWM so this was simply a case of configuring the right outputs that had been wire to the H-Bridge.
The lorry was then tested by connecting my laptop to the server running on the processing inside it and typing the commands on the keyboard. Later this will be replaced with another project that detects a particular DCC address and uses the speed setting to send commands to the lorry.
The prototype in action
[vplayer id=2169]