2ASK over the air

Sending 2ASK (on-off keying) data with a CC1101 module and Arduino, finding the frequency offset with SDR++, and decoding "Hello world" in GNU Radio.

1. What’s 2ASK (simply ON-OFF)

2ASK (on-off keying) waveform

2. Connect CC1101 with Arduino

Need to connect CC1101 first. I used Arduino, and here’s pinout of CC1101 module:

CC1101 module pinout
CC1101 module pin labels

Connection like this:

Wiring between CC1101 and Arduino

3. Find frequency shift of CC1101

Many RF modules have frequency shift, you need to find it first before any digital signal process. Here I set ELECHOUSE_cc1101.setMHZ(433.92), I used SDR++ to locate the center frequency which is 433.96MHz, then the shift is 40KHz. I also used SDR++ to save the data as WAV to be processed in GNU radio.

SDR++ spectrum showing the CC1101 center frequency at 433.96 MHz

4. Find sync word

In order to communicate, there’s a sync word to tell you that the data is going to be sent. Here I set

ELECHOUSE_cc1101.setSyncMode(2) which is 16/16 sync mode. Then construct a ASK receiver in GNU radio:

ASK receiver flowgraph in GNU Radio

Send 0x01, 0x02, 0x04, 0x08, 0x18 respectively and check ASK signals over the air, the results are saved as WAV. The following signals all have a 1010101010101010 sync word while the last one pulse left shift bit by bit.

send byte 0x01 (noCRC-9.6kbps-ASK):

ASK signal of byte 0x01 without CRC at 9.6 kbps

send byte 0x02 (noCRC-9.6kbps-ASK):

ASK signal of byte 0x02 without CRC at 9.6 kbps

send byte 0x04 (noCRC-9.6kbps-ASK):

ASK signal of byte 0x04 without CRC at 9.6 kbps

send byte 0x08 (noCRC-9.6kbps-ASK):

ASK signal of byte 0x08 without CRC at 9.6 kbps

send byte 0x18 (noCRC-9.6kbps-ASK):

ASK signal of byte 0x18 without CRC at 9.6 kbps

send byte 0x01 (CRC-9.6kbps-ASK):

The CRC checksum is appended to the end.

ASK signal of byte 0x01 with CRC at 9.6 kbps

5. Using CC1101 module to send ASK message: “Hello world”

“Hello world” transferred to bytes is {0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64} which over the air is actually like this:

010010000110010101101100011011000110 \\1111001000000101011101101111011100\\100110110001100100

#include <ELECHOUSE_CC1101_SRC_DRV.h>

byte transmitt_byte[11] = {0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64};

void setup() {
    Serial.begin(9600);
    if (ELECHOUSE_cc1101.getCC1101()){        // Check the CC1101 Spi connection.
    Serial.println("Connection OK");
    }else{
    Serial.println("Connection Error");
    }

    ELECHOUSE_cc1101.Init();              // must be set to initialize the cc1101!
    ELECHOUSE_cc1101.setCCMode(1);       // set config for internal transmission mode.
    ELECHOUSE_cc1101.setModulation(2);  // 0 = 2-FSK, 1 = GFSK, 2 = ASK/OOK, 3 = 4-FSK, 4 = MSK.
    // !Frequency shift: +0.04MHz
    ELECHOUSE_cc1101.setMHZ(433.92);   // 300-348 MHZ, 387-464MHZ and 779-928MHZ.
    ELECHOUSE_cc1101.setSyncMode(2);  // Combined sync-word qualifier mode. 0 = No preamble/sync. 1 = 16 sync word bits detected. 2 = 16/16 sync word bits detected. 3 = 30/32 sync word bits detected. 4 = No preamble/sync, carrier-sense above threshold. 5 = 15/16 + carrier-sense above threshold. 6 = 16/16 + carrier-sense above threshold. 7 = 30/32 + carrier-sense above threshold.
    ELECHOUSE_cc1101.setCrc(0);     // 1 = CRC calculation in TX and CRC check in RX enabled. 0 = CRC disabled for TX and RX.
    ELECHOUSE_cc1101.setDRate(9.6); // 9.6kbps
    Serial.println("Tx Mode");
}

void loop() {
    ELECHOUSE_cc1101.SendData(transmitt_byte,11,100);
    delay(2000);
}

In the GNU radio:

GNU Radio capture of the Hello world ASK transmission

Put the bytes over the image, it’s “Hello world”:

Hello world bytes decoded from the ASK waveform