Monday, March 02, 2015

How I programmed a Deltang receiver for auto-shuttle mode with a Deltang Prog4

I have been using Deltang radio control equipment for my 16mm scale, 45mm gauge garden railway for around two years now and in that time the range of features on the receivers has grown steadily.

Initially, the combined receiver/controllers were not specifically designed for larger scale locomotives and so were limited to smaller locos which drew no more than 1 amp. Since then, the receivers have evolved into the most recent - the Rx65b - which is a combined receiver (rx) and Electronic Speed Controller (ESC) which can handle up to 3 amps at 18 volts.

In addition to improving their power handling capabilities, various other developments have been incorporated. The Rx65b now has up to 12 output ports and three additional ports which are buffered to handle up to 2 amps. As with previous receivers, the Rx65b can be programmed by the user to tailor the outputs (and inputs) to meet specific requirements. For example, the user can set the maximum speed at which a locomotive will run, can program light displays (eg a flashing sequence of lights for a modern diesel loco) and configure outputs to control servos (eg for remote uncoupling). In addition, the receiver has three auto modes - Buffer-stop (on reading the end of the line loco coasts to a halt and will not move until you change the speed or direction setting on the transmitter) - Station-stop (the loco coasts to a halt at a station, waits, and then departs in the same direction) - and Auto-shuttle (at the end of the line the loco coasts to a halt, waits, and then departs in the opposite direction). The time taken to slow down and the wait time can be programmed by the user either using a conventional DSM2 aero transmitter, an RC Trains / Deltang Tx20 or with the Deltang Prog4 module, which is basically a modified Deltang transmitter.

I wanted a little 32mm gauge industrial diesel loco (see How I converted a battery diesel loco to radio control) to provide an automated shuttle service on a feeder railway from the copper mines to the loading hoppers on my 45mm gauge Peckforton Light Railway. Rather than having to operate this feeder railway manually, I wanted it to keep operating in shuttle mode. I had considered writing my own procedure for a Picaxe chip but space was limited in the loco and when I discovered that the Deltang Rx65b could be programmed to operate in auto-shuttle mode, I was delighted.

I have previously programmed Deltang receivers to change the Failsafe setting to Cruise (see Programming a Deltang receiver with a Prog1). This means that when the receiver loses the signal from the transmitter (eg when going out of range or passing behind a dense building), rather than coasting to a halt (as might be necessary for a boat or plane), it will continue to run at the same speed. The process for programming using the earlier programming modules was somewhat laborious and fiddly. However, with the introduction of the Prog4, programming has become a lot easier as it is done by creating and sending text files on the computer.

Before using the Prog4, I needed to purchase a USB to RS232 converter lead. This was bought through eBay, being advertised as suitable for use with Arduino. It cost me just under £2.50.

Before this little gadget could be used with my computer, I had to download and install an RS232 driver as this was not a feature on my laptop. I got the driver from this website - http://www.tri-plc.com/USB-RS232/drivers.htm - after a quick Google search.

The software, which is recommended on the Deltang website, is CoolTerm, which I downloaded and installed from - http://freeware.the-meiers.org/.  I transferred the CoolTerm folder containing the application to my desktop by dragging and dropping it from the Download folder where it had installed by default.

With this software installed on my computer, I was ready to get started with the programming.

The RS232 lead was connected to the Prog4. The negative (black) lead was attached to one of the lowermost pins and the red (positive) lead was attached to one of the middle row of pins. The green wire was attached the uppermost pin 7 and the white wire was attached to the uppermost pin6.

I then plugged in the lead into one of my USB sockets and the LED started flashing in three pulses.

After waiting for the on-screen messages to inform me that the driver had installed successfully and that the device was ready to use, I then decided to bind the Prog4 to my receiver.

I unplugged the Prog4 from the computer and then turned on the receiver in the model and waited until the receiver LED was flashing rapidly. I held in the bind button in on the Prog4 and then plugged it back into the computer.

The LEDs on the rx and the Prog4 flashed a few times showing they were communicating with each other and then the LED on the Prog4 and on the receiver remained steady.

I have found that sometimes I need to repeat this process a couple of times before the bind process works - but this is a rare occurrence and on this occasion the receiver bound itself to the Prog4 almost immediately.

