Skip to content

bigalnz/test_fft

Repository files navigation

kiwitracker

A project to log to standard console the BPM of a Chick Timer (CT) for Kiwi.

Background modes of transmitter

  • 80 BPM - Mortality mode
  • 46-48 BPM - Not incubating
  • 30 BPM - Incubating

Chick Timer (CT) modes

Every 10 minutes the transmitter pauses for 3 seconds then emits 8 groups of two digit numbers. Each pair of two digit numbers is seperated by a 3 second pause.

  1. Days since change of state
  2. Days since hatch
  3. Days since desertion alert
  4. Time of emergence
  5. Weeks of batt life for Tx
  6. Activity yesterday
  7. Activity 2 days ago
  8. True mean of last 4 days (activity)

Full manual http://wildtech.co.nz/downloads/NiB%20CT%20V3.4.pdf

To Do:

  • Add samples for testing purposes (weak signals, signals on ch00 and ch99, multiple signals, signals at 30, 48, 80 bpm, CT signals)
  • In sample_processor handle edge case where chunk edge goes through middle of a beep (falling edge array is empty). Add Boolean 'no_falling_edge' and track number of high samples for calculation of BEEP_DURATION on next set of chunks.
  • Lower threshold to more suitable value - from 0.9 to ?
  • Test performance on Rpi4
  • Add sample signal on Ch00 and Ch99 for Nyquist edge test
  • Add sample signal for 30BPM (incubation mode)
  • Add validation (1) background BPM output with tolerance +/- 1? [expected for expected in [80, 46, 47, 48, 30] if abs(actual - expected) < 1] and (2) BEEP_DURATION must be 0.017 sec
  • Processing of CT signals - start with a data class for CT and then CT detection (3 second pause in gap between beeps, i.e. rising_edges)
  • Add SNR output for each beep
  • Add option to scan at X interval, and automatically change Fc to scan whole spectrum. i.e. "--scan 1" - scan once per hour "--scan 0.1" scan every 6 minutes, "--scan 24"" scan daily Currently the --center option takes one parameter, the center frequency, i.e. 160425000 Hz. This feature should be modified to handle nargs, where --center 16042500 will be the center freq for the SDR --center freq1,freq2,interval in seconds --center 160425000,160725000,3600 would mean swap center frequencies every 3600 seconds
  • Add option to set an array of carriers --carrier [160707800, 160338000, .... ] (max 6 freqs)
  • Add option to support both RTLSDR and SDRPlay devices "--radio airspy" , "--radio rtl"
  • Add option to log signals to MySQL
  • Change Fc default to closer to being between middle freqs (i.e. 160.625Mhz) if bandwidth is 1.5Mhz. Else if bandwidth is 2.048Mhz then Fc can be out of band for freqs of interest - performance question on Rpi4 / No need to deal with DC spike at Fc.
  • Scan and Log CT signals daily - All CT signls, beeps and Fast Telemetry logged to seperate databases in SQLite.

Sample Array Files

https://geekhelp-my.sharepoint.com/:f:/g/personal/al_geekhelp_co_nz/EhBFHUL_rwtKlAynyeeJMHoB3r3P6JYrl-5MQp0ihP7-_w?e=hoKMeB

Installation

Installation within a virtual environment is highly recommended

Pip

pip install 'kiwitracker@git+https://github.com/bigalnz/test_fft.git'

Development Mode

Clone the repo

git clone [email protected]:bigalnz/test_fft.git

Install in "editable mode"

pip install -e .

Running the tests

pip install -e .[test]

and then from the project root:

pytest

Usage

Once installed, the project can be invoked on the command line:

kiwitracker --help

Which should display the following:

usage: kiwitracker [-h] [-f INFILE] [-db DB] [-d] [-o OUTFILE] [-m MAX_SAMPLES] [--scan] [--no-use-gps] [--radio [{rtl,airspy}]] [-c CHUNK_SIZE] [-s SAMPLE_RATE] [--center-freq CENTER_FREQ] [-g GAIN]
                   [--bias-tee] [-log LOGLEVEL] [--carrier [CARRIER]]

options:
  -h, --help            show this help message and exit
  -f INFILE, --from-file INFILE
                        Read samples from the given filename and process them
  -db DB, --database DB
                        SQLite database where to store processed results. Defaults to `main.db`. Environment variable KIWITRACKER_DB has priority.
  -d, --delete-database
                        If SQLite database file exists upon start, it is deleted.
  -o OUTFILE, --outfile OUTFILE
                        Read samples from the device and save to the given filename
  -m MAX_SAMPLES, --max-samples MAX_SAMPLES
                        Number of samples to read when "-o/--outfile" is specified
  --scan                Scan for frequencies in first 3sec
  --no-use-gps          Set this flag to not use GPS module
  --radio [{rtl,airspy}]
                        type of radio to be used (default: rtl), ignored if reading samples from disk. Airspy has max sample rate of 768000. Needs to be used with -s 768000.

Sampling:
  -c CHUNK_SIZE, --chunk-size CHUNK_SIZE
                        Chunk size for sdr.read_samples (default: 65536)
  -s SAMPLE_RATE, --sample-rate SAMPLE_RATE
                        SDR sample rate (default: 1024000.0)
  --center-freq CENTER_FREQ
                        SDR center frequency (default: 160270968)
  -g GAIN, --gain GAIN  SDR gain (default: 7.7)
  --bias-tee            Enable bias tee
  -log LOGLEVEL, --loglevel LOGLEVEL
                        Provide logging level. Example --loglevel debug, default=warning

Processing:
  --carrier [CARRIER]   Carrier frequency to process (default: None)

About

Test of reading from RTL SDR

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published