gregh
electronics, computers and scratchbuilding

I?m a convert to using cheap 2.4 GHz radio control (from Hobbyking.com), and so far have 7 locos converted. The basic speed and direction control using this equipment is VERY simple. But I?ve been working on ?fancying? up some features using Picaxe microcontrollers.
Picaxe are small Programmable Interface Controllers (the PIC part) that can be programmed to do many useful things. I use the small 8-pin version (08M) which only costs about 6 AUD. It has 5 I/O pins.
Here?s the Picaxe website link: http://www.rev-ed.co.uk/picaxe/
And you can see my webpages for some ideas of how I have used them:
http://www.members.optusnet.com.au/satr/electronics.htm
http://www.members.optusnet.com.au/satr/2point4GHz.htm#picaxeESC
If you can solder and have a bit of electronics experience and can use BASIC programming, these things are the greatest. Sure, they take a bit of an investment in time learning how to use them, but no more integrated circuits and varying discrete components. Just change the program. I mount the picaxe in a 8 pin socket, for removal for programming on my desktop PC.
So here is the first of a few, very simple uses of PICAXE microcontrollers, - to create an inertia effect.
Using the Electronic speed control (ESC) with a 2.4 GHz receiver gives no scope to introduce inertia. There is no analogue signal, just the ?servo? type pulse train from the receiver to the ESC, where the pulse lengths represent the position of the Throttle stick on the transmitter, and so the motor voltage. The usual connection is like this:
Here?s a quick explanation of the RC pulse system.
The receiver sends out a stream of pulses. The length of these pulses correspond to the position of a servo (ie it?s rotation angle) or the voltage (speed) output of an electronic speed controller, selected on the transmitter.
On my Hobbyking receiver, for servos, the mid position is a pulse of 1.5 ms. These pulses are repeated every 20ms or so but this time is not at all critical and can be up to a couple of hundred ms. Rotate full to the right is 1.0 ms and full left 2.0ms. Pulse lengths between these values move the servo by a lesser degree. For the ESC a pulse of 1.15ms means stopped and 1.8ms is full speed.
So I wondered if I could build a simple interface between the Rx and the ESC to create Inertia.
This is about the simplest Picaxe circuit possible ? no other components, just the Picaxe and its socket, and no power supply needed.
I use the Picaxe to :
[*]?read? the servo type pulse train coming out of the throttle channel of the receiver, then[*]generate the inertia effect, then[*](re)generate the pulses to feed into the ESC representing the ?inertial? voltage.
I used the PULSIN command to decode the throttle pulse train, and the PULSOUT command to send the pulses out to the ESC every 100 ms or so. (I planned to use the SERVO command. But I found the motor speed was not constant but ?jittered?. From various Forums on Picaxe uses, I found that the SERVO command running in the background, interferes with the timing of the PULSIN command, so that the measured length of the input pulses varies. )
In total the program only uses 145 of the 255 bytes of memory in the chip. The rate of inertia is just a single variable.
The ESC generates the 5V supply for the RC receiver and it is used for the Picaxe as well, so there are NO OTHER components besides the Picaxe.
This is what the whole RC circuitry looks like.
Now having got this far, and with spare memory and I/O pins, it is really simple to add a few extra features at absolutely no cost:
So I made the inertia rate different for accelerating and slowing.
Then I removed the inertia effect as the loco slows below one third full speed, to make it easier to stop at a given spot.
The loco now takes 5 seconds to go from stopped to max speed and 2 secs to stop from full speed, if you ?bang? the throttle up or down (as small grandsons are wont to do!).
If anyone wants the code or circuit, send me a PM as I?m not sure it would reproduce correctly in the Forum layout.
Picaxe are small Programmable Interface Controllers (the PIC part) that can be programmed to do many useful things. I use the small 8-pin version (08M) which only costs about 6 AUD. It has 5 I/O pins.
Here?s the Picaxe website link: http://www.rev-ed.co.uk/picaxe/
And you can see my webpages for some ideas of how I have used them:
http://www.members.optusnet.com.au/satr/electronics.htm
http://www.members.optusnet.com.au/satr/2point4GHz.htm#picaxeESC
If you can solder and have a bit of electronics experience and can use BASIC programming, these things are the greatest. Sure, they take a bit of an investment in time learning how to use them, but no more integrated circuits and varying discrete components. Just change the program. I mount the picaxe in a 8 pin socket, for removal for programming on my desktop PC.
So here is the first of a few, very simple uses of PICAXE microcontrollers, - to create an inertia effect.
Using the Electronic speed control (ESC) with a 2.4 GHz receiver gives no scope to introduce inertia. There is no analogue signal, just the ?servo? type pulse train from the receiver to the ESC, where the pulse lengths represent the position of the Throttle stick on the transmitter, and so the motor voltage. The usual connection is like this:

Here?s a quick explanation of the RC pulse system.
The receiver sends out a stream of pulses. The length of these pulses correspond to the position of a servo (ie it?s rotation angle) or the voltage (speed) output of an electronic speed controller, selected on the transmitter.
On my Hobbyking receiver, for servos, the mid position is a pulse of 1.5 ms. These pulses are repeated every 20ms or so but this time is not at all critical and can be up to a couple of hundred ms. Rotate full to the right is 1.0 ms and full left 2.0ms. Pulse lengths between these values move the servo by a lesser degree. For the ESC a pulse of 1.15ms means stopped and 1.8ms is full speed.
So I wondered if I could build a simple interface between the Rx and the ESC to create Inertia.
This is about the simplest Picaxe circuit possible ? no other components, just the Picaxe and its socket, and no power supply needed.

I use the Picaxe to :
[*]?read? the servo type pulse train coming out of the throttle channel of the receiver, then[*]generate the inertia effect, then[*](re)generate the pulses to feed into the ESC representing the ?inertial? voltage.
I used the PULSIN command to decode the throttle pulse train, and the PULSOUT command to send the pulses out to the ESC every 100 ms or so. (I planned to use the SERVO command. But I found the motor speed was not constant but ?jittered?. From various Forums on Picaxe uses, I found that the SERVO command running in the background, interferes with the timing of the PULSIN command, so that the measured length of the input pulses varies. )
In total the program only uses 145 of the 255 bytes of memory in the chip. The rate of inertia is just a single variable.
The ESC generates the 5V supply for the RC receiver and it is used for the Picaxe as well, so there are NO OTHER components besides the Picaxe.

This is what the whole RC circuitry looks like.

Now having got this far, and with spare memory and I/O pins, it is really simple to add a few extra features at absolutely no cost:
So I made the inertia rate different for accelerating and slowing.
Then I removed the inertia effect as the loco slows below one third full speed, to make it easier to stop at a given spot.
The loco now takes 5 seconds to go from stopped to max speed and 2 secs to stop from full speed, if you ?bang? the throttle up or down (as small grandsons are wont to do!).
If anyone wants the code or circuit, send me a PM as I?m not sure it would reproduce correctly in the Forum layout.