CC1101 is a low-cost sub 1GHz transceiver designed for low power wireless applications. The circuit is mainly used for Industrial, Scientific, and Medical (ISM) and Short Range Device (SRD) frequency bands running @ 315, 433, 868, and 915 MHz and can easily be programmed for running at other frequencies like 300 ~ 348 MHz, 387 ~ 464 and 779 ~ 928 MHz Band. CC1101 is an improved and code compatible version of the CC1100 RF TRX. The main improvements of the CC1101 include spurious response, enhance close-in phase noise, adjacent channel (ACP), higher saturation level, better output power ramping, and extended frequency bands of operation.
CC1101 RF Transceiver Block Diagram
The module uses CC1100 Chip, running at 433 MHz , 868 MHz, 915 MHz of ISM Band, contains of a modulator a receiver with demodulator, power amp, crystal oscillator and regulator preamble and the CRC code generated automatically which can be easily configure through SPI (Serial Peripheral Interface).
PIN Configuration
- VCC > Power Input | 1.9v to 3.6v
- SI > Digital Input | Serial Configuration Interface, Data Input
- SCLK > Digital Input | Serial Configuration Interface, Clock Input / Data Output
- SO (GDO1) > Digital Output | Optional Output Test Signals
- GDO2 > Digital Output | FIFO Status Signals | Clear Channel Indicator | Clock Output, Down-Divided from XOSC | Serial Output RX Data
- CSN > Digital Input > Serial Configuration Interface, Chip select Digital Output
- GDO0 > Digital I/O > Clock Output, Down Divided from XOSC, Serial Output RX Data, Serial Input TX Data, Analog Text I/O for Prototype / Production Testing
- GND > Ground Analog | Analog Ground Connection
Transmission distance: 300 – 500 meters (Depending on the specific situation of the environment and communication baud rate, etc.)
Required Components
- Arduino Microcontroller, TEENSY, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21D, ATTINY85 16/8 MHz
- CC1100 / CC1101 Breakout Module
- Solder Less Bread Board
- Jumper Wire / DuPont Wire
Wiring Guide
Source Code for Transmitter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
#include "EEPROM.h" #include "cc1101.h" CC1101 cc1101; // The LED is wired to the Arduino Output 4 (physical panStamp pin 19) #define LEDOUTPUT 13 // counter to get increment in each loop byte counter; byte b; byte syncWord = 199; void blinker(){ digitalWrite(LEDOUTPUT, HIGH); delay(100); digitalWrite(LEDOUTPUT, LOW); delay(100); } void setup() { Serial.begin(9600); Serial.println("start"); // setup the blinker output pinMode(LEDOUTPUT, OUTPUT); digitalWrite(LEDOUTPUT, LOW); // blink once to signal the setup blinker(); // reset the counter counter=0; Serial.println("initializing..."); // initialize the RF Chip cc1101.init(); cc1101.setSyncWord(&syncWord, false); cc1101.setCarrierFreq(CFREQ_433); cc1101.disableAddressCheck(); //cc1101.setTxPowerAmp(PA_LowPower); delay(1000); Serial.print("CC1101_PARTNUM "); //cc1101=0 Serial.println(cc1101.readReg(CC1101_PARTNUM, CC1101_STATUS_REGISTER)); Serial.print("CC1101_VERSION "); //cc1101=4 Serial.println(cc1101.readReg(CC1101_VERSION, CC1101_STATUS_REGISTER)); Serial.print("CC1101_MARCSTATE "); Serial.println(cc1101.readReg(CC1101_MARCSTATE, CC1101_STATUS_REGISTER) & 0x1f); Serial.println("device initialized"); //Serial.println("done"); } void send_data() { CCPACKET data; data.length=10; byte blinkCount=counter++; data.data[0]=5; data.data[1]=blinkCount;data.data[2]=0; data.data[3]=1;data.data[4]=0; //cc1101.flushTxFifo (); Serial.print("CC1101_MARCSTATE "); Serial.println(cc1101.readReg(CC1101_MARCSTATE, CC1101_STATUS_REGISTER) & 0x1f); if(cc1101.sendData(data)){ Serial.print(blinkCount,HEX); Serial.println(" sent ok :)"); blinker(); }else{ Serial.println("sent failed :("); blinker(); blinker(); } } void loop() { send_data(); delay(500); } |
Source Code for Receiver
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
#include "EEPROM.h" #include "cc1101.h" // The LED is wired to the Arduino Output 4 (physical panStamp pin 19) #define LEDOUTPUT 4 // The connection to the hardware chip CC1101 the RF Chip CC1101 cc1101; byte b; byte i; byte syncWord = 199; long counter = 0; byte chan = 0; // a flag that a wireless packet has been received boolean packetAvailable = false; void blinker() { digitalWrite(LEDOUTPUT, HIGH); delay(100); digitalWrite(LEDOUTPUT, LOW); delay(100); } /* Handle interrupt from CC1101 (INT0) gdo0 on pin2 */ void cc1101signalsInterrupt(void) { // set the flag that a package is available packetAvailable = true; } void setup() { Serial.begin(9600); Serial.println("start"); // setup the blinker output pinMode(LEDOUTPUT, OUTPUT); digitalWrite(LEDOUTPUT, LOW); // blink once to signal the setup blinker(); // initialize the RF Chip cc1101.init(); cc1101.setSyncWord(&syncWord, false); cc1101.setCarrierFreq(CFREQ_433); cc1101.disableAddressCheck(); //if not specified, will only display "packet received" //cc1101.setTxPowerAmp(PA_LowPower); Serial.print("CC1101_PARTNUM "); //cc1101=0 Serial.println(cc1101.readReg(CC1101_PARTNUM, CC1101_STATUS_REGISTER)); Serial.print("CC1101_VERSION "); //cc1101=4 Serial.println(cc1101.readReg(CC1101_VERSION, CC1101_STATUS_REGISTER)); Serial.print("CC1101_MARCSTATE "); Serial.println(cc1101.readReg(CC1101_MARCSTATE, CC1101_STATUS_REGISTER) & 0x1f); attachInterrupt(0, cc1101signalsInterrupt, FALLING); Serial.println("device initialized"); } void ReadLQI() { byte lqi = 0; byte value = 0; lqi = (cc1101.readReg(CC1101_LQI, CC1101_STATUS_REGISTER)); value = 0x3F - (lqi & 0x3F); Serial.print("CC1101_LQI "); Serial.println(value); } void ReadRSSI() { byte rssi = 0; byte value = 0; rssi = (cc1101.readReg(CC1101_RSSI, CC1101_STATUS_REGISTER)); if (rssi >= 128) { value = 255 - rssi; value /= 2; value += 74; } else { value = rssi / 2; value += 74; } Serial.print("CC1101_RSSI "); Serial.println(value); } void loop() { if (packetAvailable) { Serial.println("packet received"); // Disable wireless reception interrupt detachInterrupt(0); ReadRSSI(); ReadLQI(); // clear the flag packetAvailable = false; CCPACKET packet; if (cc1101.receiveData(&packet) > 0) { if (!packet.crc_ok) { Serial.println("crc not ok"); } if (packet.length > 0) { Serial.print("packet: len "); Serial.print(packet.length); Serial.print(" data: "); for (int j = 0; j < packet.length; j++) { Serial.print(packet.data[j], HEX); Serial.print(" "); } Serial.println("."); } } // Enable wireless reception interrupt attachInterrupt(0, cc1101signalsInterrupt, FALLING); } } |
Downloads
- Download CC1101 Arduino Code Library | ZIP
- Download CC1101 Transceiver Datasheet | PDF
- Download CC1101 Module Manual | PDF
i always get the following error:
/home/username/Arduino/libraries/CC1101/EEPROM.h:25:24: fatal error: avr/eeprom.h: No such file or directory
#include
^
compilation terminated.
exit status 1
I cannot compile it for attiny85. are you sure it is working?