Cc1101 подключение к ардуино
CC1101 radio example
So, I’ve made a video with some radio modules you could use. In this case we will see the CC1101 radio module with SPI serial communication. See the connections below, download the example code and test if it works. You will need the ELECHOUSE_CC1101 library as well so download that from the links below. You need two modules, an LED and a potentiometer and we will send just one byte of data, 0 to 255 values. The range for this module could be up to 400m abut we need a lot of pins to use this.
PART 1 — The CC1101
Ok, guys let’s move to the CC 11 01 radio module. There are different modules with different frequencies. The frequencies can also be modified. The most popular and also the most used band is the 70 cm band. Again, the module is used via the SPI interface. You might find that the module can not be connected directly to the SPI pins because of the 3.3 Volts operating voltage. And basically this is true, however, during my test I’ve used this with my Arduino and I had no problems. It has a maximum operating speed of 500KB per second and according to the user manual, it could send data up to 500 meters but that depending on the environment, the antenna and baud rate. There are also some small power amplifiers that you could use to increase the transmission power by up to 5 watts. With power amplifiers, you can get over 15 kilometers according to some internet posts I’ve found.
For this module you will need the CC1101 library you will find below in the code link. Make the connenctions for the modules as in the schematic. For breadboard connection you will need a jumper like the one I’ve made with some female and male pins. Download the example code from below and upload those to the Arduinos. You have the transmitter and receiver examples and again, the transmission is working and I can control the LED using radio connection.
PART 2 — Schematic
The schematic is simple but with a lot of pins. We have 2 Arduino NANO and we will use 3.3V from the Arduino in this case. If this doesn’t work, connect an external 3.3V supply and share ground. Anyway, connect the SPI pins and add a potentiometer, and LED and a resistor. Upload the codes below to the transmitter and receiver and read the comments in the code for more. Test if it works and you could change the brightness of the LED using the radio connection.
3.1 Transmitter
Here we have the transmitter code. You will need the ELECHOUSE_CC1101 library for this module so download that from the code link below and install it to the Arduino IDE. Uplaod this code to the Arduino with the potentiometer. Read the comments in the code for more. Copy or download the code from below.
Cc1101 подключение к ардуино
Copy raw contents
driver library for Ti CC1100 / CC1101.
Contains Lib for Arduino and Raspberry Pi.
Note: Raspi need wiringPi
a compatible and tested library for TI MSP430 is provided by abhra0897.
https://github.com/abhra0897/msp430_cc1101_energia_v2
If you are happy with the library and you want to spend me a beer, please feel free to use the following link. ;)
check cc1101_arduino.h and/or cc1101_raspi.h for Pin description
CC1101 Vdd = 3.3V CC1101 max. digital voltage level = 3.3V (not 5V tolerant)
General description of RF packet
pkt_len = count of bytes which shall transfered over air (rx_addr + tx_addr + payload data)
rx_addr = address of device, which shall receive the message (0x00 = broadcast to all devices)
tx_addr = transmitter or my address. the receiver should know who has sent a message.
payload = 1 to 60 bytes payload data.
TX Bytes example:
-> 0x06 0x03 0x01 0x00 0x01 0x02 0x03
use uint8_t CC1100::begin(volatile uint8_t &My_addr) always as first configuration step. For Arduino devices, this function returns the device address, which was already stored in the Arduino EEPROM.
you should set a unique device address for the transmitter and a unique device address for the receiver. This can be done with void CC1100::set_myaddr(uint8_t addr).
i.E. -> TX = 0x01 ; RX = 0x03
the following modulation modes can be set by void CC1100::set_mode(uint8_t mode). Transmitter and receiver must have the same Mode setting.
ISM frequency band
you can set a frequency operation band by void CC1100::set_ISM(uint8_t ism_freq) to make it compatible with your hardware.
CC1101 RF settings must be stored in the Arduino EEPROM to have maximum flexibility with different mode settings and reduced memory usage. Follow the following steps, how to store the compiled EEPROM file (*.eep) to your Arduino EEPROM. From my experience, you have to repeat this step only, if you have changed the Arduino Version, because the gcc compiler defines the location of the eeprom settings.
- compile the tx_demo or rx_demo example sketch
- remember the path of your compiled output data (Arduino *.hex file and *.eep file)
- use the python eeprom_create.py to generate the eeprom array for the eeprom_write.ino This is needed because the compiler can choose the EEPROM position by its own.
- usage: ./eeprom_create.py
- you get an output file with like *.array
- open that file and copy the array content into the eeprom_write.ino sketch at the correct position
- compile the eeprom_write.ino sketch
- upload into to your connected arduino hardware
- open the Arduino Serial console, set the baudrate to 38400 and restart your arduino hardware
- type the character w to the input field and press the sent button
- wait till eeprom is written
- sent r to verify that eeprom is written.
- if your EEPROM data is written correct, you can compile and upload the RX_Demo or TX_Demo sketch to that hardware
How to compile Raspi Demo files
be sure first, that you have already wiringPi installed on your Raspberry Pi hardware.
Cc1101 подключение к ардуино
There is also a video on YouTube for this article: Arduino CC1101 Transceiver
The CC1101 433 mhz wireless module is a good transceiver for the Arduino board. There are different modules with different frequencies. The frequencies can also be modified. The most popular and also the most used band is the 70 cm band. With the SMA antenna connector it is also possible to use larger and more profitable antennas. The module is wired via the SPI interface. On other websites you will often read that the module can not be connected directly to the SPI pins because of the 3.3 Volt operating voltage. Basically this is true, however, during our test we connected the module directly to the Arduino for a few days and we could not detect any problems.
The module is connected via the SPI pins and powered with 3.3 volts. Therefore the pins are not changeable.
Range test
The module has a better range than the combination of RF-5V & FS1000A modules. Outside you can reach with the supplied antenna a range of 300 meters without problems. With better antennas you can reach ranges of up to 5 kilometers. There are also small power amplifiers that can be used to increase the transmission power by up to 5 watts. With power amplifiers, you can bridge distances of over 15 kilometers. If you want to operate the module with better antennas and amplifiers, you must have an amateur license and comply with the legal requirements.
Code for the Transmitter:
Code for the Receiver:
About the Author
Alex, the founder of AEQ-WEB. He works for more of 10 years with different computers, microcontroller and semiconductors. In addition to hardware projects, he also develops websites, apps and software for computers.
Top articles in this category:
PT1000 Converter for Arduino
PT1000 sensors can not be measured directly analog with a microcontroller. How to build a PT100 Converter with LM358 and Arduino?
Arduino LCD Interface
On this page we show you how to create an interface for a TFT display with an Arduino. You can download source code and library here
Cc1101 подключение к ардуино
A clone of the ELECHOUSE_CC1101 http://www.elechouse.com library updated for Arduino 1.0 plus.
I made the following changes to the original library.
- Changed imports of WProgram.h to Arduino.h in line with Arduino 1.0+
- Changed the init method so that you have to set the carrier frequency
Connecting an Arduino to a CC1101
These instructions are for an Arduino Uno.
Arduino | CC1101 | Notes |
---|---|---|
GND | GND | |
3.3V | VCC | |
10 | CSN/SS | Must be level shifted to 3.3V |
11 | SI/MOSI | Must be level shifted to 3.3V |
12 | SO/MISO | |
13 | SCK | Must be level shifted to 3.3V |
2 | GD0 | Signals buffer ready to read |
Installing the Library
To install the library into your IDE:
- click on the Clone or Download button on this Github page and select Download ZIP.
- Start the Arduino IDE and from the Sketch menu do Sketch->Include Library->Add ZIP Library and select the ZIP you just downloaded.
This is a very easy library to use. You may just wish to try out the examples, that send a text message from one Arduino to another using the Serial Monitor. But for completeness, here it is:
Put this in your setup function.
Put this in your setup function and call again, any time after you have processed a received message.
When a new message arives GD0 on the CC1101 (Arduino pin 2) will be set LOW. You can hook this up to an interrupt or just watch for it in your loop function.
The maximum data size is 64 bits.
ReceiveData requires a buffer of type byte[] and returns the number of bytes contained in the message.
The maximum data size is 64 bits.
SendData requires a buffer of type byte[] and the number of bytes contained in the message.
simonmonk/CC1101_arduino
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
A clone of the ELECHOUSE_CC1101 http://www.elechouse.com library updated for Arduino 1.0 plus.
I made the following changes to the original library.
- Changed imports of WProgram.h to Arduino.h in line with Arduino 1.0+
- Changed the init method so that you have to set the carrier frequency
Connecting an Arduino to a CC1101
These instructions are for an Arduino Uno.
Arduino | CC1101 | Notes |
---|---|---|
GND | GND | |
3.3V | VCC | |
10 | CSN/SS | Must be level shifted to 3.3V |
11 | SI/MOSI | Must be level shifted to 3.3V |
12 | SO/MISO | |
13 | SCK | Must be level shifted to 3.3V |
2 | GD0 | Signals buffer ready to read |
Installing the Library
To install the library into your IDE:
- click on the Clone or Download button on this Github page and select Download ZIP.
- Start the Arduino IDE and from the Sketch menu do Sketch->Include Library->Add ZIP Library and select the ZIP you just downloaded.
This is a very easy library to use. You may just wish to try out the examples, that send a text message from one Arduino to another using the Serial Monitor. But for completeness, here it is:
Put this in your setup function.
Put this in your setup function and call again, any time after you have processed a received message.
When a new message arives GD0 on the CC1101 (Arduino pin 2) will be set LOW. You can hook this up to an interrupt or just watch for it in your loop function.
The maximum data size is 64 bits.
ReceiveData requires a buffer of type byte[] and returns the number of bytes contained in the message.
The maximum data size is 64 bits.
SendData requires a buffer of type byte[] and the number of bytes contained in the message.