update readme
This commit is contained in:
parent
e6e9efd73e
commit
625502a04e
91
README.md
91
README.md
@ -1,3 +1,94 @@
|
|||||||
# cat-tracker
|
# cat-tracker
|
||||||
|
|
||||||
A multi-function application designed to run on a pi node. When used in a mesh network, this app will help track your cat with a CC2500 based radio collar, using complementary CC2500 based radio modules interfaced with your Pi.
|
A multi-function application designed to run on a pi node. When used in a mesh network, this app will help track your cat with a CC2500 based radio collar, using complementary CC2500 based radio modules interfaced with your Pi.
|
||||||
|
|
||||||
|
The implementation here uses CC2500 register values which intend to mimic my [Girafus M07A](https://www.girafus.com/en-en/collections/peilsender/products/ersatzteil-basismodul-fur-girafus%C2%AE-pro-track-tor-katzen-hunde-haustier-kleintier-sucher) unit. This unit is paired with my associated [tracker](https://www.girafus.com/en-en/collections/peilsender/products/extra-sender-tag-fur-den-girafus%C2%AE-pro-track-tor-haustier-hund-katze-kleintier-finder-sucher-ortung)
|
||||||
|
|
||||||
|
## CC2500 datasheet
|
||||||
|
[cc2500.pdf](./cc2500.pdf)
|
||||||
|
|
||||||
|
## CC2500 to Raspberry Pi GPIO Pin Mapping
|
||||||
|
|
||||||
|
| CC2500 Pin | Function Description | Raspberry Pi GPIO Pin | GPIO Number |
|
||||||
|
|------------|------------------------------------------------------|-------------------------------|-------------|
|
||||||
|
| GND | Ground | Pin 6 | - |
|
||||||
|
| VCC | 3.3V Power (⚠️ **Do not use 5V**) | Pin 1 or Pin 17 | - |
|
||||||
|
|
||||||
|
### SPI Connections
|
||||||
|
|
||||||
|
| CC2500 Pin | Function | Raspberry Pi GPIO Pin | GPIO Number |
|
||||||
|
|------------|----------|-------------------------------|-------------|
|
||||||
|
| SI | MOSI | Pin 19 | GPIO 10 |
|
||||||
|
| SCK | SCLK | Pin 23 | GPIO 11 |
|
||||||
|
| CSN | CE0 (Chip Select) | Pin 24 | GPIO 8 |
|
||||||
|
| SO | MISO | Pin 21 | GPIO 9 |
|
||||||
|
|
||||||
|
### Optional Pins
|
||||||
|
|
||||||
|
| CC2500 Pin | Function | Raspberry Pi GPIO Pin | GPIO Number |
|
||||||
|
|------------|-------------------------------------------|-------------------------------|-------------|
|
||||||
|
| GDO0 | Interrupt/Data Ready | Pin 12 | GPIO 18 |
|
||||||
|
| GDO2 | Additional Interrupt/Data Line | Pin 22 | GPIO 25 |
|
||||||
|
|
||||||
|
### Power Amplifier Pins (If Applicable)
|
||||||
|
|
||||||
|
| CC2500 Pin | Function | Raspberry Pi GPIO Pin | Notes |
|
||||||
|
|------------|-------------------------------------------|-------------------------------|----------------------------------------|
|
||||||
|
| PA_EN | Control Power Amplifier (Optional) | Any GPIO Pin | Connect if amplifier control is needed |
|
||||||
|
| PA_EX | Reserved | Not Connected | Only connect if required |
|
||||||
|
|
||||||
|
## Reverse Engineering the Registers
|
||||||
|
|
||||||
|
### SmartRF Studio
|
||||||
|
|
||||||
|
#### Install
|
||||||
|
[SmartRF Studio](https://www.ti.com/tool/SMARTRFTM-STUDIO#downloads) will automatically generate a configuration for the CC2500 Radio based on some RF parameters
|
||||||
|
* A free registration and login is required to download this app from Texas Instruments
|
||||||
|
* The app seems to run well via `wine` on linux. I chose to install it on an actual Windows OS, then copy the binaries.
|
||||||
|
|
||||||
|
#### Copy Register JSON template
|
||||||
|
When this is installed, copy the code export json file to help export the initial register configuration in a JSON format
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp srfexp_json.xml "~/Documents/Texas Instruments/SmartRF Studio v7/codeexport/."
|
||||||
|
# Example copy command for linux+wine
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Understanding necessary RF Parameters
|
||||||
|
In SmartRF Studio, open the CC2500 Device Controller under the 2.4 GHZ list.
|
||||||
|
|
||||||
|
At the time of writing, it is believed this device uses 250 kBaud MSK encoding. We will choose this option.
|
||||||
|
|
||||||
|
Next we need to figure out the Base Frequency, Channel numbers, and Channel Spacing
|
||||||
|

|
||||||
|
|
||||||
|
### Singal Capture
|
||||||
|
I have captured the initial signal emitted by the handheld unit when it is first powered on. To do this, I have used a HackRF SDR + gqrx application on linux.
|
||||||
|
|
||||||
|
The known frequency range is 2400 – 2483.5 MHz, and my SDR has a 20 MHZ bandwidth. I choose sweep for signals by tuning the following frequencies
|
||||||
|
| Sweep # | Center Frequency | Center Frequency (kHz) | Approx. Coverage (MHz) | Approx. Coverage (kHz) |
|
||||||
|
|---------|------------------|-------------------------|-------------------------|-----------------------------|
|
||||||
|
| 1 | 2410 MHz | 2,410,000 kHz | 2400 – 2420 MHz | 2,400,000 – 2,420,000 kHz |
|
||||||
|
| 2 | 2430 MHz | 2,430,000 kHz | 2420 – 2440 MHz | 2,420,000 – 2,440,000 kHz |
|
||||||
|
| 3 | 2450 MHz | 2,450,000 kHz | 2440 – 2460 MHz | 2,440,000 – 2,460,000 kHz |
|
||||||
|
| 4 | 2470 MHz | 2,470,000 kHz | 2460 – 2480 MHz | 2,460,000 – 2,480,000 kHz |
|
||||||
|
| 5 | 2483.5 MHz | 2,483,500 kHz | 2473.5 – 2483.5 MHz | 2,473,500 – 2,483,500 kHz |
|
||||||
|
#### Signal 0
|
||||||
|
2.431258000 GHz | 2431258.000 kHz
|
||||||
|

|
||||||
|
#### Signal 1
|
||||||
|
2.447257000 GHz | 2447257.000 kHz
|
||||||
|

|
||||||
|
#### Signal 2
|
||||||
|
2.450225000 GHz | 2450225.000 kHz
|
||||||
|

|
||||||
|
#### Signal 3
|
||||||
|
2.471275000 GHz | 2471275.000 kHz
|
||||||
|

|
||||||
|
|
||||||
|
#### Signal Summary
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Run
|
||||||
|
`python3 read.py`
|
BIN
images/signals/signal0.png
Normal file
BIN
images/signals/signal0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 401 KiB |
BIN
images/signals/signal1.png
Normal file
BIN
images/signals/signal1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 930 KiB |
BIN
images/signals/signal2.png
Normal file
BIN
images/signals/signal2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 560 KiB |
BIN
images/signals/signal3.png
Normal file
BIN
images/signals/signal3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 385 KiB |
BIN
images/smart_rf.png
Normal file
BIN
images/smart_rf.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
21
read.py
21
read.py
@ -14,7 +14,7 @@ global MASKS
|
|||||||
global ACCESS
|
global ACCESS
|
||||||
|
|
||||||
def asb (a):
|
def asb (a):
|
||||||
return int(b,16)
|
return int(a,16)
|
||||||
|
|
||||||
def strobe(command):
|
def strobe(command):
|
||||||
"""Send a command strobe to CC2500"""
|
"""Send a command strobe to CC2500"""
|
||||||
@ -42,25 +42,6 @@ def read_register(addr):
|
|||||||
response = spi.xfer2([READ_SINGLE | addr, 0x00])
|
response = spi.xfer2([READ_SINGLE | addr, 0x00])
|
||||||
return response[1]
|
return response[1]
|
||||||
|
|
||||||
def init_cc2500():
|
|
||||||
spi.open(0, 0) # Bus 0, CE0 (Pin 24)
|
|
||||||
spi.max_speed_hz = 2000000 # Safe start speed
|
|
||||||
spi.mode = 0b00 # SPI mode 0
|
|
||||||
|
|
||||||
print("Sending SRES (reset)...")
|
|
||||||
spi.xfer2([SRES])
|
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
print("Sending SNOP (no-op)...")
|
|
||||||
status = spi.xfer2([SNOP])[0]
|
|
||||||
print(f"Status byte: 0x{status:02X}")
|
|
||||||
|
|
||||||
print("Reading VERSION register...")
|
|
||||||
version = read_register(0x31)
|
|
||||||
print(f"CC2500 VERSION register: 0x{version:02X}")
|
|
||||||
|
|
||||||
spi.close()
|
|
||||||
|
|
||||||
def send_packet(data):
|
def send_packet(data):
|
||||||
# Flush TX FIFO
|
# Flush TX FIFO
|
||||||
strobe(0x3B) # SFTX
|
strobe(0x3B) # SFTX
|
||||||
|
14
srfexp_json.xml
Normal file
14
srfexp_json.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<registerexporttemplate>
|
||||||
|
<name><![CDATA[JSON]]></name>
|
||||||
|
<commentStart><![CDATA[//]]></commentStart>
|
||||||
|
<commentEnd><![CDATA[]]></commentEnd>
|
||||||
|
<paramSummary><![CDATA[0]]></paramSummary>
|
||||||
|
<paTable><![CDATA[0]]></paTable>
|
||||||
|
<header><![CDATA[{
|
||||||
|
]]></header>
|
||||||
|
<registers><![CDATA[ "@RN@"@<<@: @<<@{ "hex":"0x@VH@", "dec":@VD@},]]></registers>
|
||||||
|
<footer><![CDATA[}]]></footer>
|
||||||
|
<filename><![CDATA[@CHIPID@_simple_link_reg_config.json]]></filename>
|
||||||
|
<devices><![CDATA[]]></devices>
|
||||||
|
</registerexporttemplate>
|
Loading…
Reference in New Issue
Block a user