Testing DFRobot APC220 Radio Communication Module with Arduino Blink Example

I got my hands on the APC 220 Communication Module from DFRobot for our robotic fish project [1] .

In this test, I use the LED Blink example, modded to include the serial port reading. While in the LED Blink example, you can just hook the positive point of LED to Pin 13 and its negative point to ground (GND), while the additional connections for the APC 220 module are as below:

APC220 Arduino connection

As shown in the figure, the connections are simple since I just wanted to perform a simple test to see whether the module is working fine:

APC 220 Arduino Blink

Below are the codes. You are free to change the serial baud number, I used 57600. Once the codes were uploaded to your Arduino board,

  1. connect everything,
  2. pop in the Serial Monitor on your Arduino IDE console,
  3. choose the respective baud (mine is 57600),
  4. send capital H to the console, observe the LED is turned on,
  5. send other character e.g. i to the console, observe the LED is turned off.

Happy coding!

// Modified from Arduino Playground tutorial: http://www.arduino.cc/playground/Learning/Tutorial01
char val; // variable to receive data from the serial port
int ledpin = 13; // LED connected to pin 13 (on-board LED)

void setup() {
  pinMode(ledpin, OUTPUT);  // pin 13 (built-in LED) as OUTPUT
  Serial.begin(57600);       // start serial communication at 57600bps 
}
void loop() {
  if( Serial.available() )       // if data is available to read
  {
    val = Serial.read();         // read it and store it in 'val'
  }
  if( val == 'H' )               // if 'H' was received
  {
    digitalWrite(ledpin, HIGH);  // turn ON the LED
  } else { 
    digitalWrite(ledpin, LOW);   // otherwise turn it OFF
  }
  delay(100);                    // wait 100ms for next reading
}

[1] I have established a research group named Marine Robotics Research Group. Someday I’ll make some write up for it.

2 thoughts on “Testing DFRobot APC220 Radio Communication Module with Arduino Blink Example

  1. Salam and hi.

    I’m using apc 220 module to control my diy quadcopter (arduino uno board). I use “serial.print” to read the angle and motor speed of my quadcopter and it works as good as it is.

    My problem is I can’t send the data from computer to arduino to control the quadcopter motor speed at the same time. The computer keep reading data from arduino.

    I use acquirelock() function and send the data.

    My question is do I need “delay()” or “break” function so while the arduino keep sending the data, and then stop a while to receive the data from computer and process it without compromising the quadcopter hovering?

    Or if you have any other idea, I’m happy to hear about it.

    1. Salam Tn Yusuf,

      I believe you are spot on with the delay function since the signal transfer relies on the baud rate. What is the baud rate that you are currently using?
      For the quadcopter application, my I suggest the use of 3DR Radio? It’s a standard for the Arducopter project using APM board.

      Regards,

      Faisal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s