How to use a Spektrum DX4C’s Switches in Arduino

How to use a Spektrum DX4C’s Switches in Arduino

These are my notes on how to use a remote control’s switches to control extra features of a robot.  In my case, I have an autonomous rover and would like to build a switch to press on the remote control to stop the rover and take manual control over it.

I used a Spektrum DX4C transceiver.

Switch Channel 3 is highlighted in red.

First, I configured the Spektrum  DX4C profile model in memory so that Channel 3 will be used as a switch.  To do this:

  1. Press the scroll wheel and select your Model to configure
  2. Next, scroll down to Switch
  3. For menu selection “A:”, choose Aux1 SP2

Next I connected a pin wire from the receiver.  On my Spectrum SR3100, this was labelled Aux.   I connected the wire to an Arduino PWM capable pin(5).  Make sure the receiver has power.  You can get it from the Arduino board’s 5v and ground pins.

The following sketch allowed me to read the values of the switch:


/*
 * To read the values go to Tools | Serial Monitor
 */

byte pin = 5;
 
int value;
 
void setup() {
  pinMode(pin, INPUT);
  Serial.begin(9600);
}
 
void loop() {
  value = pulseIn(pin, HIGH);
  Serial.println(value);
  delay(500);
}

 

Pressing the switch gave me approximately the following PWM values:

Switch On:  1900

Switch Off: 1100

Radio Off:  1500

In conclusion, these values would be used in an Arduino sketch to control a robot’s behavior.  Use code logic to determine if the switch is on/off and use that to display a light, play a sound, or any behavior altering characteristic you can imagine.

 

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.