Im attempting to make a requency scanner that outputs a array of frequencies but i do not know how to do anything with any of these libs as im not advanced python programmer anymore, main problem is the array is outputting from -400 to 400 and even when i get it to do 0 – positive number the positive max number is higher than the amount of samples im passing through, how is this possible?:
import numpy as np
import matplotlib.pyplot as plt
from rtlsdr import RtlSdr
from scipy.signal import find_peaks
import time
SDR = RtlSdr()
StepSize = 10
Start = 1000
Stop = 1250
# CONFIGURATION
SDR.sample_rate = 1.024e6
SDR.gain = 'auto'
Frequencies = np.arange(Start, Stop, StepSize)
plt.figure(figsize=(10, 6))
for Frequency in Frequencies:
print(Frequency)
SDR.center_freq = Frequency
Samples = SDR.read_samples(256*1024)
Spectrum = np.abs(np.fft.fftshift(np.fft.fft(Samples)))
MoreFrequencies = np.fft.fftfreq(len(Spectrum), 1/SDR.sample_rate)
plt.plot(MoreFrequencies / Start + (Frequency / Start), Spectrum)
plt.title('Frequency Scan from 0Hz to 1KHz')
plt.xlabel('Frequency (KHz)')
plt.ylabel('Power')
plt.grid(True)
plt.show()
I tried to use numpy and matplot…