Things I did

POCSAG with Arduino Nano and CC1101

Categories: Notes
Tags: diy arduino ham radio cc1101

POCSAG is the protocol for pager systems.

With DAPNET there is a ham radio network to create a pager system on the ham radio frequencies. The frequency of 439.9875 MHz is used.

Often the old pager devices are used to receive the messages. In these devices a quartz needs to be changed to adjust them to the right frequency. But as these devices are quite old or the newer devices are expensive (>80€) I thought I could build one with an arduino and a CC1101 radio module.

I use RadioLib as it supports multiple devices and multiple different radio modules. It also has POCSAG support which makes using it much easier.

Connection from Arduino Nano to CC1101 module 🔗

Port number CC1101 module CC1101 Function Arduino Nano Port
1 GND GND
2 VCC 3V3
3 GD00 D2
4 CS D10
5 (SCK) D13
6 (MOSI) D11
7 (MISO) D12
8 GD02 D5

Below is my code based on the pager example from Radiolib:

#include <Arduino.h>
#include <SPI.h>
#include <Wire.h>
#include <RadioLib.h>

CC1101 radio = new Module(10, 2, RADIOLIB_NC, 5);

const int pin = 5;

PagerClient pager(&radio);

void setup() {
  Serial.begin(9600);
  Serial.print(F("CC1101 Initializing ... "));
  int state = radio.begin();

  if (state == RADIOLIB_ERR_NONE) {
    Serial.println(F("success!"));
  } else {
    Serial.print(F("failed, code "));
    Serial.println(state);
    while (true) { delay(10); }
  }

  Serial.print(F("[Pager] Initializing ... "));

  state = pager.begin(439.9885, 1200);
  if (state == RADIOLIB_ERR_NONE) {
    Serial.println(F("success!"));
  } else {
    Serial.print(F("failed, code "));
    Serial.println(state);
    while (true) { delay(10); }
  }

  Serial.print(F("[Pager] Starting to listen ... "));
  state = pager.startReceive(pin, 0, 0);
  if (state == RADIOLIB_ERR_NONE) {
    Serial.println(F("success!"));
  } else {
    Serial.print(F("failed, code "));
    Serial.println(state);
    while (true) { delay(10); }
  }
}

void loop() {
  if (pager.available() >= 2) {
    Serial.print(F("[Pager] Received pager data, decoding ... "));
    String str;
    int state = pager.readData(str);

    if (state == RADIOLIB_ERR_NONE) {
      Serial.println(F("success!"));

      // print the received data
      Serial.print(F("[Pager] Data:\t"));
      Serial.println(str);
    } else {
      Serial.print(F("failed, code "));
      Serial.println(state);
    }
  }
}

This code shows all pager messages it receives, in the line “state = pager.startReceive(pin, 0, 0);” the first 0 is the address of the pager and the second 0 is the mask. Putting both of them to 0 shows all received messages.

Categories