Safety switch? Takeover circuit? RC Mux? Kill switch? Whatever it's called, this circuit is how you take over control of your autonomous rover milliseconds before it crashes itself into a curb, lake, or ankle. And I've just redesigned mine. Here are the deets. (Meanwhile, it's now for sale on Tindie)
I etched the original board at home in 2011 while preparing for my first Sparkfun AVC. The board was one of my early uses of surface mount passives. The new board is smaller, features all surface mount technology, an OSHPark-fabricated PCB, color-coded RC connectors, and multiplexing for 3 channels.
Like the original, it detects the presence or absence of an RC signal from the receiver so that your microcontroller is in control when your RC transmitter is off and you're driving when you turn your transmitter on.
Unlike the original, the signal detector is an ATtiny13 rather than an analog circuit. The 8-pin, 8-bit AVR microcontroller watches for RC pulses and times the on time, off time and turns over control to the receiver when the signal looks more or less like a standard, 50 Hz RC signal with 1-2 ms on time.
Firmware DesignI set up a PCINT handler to track rising edges and falling edges. A timer-based interrupt handler counts duration of high and low signals using Timer0 with ~10us resolution.
A timeout period for the low signal, when exceeded, selects the MCU. It also has a valid signal count so if the high period and overall period are within (very loose) specs 3 times in a row it switches over to manual control (RX).
This circuit uses a 16-pin 74*157 quad multiplexer instead of the 20-pin 74*244 that I had laying around last time.
Other DesignsI'm contemplating a smaller 2-Channel version possibly using an ATtiny10 for the first time. Wayne's way ahead of me with a great design that also features neat little multi-purpose logic chips from Texas Instruments (SN74LVC1G97DBVR, pdf). I'd planned to use 74LVC1G3157 single muxes.
|4CH RC Mux from Pololu.com|
Gotcha: Failsafe Receivers
One gotcha Wayne pointed out: some receivers (FrSky) generate failsafe signals when the transmitter signal is lost. I'd have to revise the design slightly to monitor CH3 so that it can be used to control the switching behavior, too.
Programming An 8-SOICYou may wonder how I program the SOIC-8 ATtiny since it has no AVRISP header. I use a SOIC test clip with wires soldered on, connected to a Pololu AVR programmer.
As always, safety is your responsibility with this or any other circuit. That said, my old version has worked well the last couple years. I haven't begun testing the new board.