With the Prog4 and receiver both switched on and bound together, I then started up CoolTerm by double-clicking on the CoolTerm.exe file.

Once it had started, I set the parameters for the port as recommended on the Deltang website. This was done by clicking the Options button .......

........ and changing the relevant settings as shown below (Note, the COM port assigned to the Serial lead will vary from computer to computer) and then clicking OK:

  I then consulted the programmable settings for the Rx65b by accessing the information on the Deltang website - http://deltang.co.uk/rx65b-v611-p.htm

Note: It is important to ensure you have the settings for the correct model number - this is usually indicated by a number handwritten on one of the chips on the receiver - in my case it is version 11-2 and so the programmable settings for v611 are appropriate.

I scrolled down to Menu 3 which shows the program settings for the auto-shuttle procedure. One of the pads on the receiver is programmed to accept the triggering signal to send the receiver into auto-shuttle mode. The pad is triggered by being connected to 0v (ie the negative lead of the battery). I decided the trigger would be on Pad 8.
Auto-shuttle settings (Click to enlarge)
To re-program the receiver to operate in auto-shuttle mode I worked out I needed to send the instructions:
3,8,9,4,11
(ie Menu 3, Pad 8, Stop&Reverse mode (9), 4 seconds to slow to a stop, 45-60 seconds pause (11)

These instructions were then written into a small procedure using Notepad on my Windows 7 computer ......

........ and  was saved as a text file.

I then clicked the Connect button in CoolTerm to allow the program to talk to the Prog4.

From the Connection menu, I selected Send Textfile ....

.... and then navigated to where I had saved the text file I created earlier.

On sending the file I was rewarded with the following message ......

...... telling me that the transmitter (Tx) and the Receiver (Rx) had successfully communicated and  the file had been sent and received.

All that was left now was to disconnect the Prog4 and turn off the receiver which had now been successfully re-programmed.

Now the Rx65b had been re-programmed, a reed switch needed to be connected to Pad 8 and the 0v output on the Rx to act as a trigger. After some experimentation, I discovered that a 0.1uF ceramic capacitor needed to be connected directly between Pad 8 and 0v to help prevent Electromagnetic interference (EMI) from giving false triggers on the P8 lead.

To provide further protection from EMI, I used screened cable to connect the Rx to the reed switch.

The other end of the screened cable was soldered to the reed switch (take care not to bend the wires on the reed switch too close to the glass tube otherwise the glass will break ..... you can probably figure out how I know this!).

The reed switch was then fixed in place beneath the loco just behind the buffer beam - I used BluTak in case I needed to make some adjustments to its position.

Two magnets were fixed to the track, about 20cm from each end.

Here is the loco operating in shuttle mode but with ten second stops at each end of the line (45-60 second stops would have made the video somewhat less interesting.....).

NOTE: I initially had problems with the Prog4 and Rx65b being unable to communicate successfully because the rx was being powered by only one 3v li-ion battery. When I connected the rx to a 6v battery, there was no problem (as indicated above).

Depending on the quality of the motor you are using, you might need to add 0.1uF capacitors to the motor leads to further suppress EMI.

They weren't really necessary on my loco but I added them as a precautionary measure (one across the two motor terminals and one from each of the terminals to the casing of the motor).

I have always been impressed by the quality and versatility of Deltang equipment and on the few occasions when I have run into difficulty, I have found David Theunissen at Deltang to be extremely helpful (and patient).

2 comments:

Unknown said...

Hello Rik.
You are making a big job learning us to implement Deltang Tx20/22 with Rx 65b in your trains and make program modifications from computor using Prog4. I have the same equipment qnd try to do modifications row by row, but it is very difficult to gess the actual original program in the Rx. Some output functions are using several rows in programming to include all the specifications. You can send datas back from Rx to Tx showed in the Cool Term screen. But I am not skilled enougth to understand this Hex figures. I can understand the way I shall program according to the rogramming v611, for example 2,14,2,7,1. But is there a way to show the actual program in Rx in the same matter, so I can understand where to modify? Is there some type of translation program available?

Thanks in advance and best regards

Tore Svensson
Trelleborg
Sweden

GE Rik said...

Hi Tore
I don't know of a program which will do this. You could try sending an email to David Theunissen at Deltang to see if he can help you ( http://deltang.co.uk/email.htm )
Rik