Skip to content

CPY-CC1101 a CircuitPython library for CC1101 RF Transceivers. I use it with a CC1101 Arduino module connected trough SPI to an Adafruit M4 Express.

License

Notifications You must be signed in to change notification settings

unixb0y/CPY-CC1101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

CPY-CC1101 is a simple Python library for the CC1101 RF Transceiver written for CircuitPython so that it runs on Adafruits new CircuitPython-supporting devices like the Feather M0 and M4. I use it on an Adafruit Feather M4 Express with a CC1101 Arduino module connected trough SPI.

Example code for a receiver:

from cpc.cpc import *

myspi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs = DigitalInOut(board.D9)
gdo0 = DigitalInOut(board.D10)

rx = CC1101(myspi, cs, gdo0, 50000, 434400000, "666A")
# SPI object, Chip Select Pin, baudrate, frequency in Hz, Syncword

rx.setupRX()
while True:
	rx.receiveData(0x19)

Example code for a transmitter:

from cpc.cpc import *

myspi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs = DigitalInOut(board.D9)
gdo0 = DigitalInOut(board.D10)

rx = CC1101(myspi, cs, gdo0, 50000, 434400000, "666A")
# SPI object, Chip Select Pin, baudrate, frequency in Hz, Syncword

rx.setupTX()
rx.sendData("0000111100001111", "666A")
  • Transmitting data is done through the sendData(bitstring, syncword) function. It takes a string of payload data bits to transmit and a sync word of 16 bits that is prepended to the payload data. The file code_tx.py is some simple bare-bones code that just does TX and also works fine, but I would just use cpc.py.

  • The receiver works easily as well, like shown above with receiveData(length). You should simply pass the length of the data that should be received as a number.

  • TO DO: Actually use the baudrate parameter of the constructor, right now it doesn't do anything and the rate is hardcoded in MDMCFG4 and MDMCFG3.

You can have multiple antennas by just using a single SPI object and passing it to the various CC1101 objects.

myspi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)

cs_a = DigitalInOut(board.D9)
cs_b = DigitalInOut(board.D6)
rx = CC1101(myspi, cs_a, gdo0_a, 50000, 434400000, "666A")
tx = CC1101(myspi, cs_b, gdo0_b, 50000, 434400000, "666A")

# then do stuff with either one of the antennas, but only AFTER creating both CC1101 objects.

For more details or questions, feel free to contact me, open an issue and first of all, have a look at the official documentation / datasheet!

Resources for RollJam, which can be implemented with this library:
https://www.rtl-sdr.com/tag/rolljam/
https://spencerwhyte.blogspot.com/2014/03/delay-attack-jam-intercept-and-replay.html?m=1
https://samy.pl/defcon2015/

About

CPY-CC1101 a CircuitPython library for CC1101 RF Transceivers. I use it with a CC1101 Arduino module connected trough SPI to an Adafruit M4 Express.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages