css body, p, .post-body { font-family: 'Google Sans Text', sans-serif !important; } /* Apply Google Sans to Post Titles and Headings */ h1, h2, h3, h4, h5, h6, .post-title, .post h2 { font-family: 'Google Sans', sans-serif; font-weight: 500; }

Thursday, September 3, 2026

Let's build a Compact Low Power Automated WSPR Monitoring Station (Part 3)

Image:  Telegram Notifications via 6m Band Opening Bot (Click on image for larger view.)

Continue building a Compact Low Power Automated WSPR Monitoring Station:

Part 1 available HERE 

Part 2 available HERE 

In Part 2 we setup the Raspberry Pi Zero 2 W WSPR Monitoring Station.  The monitoring station was also fitted with a Waveshare ETH/USB HUB HAT (B).  All tests were successful and the monitoring station performed flawlessly. Now one can use the station manually but I wanted something that will monitor the 6 Meter Band and send instant push alerts to me of any band activity via my phone using a Telegram Bot.  I needed an automated setup as the 6 meter band is not always open or active.

To push instant Telegram alerts from a Raspberry Pi Zero 2 W WSPR Station, you need to create a Telegram Bot, extract its API token, and deploy a lightweight Python file-monitoring script on your Pi.

Here is the complete, production-ready solution optimized to run efficiently on a Pi Zero 2 W without wasting CPU cycles.

 1. Create Your Telegram Bot

You must first generate a bot token and find your personal chat ID to route the messages.

    • Open Telegram: Search for the official account @BotFather.
    • Create Bot: Send the command /newbot and follow the prompts to name your monitor bot.
    • Save Token: Copy the HTTP API token provided (formatted like 123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ).
    • Get Chat ID: Search for @userinfobot on Telegram and send it a message. Copy your numerical Id.
    • Activate Bot: Open your newly created bot's chat window and press Start.

2. Configure the Python Monitoring Script 

This script tracks new log entries efficiently. It uses an obfuscated URL structure to bypass local network filtering proxies that corrupt standard Telegram links.
Save this file as: /home/pi/wspr_monitor.py

python

import os
import time
import requests

# ==================== CONFIGURATION ====================
CHAT_ID = "XXXXXXXXXXX" #"YOUR TELEGRAM BOT TOKEN"
LOG_FILE_PATH = "/home/pi/ALL_WSPR.TXT"  
TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" #"YOUR TELEGRAM CHAT ID"
# =======================================================

# Obfuscated URL segments to bypass local filtering blocks
p1 = "htt" + "ps://"
p2 = "ap" + "i."
p3 = "tele" + "gram.org"
p4 = "/b" + "ot"
URL = f"{p1}{p2}{p3}{p4}{TOKEN}/sendMessage"

def send_telegram(message):
    try:
        payload = {
            "chat_id": CHAT_ID, 
            "text": message, 
            "parse_mode": "Markdown"
        }
        response = requests.post(URL, json=payload, timeout=10)
        if response.status_code != 200:
            print(f"Telegram API Error: {response.text}")
    except Exception as e:
        print(f"Connection error: {e}")

def monitor_log():
    print(f"Starting WSPR monitor on {LOG_FILE_PATH}...")
    
    if not os.path.exists(LOG_FILE_PATH):
        print(f"Waiting for log file to be created at {LOG_FILE_PATH}...")
        while not os.path.exists(LOG_FILE_PATH):
            time.sleep(5)

    with open(LOG_FILE_PATH, "r") as f:
        f.seek(0, os.SEEK_END)
        
        while True:
            line = f.readline()
            if not line:
                time.sleep(1)  # Saves Pi Zero CPU cycles
                continue
                
            clean_line = line.strip()
            if clean_line:
                # Direct match layout formatting
                alert_text = f"📻 *WSPR Spot Detected:*\n`{clean_line}`"
                send_telegram(alert_text)

if __name__ == "__main__":
    monitor_log()
EOF
NOTE: You must enter your allocated Telegram Bot Token and Chat Id after the 
configuration entry.

3. Systemd Service Deployment

To run both the receiver and the notification engine independently in the background, you must configure two separate services.

Service A: The RTL-SDR Hardware Decoder (wspr-monitor.service)

ini

[Unit]
Description=WSPR Background Monitor Listener
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/home/pi
ExecStart=/bin/bash -c "exec stdbuf -oL -eL /usr/local/bin/rtlsdr_wsprd 
-f 7.0386M -c ZS1I/RX /home/pi/ALL_WSPR.TXT"
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Service B: The Telegram Push Engine (wspr-telegram.service)  

ini

[Unit]
Description=WSPR Telegram Notification Pusher
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/bin/python3 /home/pi/wspr_monitor.py
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

 

4.  Critical Infrastructure Commands

System Installation Dependencies

bash

sudo apt update && sudo apt install python3-requests -y

Activating and Loading Services

bash

sudo systemctl daemon-reload
sudo systemctl enable wspr-monitor.service wspr-telegram.service
sudo systemctl start wspr-monitor.service wspr-telegram.service

Essential Operational Controls

  • Check Status:

    bash

    sudo systemctl status wspr-telegram.service
    sudo systemctl status wspr-monitor.service
  • Stop Services:

    bash

    sudo systemctl stop wspr-telegram.service
    sudo systemctl stop wspr-monitor.service
  • Restart Services:

    bash

    sudo systemctl restart wspr-telegram.service
    sudo systemctl restart wspr-monitor.service
  • View Live Rolling Application Logs:

    bash

    sudo journalctl -u wspr-telegram.service -f

Clarification Note:  Please note that I have setup my WSPR Monitoring Station to run on 40 Meters just for testing purposes.  You will see that the Telegram Bot and the Telegram Group makes mention of 6 meters and the notifications in Telegram of 40 meters.  Once I am satisfied and ready I will revert back to 6 meter in the next few days.

5.  Transitioning to the 6m Band 

When the 6m band season starts I will update my hardware dial configuration from 40m (7.0386M) to 6m (50.2910M).

  1. Editing hardware configuration:

    bash

    sudo nano /etc/systemd/system/wspr-monitor.service
  2. Modify the  ExecStart dial frequency argument:

    • Replace  -f 7.0386M with  -f 50.2910M

  3. Save, reload, and apply the frequency change:

    bash

    sudo systemctl daemon-reload
    sudo systemctl restart wspr-monitor.service

I did a few test runs and spots were send automatically to WSPRNET and TELEGRAM.  Look at the main image above and the image below.  The first two entries listed on WSPRNET and  the first and third notification on TELEGRAM correspond with each other indicating that the Automated WSPR Monitoring Station is working as it should.


 Image:  WSPRNET Database  (Click on image for larger view.)

Let's build the Modified "Squeakie" RF Field Strength Meter - Peter Parker VK3YE (Part 3)

I was not satisfied with the functioning and build of the veroboard "Squeakie" Field Strength Meter described in Part 2.  I decide...