Arduino Mega 2560 To Work With Ebyte E07-M1101D-SMA CC1101 Transceiver — Sending and Receiving Data
Schematic Diagram. I converted Pins Listed for a UNO to Work for Other Arduinos including the Mega Below. At the Bottom I provide the Manuel to the CC1101 Module with in depth Package info
Components Resources:
Arduino 2560 :
http://store.arduino.cc/products/arduino-mega-2560-rev3
PIN CONNECTIONS CONVERSION TO MEGA
Example Repo
https://github.com/LSatan/SmartRC-CC1101-Driver-Lib/tree/master/examples
SENDING FSK DATA
#include <ELECHOUSE_CC1101_SRC_DRV.h>
#include <avr/io.h>
#include <avr/boot.h>
#include <inttypes.h>
#include <stdbool.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <string.h>
#include <avr/wdt.h>
#include <util/atomic.h>
#include <util/crc16.h>
#include <inttypes.h>
#include <ELECHOUSE_CC1101_SRC_DRV.h>
const int n = 61;
byte buffer[n] = “”;
void setup() {
// Following section enables SmartRC CC1101 library
// to work with Arduino Pro Micro
// if using different board, please remove it
// defining PINs set for Arduino Pro Micro setup
byte sck = 52;
byte miso = 50;
byte mosi = 51;
byte ss = 53;
int gdo0 = 6 ;
// initializing library with custom pins selected
ELECHOUSE_cc1101.setSpiPin(sck, miso, mosi, ss);
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.setGDO0(gdo0); // set lib internal gdo pin (gdo0). Gdo2 not use for this example.
ELECHOUSE_cc1101.setCCMode(1); // set config for internal transmission mode.
ELECHOUSE_cc1101.setModulation(0); // set modulation mode. 0 = 2-FSK, 1 = GFSK, 2 = ASK/OOK, 3 = 4-FSK, 4 = MSK.
ELECHOUSE_cc1101.setMHZ(433.92); // Here you can set your basic frequency. The lib calculates the frequency automatically (default = 433.92).The cc1101 can: 300–348 MHZ, 387–464MHZ and 779–928MHZ. Read More info from datasheet.
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.setPA(10); // set TxPower. The following settings are possible depending on the frequency band. (-30 -20 -15 -10 -6 0 5 7 10 11 12) Default is max!
ELECHOUSE_cc1101.setCrc(1); // 1 = CRC calculation in TX and CRC check in RX enabled. 0 = CRC disabled for TX and RX.
Serial.println(“Tx Mode”);
}
void loop() {
if (Serial.available()) {
int len = Serial.readBytesUntil(‘\n’, buffer, n);
buffer[len] = ‘\0’;
Serial.println((char *)buffer);
ELECHOUSE_cc1101.SendData(buffer, len);
Serial.print(“Buffer: “);
for (int i = 0; i<len; i++){
Serial.println(buffer[i]);
}
Serial.print(“len: “);
Serial.println(len);
}
}