Configuring an APC220 RF transceiver with Arduino

For some reason every time I look up tools for playing with electronics they end up to be windows based. For the APC220 it wasn’t any different, the only configuration tool I found was the RF-Magic executable. As I don’t run windows at home, and I don’t feel like booting a VM every time I want to configure my RF module I was looking for a way to do this straight from my Arduino.

It took me a while to find good, relevant material, but I finally found a nice Arduino Sketch that does just that. It also includes setting up a Serial communication over two Digital IO pins so you can keep the Arduino connected to your pc. You can get it here.

Below is a sample script that will set up your APC220 to work over 433.9MHz.

Pinout is as follows:

  • 1 SET connected to Arduino Digital 13 (D13)
  • 2 AUX not connected
  • 3 TXD connected to D12
  • 4 RXD connected to D11
  • 5 EN noyt connected
  • 6 VCC connected to 5V
  • 7 GND connected to ground

The Script:

//based on http://www.control.aau.dk/~jdn/edu/doc/arduino/sketchbook/apc220cansat/apc220cansat.ino

#include <SoftwareSerial.h>

const int pinRX = 12;
const int pinTX = 11;
const int pinSET= 13;

SoftwareSerial apc220(pinRX, pinTX); // Crt softserial port and bind
tx/rx to appropriate PINS

void setupSoftAPC(void){
pinMode(pinSET, HIGH);

apc220.begin(9600);
}

void setSettings(void){
digitalWrite(pinSET, LOW); // pulling SET to low will put apc220 in config mode
delay(10); // stabilize please
apc220.println("WR 433900 3 9 3 0"); // ask for data
delay(10);

while (apc220.available()) {
Serial.write(apc220.read());
}
digitalWrite(pinSET, HIGH); // put apc220 back in operation
delay(200);
}
void getSettings(void) {
digitalWrite(pinSET, LOW); // pulling SET to low will put apc220 in config mode
delay(10); // stabilize please
apc220.println("RD"); // ask for data
delay(10);

while (apc220.available()) {
Serial.write(apc220.read());
}
digitalWrite(pinSET, HIGH); // put apc220 back in operation
delay(200);
}

void setup(){
Serial.begin(9600);
setupSoftAPC();
setSettings();
}

void loop(){
apc220.println("Hello World!");
delay(5000);
}

The settings are set by this line

 apc220.println(</code><code>"WR 433900 3 9 3 0"</code><code>);
To configure the APC220 you need to set the SET pin HIGH and then pull it down (set it to LOW). This will put the module in configuration mode. Once it is in configuration mode you can write the configuration to it as displayed in the above example.
The format is
WR Frequency RFDataRate OutputPower UART-Rate Series check
Possible values for all these settings:
  • Frequency: Unit is KHz,for example 434MHz is 434000
  • RF Data Rate: 1,2,3 and 4 refer to 2400,4800,9600,19200bps
  • Output Power: 0 to 9, 9 means 13dBm(20mW)
  • UART Rate: 0,1,2,3,4,5 and 6 refers to 1200,2400,4800,9600, 19200,38400,57600bps
  • Series Checkout: Series checkout:0 means no check,1 means even parity,2 means odd parity.

5 Responses to Configuring an APC220 RF transceiver with Arduino

  1. Steve Spry says:

    Many thanks for this information, it’s a lot easier than having to use RFMagic.

  2. nathan says:

    thanks for the post makes configuring easy. have you been able to setup the APC220 with CRC 16 bit or 32 bit error checking?
    im not sure how to implement it into the code but i know that 1 wire sensors have this CRC error checking method.
    would wouldnt by any chance have example code with CRC?

  3. zmir says:

    Here is another alternative to configuring the APC220 both for Linux/Windows, sourceforge.net/projects/rftrulymagical/

  4. Jim says:

    What is the command for reading and writing Network and Node ID?

  5. Jim says:

    How do you set the Net Parameters?

Leave a reply to Jim Cancel reply