Categories
Statistics
Flag Counter
Since 08.08.2014
Counts only, if "DNT = disabled".

Your IP is 3.137.161.222
ec2-3-137-161-222.us-east-2.
Info
Valid HTML 4.01 Transitional Creative Commons Lizenzvertrag
rss
เราจะทำแบบวิศวกรผู้ยิ่งใหญ่
We love the King
27. April 2024
Your valuable opinion :
4.5 stars

Avg. 4.50 from 2 votes.



PyLab-HF-Band-Spectrum.php    8281 Bytes    19-06-2023 17:49:39


Python Lab Experiments - Spectrum of the HF Bands


Arduino Lab Automation Example / Exercise




Arduino and Python in da Lab




✈ Minimum Equipment List (MEL)




DEVICESREMARKS
Frequency Selective Levelmetere.g. Wanmod
AntennaAnything (conductive) from some cm to meters


We used only Arduino™ based devices here, as this simplifies the Python Script.
(PyVISA is covered in a later exercise).




✈ Goal • learning content




• Control single devices in a loop
• Plot graphs
• Optimize graphical appearance of measurement values
• Identify strong stations / interferers
• Measure the Noisefloor and understand its meaning




🐍 The Python Script




# -*- coding: utf-8 -*-
"""
Created on Fri Aug 19 09:09:09 2022

Simple Sketch to Sweep from F1 to F2 + Record the RSSI Level
A long wire was attached, acting as 'antenna'

@author: Changpuak

"""

import serial
import time
import matplotlib.pyplot as plt
import numpy as np


 
# PLEASE DON'T FORGET TO CHANGE THE NUMBER OF THE COM PORT
Wan = serial.Serial(port='COM66', baudrate=115200, timeout=.9)

time.sleep(5)           # Arduinos reset, wait to start up

FREQ_POINTS = 10    
FREQ_START = 10.5       # MHz
FREQ_STOP  = 10.9       # MHz
#FREQ_DELTA = (FREQ_STOP - FREQ_START) / FREQ_POINTS
FREQ_DELTA = 0.003


WAIT = 0.5              # seconds

FREQ = FREQ_START

x = []
f = []  # Frequency
l = []  # Level



def CHAT_WANMOD(x):
    Wan.write(x.encode('utf-8'))
    time.sleep(0.5)
    data = []
    line = (Wan.readline())
    while len(line) > 0:
        data.append(line)
        line = Wan.readline()
        line = line.decode('utf-8')
    return data


def EMPTY_WANMOD(x):
    time.sleep(1)
    x = b'avanti'
    while x != b'':
        x = Wan.readline()
        # print(x)


try:
    print("STARTING SWEEP ...")
    CHAT_WANMOD('*IDN?\n')                     # REMAINS CONSTANT
    EMPTY_WANMOD(x)
    while FREQ <= FREQ_STOP:
        f.append(FREQ)                         # FILL ARRAY
        # SET FREQUENCY 
        CHAT_WANMOD('SETF:'+str(FREQ)+'\n')
        EMPTY_WANMOD(x)       
        # READ LEVEL
        Level = str(CHAT_WANMOD('POW?\n'))
        Level = float(Level[3:-9])
        print("{:.3f}".format(FREQ)+" MHz, "+str(Level)+" dBm")
        l.append(Level)                        # FILL ARRAY
        FREQ += FREQ_DELTA
        # 
        plt.style.use('bmh')
        # plot - yes it is updated in the loop
        fig, ax = plt.subplots(1,1)    
        ax.plot(f, l, linewidth=1.0, color='#0000FF')
        ax.set_title('Noisefloor, 20.08.2022 by Wanmod')
        ax.set_ylabel('RSSI [dBm]')
        ax.set_xlabel('Frequency [MHz]')
        ax.set(xlim=(FREQ_START, FREQ_STOP), 
				xticks=np.arange(FREQ_START, FREQ_STOP, 0.05),
                ylim=(-110, -10), yticks=np.arange(-100, -10, 10))
        plt.show()


finally:
    Wan.close()
    print("CONNECTIONS CLOSED.")
    




✈ The Results ...




Python Lab Experiments

HF Spectrum from DC ... 30 MHz, simple Dipole as suggested by picture above.



Python Lab Experiments

Noisefloor around the 2nd IF region. Input terminated with 50 Ω.




✈ Share your thoughts



The webmaster does not read these comments regularely. Urgent questions should be send via email. Ads or links to completely uncorrelated things will be removed.


Your Browser says that you allow tracking. Mayst we suggest that you check that DNT thing ?

 
t1 = 6498 d

t2 = 410 ms

★ ★ ★  Copyright © 2006 - 2024 by changpuak.ch  ★ ★ ★

Impressum