Cc1101 подключение к ардуино

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.

Источник

Cc1101 подключение к arduino

Cc1101 подключение к arduino

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.

Источник

Arduino.ru

Подключение трансивера на CC1101 к Arduino

  • Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Доброго времени суток! Заказал себе 2 модуля трансивера на базе CC1101 (вот viewitem.eim.ebay.ru/2PCS—Wireless-RF-Transceiver-Module-433Mhz-CC1101-CC1100-/260915767551/item) и немного не понимаю, как их подключить.

1) Модули 3.3в, нужен преобразователь уровней. Можно просто воспользоваться делителем напряжения для линий из дуины в модуль (Slave In, Slave Select, Clock, Vcc) и напрямую подключить линию из модуля в дуину (slave out)?

2)Совсем не понял как посылать и принимать данные, всяческое изменения регистров, SmartRF Studio и прочее далеки от моего понимания :-(

Если кто-нибудь знает как работать с этой штукой (или CC1100, они почти аналогичны), подскажите? Заранее спасибо.

Промучился с этой штукой, почти ничего не добился, хотябы подключил и работает (отсылает статус-байты)

Чтобы сконфигурировать ее, получил значения с SmartRF Studio, загнал в массив [адресс][значение]

Чтобы записать, надо «наложить на адресс маску 0х00, а чтобы считать 0х80». Наложить маску — это как. Насколько я понял из даташита, то первый байт отправляемый по СПИ дожен выглядеть так [байт чтения\записи][байт одиночная запись\бурст запись][адресс]. 0-запись, 1 — чтение; 0-1 байт, 1-бурст. Т.о для чтения одного байта надо к его адресу прибавить 0x80, для записи одного — 0x00, для бурст соответсвенно 0xC0 и 0x40.

Вот так я делаю:

По идее, должен отсылать — но никак, токопотребление не возрастает. ЧТо я неправильно делаю?

До сих пор не получил результат. Как бы получается записывать регистры, вроде все понял, но постоянно статус-байт возвращает «TX FIFO has underflowed. Acknowledge with SFTX». Как-то получалось, что возвращалось и режим TX, RX, Fast Tx ready, но редко. В основном TX FIFO has underflowed.

Ставлю длина пакета фиксированная, 1 байт, Ограничения TX FIFO тоже 1 байт. Даташит утверждает, что Underflowed возникает при кол-ве байт ниже ограничения. Но ведь я записываю туда байты. Пишу:

А все равно underflowed. В чем может быть причина? Я неправильно пишу в регистры?

Кажется что-то есть. По прежнему пишет «TX FIFO underflowed», но судя по току (16мА, как раз ток передачи при 0Дб) передача идет. Что немного странно. Идет и с фиксированной, и с переменной длиной пакета.

Код (пока что кривой и отладочный):

Странно, я его почти не менял с предыдущего раза. А тут возьми и заработай. Я только не 1 байт стал писать, а МНОГО!

можно узнать чем все закончилось ?

Спасибо за код, помог начать разбираться с таким же устройством. Появились вопросы:

— У CC1101 согласно документации 47 регистров для конфигурирования (address 0 to address 0x2E), вы записываете 50.

— Строки кода 134-136 вообще выполняются когда-либо?

— В цикле перед вызовом WrReg вывод SS прижимается, внутри WrReg он прижимается еще раз и так же повторно вы его подтягиваете внутри функции и после выхода из нее.

— Вы устанавливаете BURST бит, но при этом используете single access. Смысл?

Вдруг кому еще интересно — есть резульат! Все попытки пообщаться с устройством через готовую SPI ( #include ) библиотеку успехом не увенчались — получаемые данные ничего общего с тем, что ожидалось, не имели. Сегодня решил руками реализовать протокол по даташиту, благо там все элементарно. И вуаля! Девайс отвечает именно теми данными, которые описаны в даташите. Пока реализована только возможность чтения из регистров, но дальше уже все тривиально! Почему не работает стандартный SPI посмотрю, как только придет логический анализатор.

По поводу SPI думаю, что все банально — так делать нельзя просто:

177 SPI.transfer(_Adr | 0x40); //Пишим адрес и маску бурст записи
178 SPI.transfer(_Val); //Пишим значения

Таким образом мы делаем два отдельных посыла, а не один из адреса и значения, поэтому и получаем фигню. Как будет время, перепишу обратно код на использование SPI библиотеки — использование аппаратных возможностей все же лучше, чем софтовая их реализация. Но для понимания работы SPI было интересно. Ваш Капитан Очевидность.

Короче, я в тупике — сплошной секс слепых в крапиве. Информации куча, но поймать сигнал от беспроводного датчика погодной станции не удается. Все, что я вижу, это скачки RSSI в момент передачи. Прерывание на прием пакета не срабатывает. Оно с какой то радости срабатывает при инициализации. Код ниже. Если кто-то может хоть что-то подсказать, буду рад. И еще — библиотека SPI работать так и отказалась — остался на софт реализации протокола.

По поводу SPI думаю, что все банально — так делать нельзя просто:

177 SPI.transfer(_Adr | 0x40); //Пишим адрес и маску бурст записи
178 SPI.transfer(_Val); //Пишим значения

Таким образом мы делаем два отдельных посыла, а не один из адреса и значения, поэтому и получаем фигню.

Это одно и то же. SPI не предполагает каких либо сигналов между двумя посылами.

Вероятнее всего, Вы просто не угадали с режимом: в SPI масса настроек (скорость, порядок следования битов, фаза синхросигнала, по какому фронту происходит запись и чтение). Коль изучили дэйташит на девайс, сможете понять, какого именно режима он требует, и установить в этот режим SPI контроллер Ардуино.

Между может и не предполагает, а вот в начале и конце посылки меняется уровень CSN, а этого как раз и не требуется. Настроек у SPI не такая уж и масса, и на первый взгляд там нет того, что требуется. Да и это пока что далеко не первоочередная дазача. Проблема в том, что CC1101 в принципе не хочет делать того, что мне нужно. Вернее, я не знаю, как его заставить — слишком большое количество настроек и нюансов. :(

Пока есть конкретный вопрос — я не понимаю, почему у меня дергается каждый при запуске скетча функция, привязанныя к внешнему прерыванию. В чем причина — не пойму.

Покурив даташиты (все ссылки на найденную литературу по CC1101 можной найти в самом начале скатча), был найден режим синхронной передачи данных, который выдает сырые полученные данные. Так как данные из эфира он получает постоянно — эфир зашумлен, был сделан своебразный фильтр по уровню принемаемого сигнала — учитывать уровень не менее, чем -60дБм. Значение чисто эмпирическое. Но фигня в том, что данные вылупляются со скоростью 500кбод. Это значение взято с потолка, так как неизвестен ни тип модуляции, ни символьная скорость передачи, ни длина посылов, ни, тем более, используемый протокол. Какая именно используется скорость передачи буду как-то выяснять эксперементально. Без этого пытаться расшифровать полученные данные бесполезно. Код ниже, опять же — принимаются любые мысли по тому, как упростить задачу.

UPD. Метод научного тыка — так себе. Стоило утащить датчик на свое место на балкон, как фильтр в -60 отсек полезный сигнал, а повышение чуствительности приводит к тому, что идет постоянный прием мусора. Надо что-то с этим делать.. А вот что.

Источник

SpaceTeddy/CC1101

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

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.

Источник