io. Tractor model IoT conversion

I decided to convert an old discarded tractor model with a trailer and a broken remote controller to IoT. Luckily the original Silan Microelectronic RX-6B receiver-controller chip outputs can be overridden by a wire connected to the battery power supply voltage, which activates one of 6 control outputs. A pair of digital outputs on RX-6B receiver-controller is used to control each motor’s speed and rotation direction through an PNP-NPN transistor bridge. So, it would be a waste of time and money not to use electric motor control transistor bridges on the tractor model’s original PCB, while the RX-6B receiver-controller has to be replaced by wire connections to a new ESP8266-13 based controller.

The tractor has three motors for driving, steering and shovel control. An additional motor is inbuilt into the trailer, but it is powered by the same controls as the shovel. A red mechanical electric switch enables you to select the trailer’s motor instead of the shovel’s motor. ESP8266 therefore needs to provide 6 control outputs. An SPI port extender chip (such as MCP23017, or a custom programmed microcontroller) may be used in projects where more I/O pins are needed. I my case the number of pins available on ESP8266-13 was sufficient, but a 3.3 V voltage regulator and a voltage converter were needed to adapt ESP8266 to the RX-6B voltage range. I used an 8-output ULN2803 relay driver chip as a voltage converter and LM317T chip as voltage regulator. ULN2803 has open collector outputs, therefore a 4.7 k ohm resistor to the battery power supply was needed on each output.

Tractor and trailer with external battery pack.

Original control board PCB analysis

ESP8266 module is one of the cheapest ways to connect and control homebuilt electronics devices through IoT Wi-Fi networks. An old remote controlled vehicle model can be a good start for a home ESP8266 project. Most models use a standard FM transmitter-FM receiver-controller pair that communicate at a maximum range of approximately 4 m. Converting to ESP8266 extends the range do about 90 m or more and enables the model to be controlled by any WiFi device, such as smartphones and computers. The connection is also bidirectional and sensor values may be relayed to the remote controller device. ESP8266 Arduino software libraries support 16-bit PWM modulation and 12-bit analog to digital converter, which enable precise control of models motors speed as well as measuring analog values, such as battery voltage.

ESP8266-13 based controller. 

ESP8266-13 based controller schematic. 

Building a new tractor model controller 

The first step was to build and test a new controller based on IoT ESP8266-13 module, LM317T voltage regulator and ULN2803 chip (used as voltage adapter) that would be small enough to fit into the tractor’s cabin. The controller would connect to the tractor’s original motor controller PCB and it would power from its batteries. ESP8266-13 module cannot be directly soldered to a standard 2,54 mm pitch prototyping PCB, instead I used two very short strips of soft wire tape that were able hold the module relatively firmly in place.

However, there was a glitch in the second part of the build in which I connected the new controller PCB to the original controller PCB. While ESP8266-13 was booting the original controller PCB was also powered and some of the motors were switched on for a short time, which draw too much electric current and disrupted ESP8266-13 booting. The result was overheating of some of the motor control transistor bridges, but I managed quickly disconnect the batteries and prevented disaster. However, it was interesting that the tractor started normally if backward movement control line remained disconnected during ESP8266-13 boot and I was able to reconnect it afterwards to gain full control. I used IRLML6402PbF p-MOSFET transistor with a 100 nF capacitor and another 4.7 k ohm resistor to assemble the switch. The switch is connected to ESP8266-13 GPIO15 pin through ULN2803 voltage adapter. GPIO15 pin must be connected to the ground through a 4.7 k ohm resistor during ESP8266-13 boot, so the motor control PCB is not powered at boot time. As ESP8266-13 starts normal operation GPIO15 is programmed as a digital output and it enables power to the motor control PCB when it is set to a logical 1. The power switch also provides a little bit of overcurrent protection for the motor control circuit, because its threshold voltage is about 2 V. 

An important part of the new controller is also a motor controller voltage gauge (measures voltages to about 12 V), which can also be used to measure remaining battery power. The new controller also provides TTL RS232 programming interface with RxD, TxD, reset and boot mode lines. The reset and the boot mode lines are also connected to ESP8266-13 3.3 V power supply voltage through 4.7 k ohm pull-up resistors. The boot mode and reset lines can be automatically operated by an ESP8266-13 programmer (may be connected to RTS and CTS lines), or manually operated through corresponding micro switches. The normal boot mode starts automatically with a slightly delayed reset provided by 100 nF capacitor connected to a 4.7 k ohm pull-up resistor. ESP8266-13 enable input is not needed and it is firmly connected to 3.3 V.

Original controller board with RX-6B controller removed.

A new tractor model controller firmware sets up a Wi-Fi access point with a telnet server on port 23. Only, a single client allowed at a time, all other clients are rejected. The telnet server relays a client control commands and also provides feedback information such as motor controller voltage level to the client. Standard ASCII terminal commands (such as ‘\r’) are used for displaying current measurements in place. The firmware is available from PC USB Projects downloads section.

Alternative remote controller

A telnet remote control client can also be based on an ESP8266 module. A special client firmware was developed to relay telnet communication to TTL RS-232 port and through RS-232 to USB bridge to a PC. A standard terminal application (ex. TeraTerm) should be used to establish a PC telnet connection through the ESP8266 module. However, it is more convenient to connect through a PC standard Wi-Fi interface, except for security seasons and for inter-robot communication. The firmware is available from PC USB Projects downloads section.

Drive and shovel/trailer transistor bridges schematics.

Steering transistor bridge schematic. 

Firmware

It is not all electronics! Though the tractor looks new, it has quite some millage. It’s been repaired for a number of times. The drive motor gearbox bearings started to produce an annoying noise as they were extensively used again. I had to completely dismantle the tractor to reach the gearbox, only to discover that the rim of a white gearbox cover that held the gears axles in place from above was carved. I repaired it whit Locktite glue and a piece tape.

The steering mechanism was also one of a kind, drawing a way too much electric current. After a long consideration, I decided to remove a wheel centering spring and somehow try to rotate the front wheels left and right with the steering motor, only. This also lowered the power consumption and provided smoother drive on turns. ESP8266 firmware currently only switches off the steering motor as the wheels turn to the desired angle, but I intent to add a front wheel direction angle sensor that would enable automatic centering of the wheels after a completed turn.

The original tractor battery box holds only 4 AAA type batteries which drain relatively quickly. I therefore added a USB power connector and an additional battery box to provide energy from larger AA type (accumulator) batteries.

ESP8266-13 controller to original controller board connection. 

Mechanics maintenance. 

Playing with the tractor

Connecting to the IoT Tractor through Terminus application for android smartphones.

Robot telnet terminal ("?" displays available commands).