Arduino RcReceiverSignal library

RcReceiverSignal: an arduino library for retrieving the RC Transmitter value from an RC Receiver pulse

Introduction

The following arduino library was written to use the findings found during the Mapping RC Transmitter PWM signal to actual transmitter values article. All results were wrapped into a library for ease of use.

The RcReceiverSignal is an arduino library that allows one to read a signal sent from a Remote Controlled (RC) receiver.

Skip to the download section for quick download.

Purpose

The RcReceiverSignal library allows one to easily configure an input pin to read a PWM signal sent from a RC receiver by attaching a RcReceiverSignal instance to a pin connected the receiver and automatically monitor each pulse sent by the receiver.

It allows the main loop to retrieve the latest received pulse length (PWM) and convert the pulse length back to the actual transmitter signal value (ranging from -150% to 150%).

The library supports automatic PWM signal change detection. The library’s ability to convert a PWM value to the actual transmitter numeric value is based on empirical tests available at Mapping RC Transmitter PWM signal to actual transmitter values.

Library features

Possible use are:

  • Allows one to get the latest PWM value sent from the RC receiver.
  • Automatically handles interrupt protection.
  • Automatic ISR handling. All required code automatically generated.
  • Allows one to convert a pulse length (PWM) back to the original transmitter value.
  • Supports multiple Transmitter/Receiver combination:
    • Spektrum DX9 tx + Spektrum AR8000 rx
    • Spektrum DX9 tx + Orange R620X rx
    • Tactic TTX600 tx + Tactic TR624 rx
    • CCPM Servo Tester
  • Supports eRCaGuy_Timer2_Counter 0.5µs (or the native micros() function) for timing calculations.

Library dependencies

PinChangeInt

This library allows the arduino to attach interrupts on multiple pins.

eRCaGuy_Timer2_Counter

(optional)
This library configures the arduino’s timer2 to 0.5µs precision. It is used for a micros() function replacement and allows times calculations that are far more precise (8 times!) than the default’s 4µs resolution.

Usage

Use the DECLARE_RECEIVER_SIGNAL macro to declare an instance of RcReceiverSignal. ie:

Each macro will automatically declare the following:

  • RcReceiverSignal receiver_aux1_handler;
  • receiver_aux1_handler_setup() function.
  • receiver_aux1_handler_pin_change() ISR function.

In the setup() function, you need to configure each instance by calling the receiver_aux1_handler_setup() function with the interrupt pin as argument. ie:

In the loop function, one can call the hasChanged() method to know if the PWM value has changed since the last call or call the getPwmValue() function to get the last PWM value observed by the RcReceiverSignal instance.

From a PWM value, one can call the getSignalValue() or getDeviceSignalValue() methods to convert a given PWM signal from a known device combination to a transmitter value (within -150% to +150%).

Demo

The following demo show how to use the library:
(download the RcReceiverSignal v1.1.203 LedUpdate demo.ino (872 downloads) )

License

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (LGPL-3.0) for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

DISCLAIMER:
This software is furnished “as is”, without technical support, and with no warranty, express or implied, as to its usefulness for any purpose.

Download

You can download the RcReceiverSignal arduino library by clicking on the following link:

Download “RcReceiverSignal arduino library v1.1.203” RcReceiverSignal-v1.1.203.zip – Downloaded 965 times – 59 KB

Leave a Reply