diff --git a/Display.py b/Display.py index c089ff0..e77bfeb 100644 --- a/Display.py +++ b/Display.py @@ -12,7 +12,7 @@ FFT_SIZE = 1024 BIN_COUNT = FFT_SIZE // 2 # 512 Bins DISPLAY_BINS = 100 # Only display first 100 bins SWEEP_SIZE = 2 -BYTES_PER_FRAME = BIN_COUNT * 4 + SWEEP_SIZE +BYTES_PER_FRAME = BIN_COUNT * 4 WATERFALL_HISTORY = 100 # Number of frames to display in waterfall try: @@ -50,15 +50,15 @@ def update(frame): raw_data = ser.read(BYTES_PER_FRAME) try: - fm_sweep = struct.unpack(f'H', raw_data[:2]) + fm_sweep = [2] - x_dist = np.linspace(0, 1024*3e8/100e6/fm_sweep[0], BIN_COUNT) + x_dist = np.linspace(0, 1024*3e8/100e6/2, BIN_COUNT) x_dist_display = x_dist[:DISPLAY_BINS] # Only first 100 bins - ax1.set_title(f'FFT prikaz radarskega signala FM={fm_sweep[0]}') + ax1.set_title(f'FFT prikaz radarskega signala FM={2}') bar_plot.set_xdata(x_dist_display) ax1.set_xlim(x_dist_display[2], x_dist_display[-1]) # Skip DC - fft_data = struct.unpack(f'{BIN_COUNT}f', raw_data[2:]) + fft_data = struct.unpack(f'{BIN_COUNT}f', raw_data[:]) fft_data_display = fft_data[:DISPLAY_BINS] # Only use first 100 bins # Update FFT plot diff --git a/FMCW_Radar/FMCW_Radar.ino b/FMCW_Radar/FMCW_Radar.ino index aa86269..5c4c93f 100644 --- a/FMCW_Radar/FMCW_Radar.ino +++ b/FMCW_Radar/FMCW_Radar.ino @@ -9,7 +9,7 @@ // --- TABELA --- -const uint16_t FM_FREQ=2; // 30 preletov/sekundo +const uint16_t FM_FREQ=2; const uint16_t FM_SAMPLES=4096; // 12 bitov uint16_t FM_table_pos[FM_SAMPLES]; uint16_t FM_table_neg[FM_SAMPLES]; @@ -30,6 +30,7 @@ void setup() { // 1. Postavimo serijsko komunikacijo SerialUSB.begin(115200); while (!SerialUSB); // Počakaj na povezavo z računalnikom + delay(5000); // 2. Poračunamo wavetable za FM signal for (uint16_t i=0; i