More RC Channels, Less PINs

Hi,
I have been looking for a way to build a generic RC library that is small, fast and can work with the standard servo library, its own servo library or serial servos.

The library I have written uses hardware to multiplex many RC Channels into the two Arduino interrupts INT0 and INT1. This eliminates the overhead of using pin change interrupts and also keeps our pins and other interrupts free.

Internally the library uses the follow approaches to keep the size down and the speed up -

  1. Direct port access for reading/writing pins in place of digitalRead - we only ever need to read INT0/INT1
  2. Timer1 for timing - its much faster than calling micros, the library is also happy to share timer1 with the servo library or use it for its own servo modes
  3. 8 bit operations whereever possible, including the use of unions to perform 8 bit comparisons on 16 bit data.

The library uses a very simple channel multiplexer to direct all even channels to INT0 and all odd channels to INT1.

Whats a channel multiplexer ? its a diode and a resistor.

There is a small write up about the channel multiplexer here -

The approach is ideal for robots where you want to retain access to as many pins as possible and keep as much memory and processing time free for higher level functions.

The serial output will also allow control of a larger number of servos through a smaller number of pins using less memory and processor time.

I am in the process of converting my existing projects to use this library and will publish them and the library as I do.

Duane B

I like it! Thanks :slight_smile:

I like it! Thanks :slight_smile: