digitalfilter001005.gif
DeGlitcher PIC Chip Digital Filter for R/C
Use a $5 PIC Chip to digitally filter the Radio Control receiver signal
Here is a 16F628A PIC chip used as a DeGlitcher.  Basically, I'm using it to read in the pulse stream from my Futuba reciever and to filter out any bad pulses, before sending the stream to the electronic speed control (ESC).  This greatly improves the smoothness of my R/C train operation.
Vincent Chan
digitalfilter001004.jpg
digitalfilter001003.jpg
16F628A PIC chip
The 16F628A PIC chip offers an internal capacitor circuit, so an external crystal is not needed.  This simplifies hook up, as only a resistor, is the only additional part needed to run the PIC.  (a 0.1u capacitor is placed between the +5V supply and ground to clean up the voltage)
Schematic to hook up to servo receiver and ESC
The pulse from the receiver is read on pin B4 and a pulse is sent to the ESC on pin B5.  A sample of the mbasic code can be seen below.
signal var word
average var word
average = 1500
 
main:
 
   'read in the pulse at B4 into var signal
   pulsin b4, 1, main, 2, signal
 
   'check to make sure not out of bounds
   if signal > 2000 then
      signal = 2000
   endif
   if signal < 1000 then
      signal = 1000
   endif
 
   'calculate the new average
   average = average * 9 + signal
   average = average/10
 
   'send pulse out to ESC
   pulsout b5, average
 
goto main
Note: that this won't work if your ESC needs a constant stream of pulses.  The program can also easily be expanded to stop the ESC if a "pulse in" is not recieved after a set time.
digitalfilter001002.jpg
The small board on the left is the PIC chip with the above program.  This is used to drive a Dimension Engineering SyRen10 electronic speed control (not seen in this picture) I've also added an op-amp, using the PIC's built-in PWM to drive an old analog sound board (at right) and speaker (centre).  This is an old Chicago Model International board that I picked up a George's trains a few years ago.  I've attached the 2nd channel to trigger the horn on the sound board.  Eventually this control car will get built into a "wood chip car" to be dragged behind my locomotive.
digitalfilter001001.jpg
Here I am hauling a load of fresh strawberries and tomatoes from the garden.  Behind the locomotive is a flatcar with the ESC, PIC chip filter (on a prototype board) and the Futuba receiver.  On the second flatcar is the two 12V lead acid gel cell batteries.