APC220 Radio; Arduino

From wikiluntti

Introduction

APC220 is a transmitter--receiver. Use TTL/USB converter in computer.

Note the pins:

  • No pins in J2 and J3: Programming is possible
  • Pins on J2-1 and J2-2: transmit using radio
  • Pins on J3-1 and J3-2: save data to SD card

Radio transmits all data written using Serialprint() commands to the ether.

Theory

Frequencies

433.050 MHz - 434.800 MHZ.


RF Magic

Rf Magic http://www.dfrobot.com/image/data/TEL0005/rfmagic.rar can be used but it unreliable. You should use Arduino to program radio.

USB-TTL converter

Need VCP (Virtual COM Port) drivers; use those from SiLabs.com CP210x USB-UART VCP drivers. Run CP210xVCPInstaller_x64 at https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers

APC220 Pinouts

  • VIN: Module power supply
  • GND: Ground
  • RX: Data receive through serial protocol
  • TX: Data transmit through serial protocol
  • SET: Mode Setting
  • AUX: For other commands
  • EN: Enable module

Use Arduino's pins GND, 8, 9, 10, 11, 12 and 13.


It only need four pins connect with Arduino board.

Note: Disconnect the RX and TX pin with Arduino before download program, otherwise the program download fails.

Arduino

apc220cfg https://learn.andoyaspace.no/wp-content/uploads/2016/11/apc220Cfg.zip can be used to set the transmitter frequency and other data

commands:
  r :  Read apc220 radio config
  e :  go into echo mode: receive char, add 1 and return
  n :  no more echo - back to normal
  w :  Write apc radio config ...
     'W'  FFFFFF R P B C - number of letters indicates precise number of digits
      FFFFFF: frequency: 434000 (434 MHz) range 418000-455000 
      R:      Rf data rate       - 1/2/3/4 equals 2400/4800/9600/19200bps
      P:      Radio output power - 0 .. 9 9 equals 13dBm(20mW).
      B:      UART baudrate      - 0/1/2/3/4/5/6 equals 1200/2400/4800/9600/19200/38400/57600bps
      C:      Byte Chek Parity   - 0/1/2 equals NoCheck(8N1)/EvenParity(8E1)/OddParity(8O1)

Write example: w 434000 3 9 3 0 is...
    434,000 MHz 9600 baud in air, 20mW, 9600baud on UART, No Parity(8N1)
After 30 seconds with no keyboard input we will emit a char every two second

PARAgoing into ping mode - emit a char every two second on apc220  ! 66 68 70


Library: https://github.com/PaulStoffregen/SoftwareSerial


J2 & J3

/*
  Modified on March 09, 2021
  Modified by MohammedDamirchi from https://github.com/PaulStoffregen/SoftwareSerial
  Home
  https://electropeak.com/learn/interfacing-apc220-rf-transceiver-data-communication-module-with-arduino/
*/


#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

void loop() { // run over and over
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

Terminal program

Br@y++:n Terminal v.1.9b https://sites.google.com/site/terminalbpp/

Exercises

References

https://static1.squarespace.com/static/607d6dc320b1be007db03750/t/6103f1a1bce34815144b959f/1627648418459/APC220_Datasheet.pdf