import pyvisa
import time
import csv
from datetime import datetime
import os
import argparse
import sys
# ------------------------------------------------------------------------------
# Command-line argument parsing
# This section defines and parses command-line arguments, allowing users to
# customize the scan parameters (filename, frequency range, step size) when
# running the script.
# ------------------------------------------------------------------------------
parser = argparse.ArgumentParser(description="Spectrum Analyzer Sweep and CSV Export")
# Define an argument for the prefix of the output CSV filename
parser.add_argument('--SCANname', type=str, default="25kz scan ",
help='Prefix for the output CSV filename')
# Define an argument for the start frequency
parser.add_argument('--startFreq', type=float, default=400e6,
help='Start frequency in Hz')
# Define an argument for the end frequency
parser.add_argument('--endFreq', type=float, default=650e6,
help='End frequency in Hz')
# Define an argument for the step size
parser.add_argument('--stepSize', type=float, default=25000,
help='Step size in Hz')
# Add an argument to choose who is running the program (apk or zap)
parser.add_argument('--user', type=str, choices=['apk', 'zap'], default='zap',
help='Specify who is running the program: "apk" or "zap". Default is "zap".')
# Parse the arguments provided by the user
args = parser.parse_args()
# Assign parsed arguments to variables for easy access
file_prefix = args.SCANname
start_freq = args.startFreq
end_freq = args.endFreq
step = args.stepSize
user_running = args.user
# Define the waiting time in seconds
WAIT_TIME_SECONDS = 300 # 5 minutes
# ------------------------------------------------------------------------------
# Main program loop
# The entire scanning process will now run continuously with a delay.
# ------------------------------------------------------------------------------
while True:
# --------------------------------------------------------------------------
# VISA connection setup
# This section establishes communication with the spectrum analyzer using the
# PyVISA library, opens the specified instrument resource, and performs initial
# configuration commands.
# --------------------------------------------------------------------------
# Define the VISA address of the spectrum analyzer. This typically identifies
# the instrument on the bus (e.g., USB, LAN, GPIB).
# Define the VISA address of the spectrum analyzer. This typically identifies
# the instrument on the bus (e.g., USB, LAN, GPIB).
apk_visa_address = 'USB0::0x0957::0xFFEF::CN03480580::0::INSTR'
zap_visa_address = 'USB1::0x0957::0xFFEF::SG05300002::0::INSTR'
if user_running == 'apk':
visa_address = apk_visa_address
else: # default is 'zap'
visa_address = zap_visa_address
# Create a ResourceManager object, which is the entry point for PyVISA.
rm = pyvisa.ResourceManager()
try:
# Open the connection to the specified instrument resource.
inst = rm.open_resource(visa_address)
print(f"Connected to instrument at {visa_address}")
# Clear the instrument's status byte and error queue.
inst.write("*CLS")
# Reset the instrument to its default settings.
inst.write("*RST")
# Query the Operation Complete (OPC) bit to ensure the previous commands have
# finished executing before proceeding. This is important for synchronization.
inst.query("*OPC?")
inst.write(":POWer:GAIN ON")
print("Preamplifier turned ON.")
inst.write(":POWer:GAIN 1") # '1' is equivalent to 'ON'
print("Preamplifier turned ON for high sensitivity.")
# Configure the display: Set Y-axis scale to logarithmic (dBm).
inst.write(":DISP:WIND:TRAC:Y:SCAL LOG")
# Configure the display: Set the reference level for the Y-axis.
inst.write(":DISP:WIND:TRAC:Y:RLEV -30")
# Enable Marker 1. Markers are used to read values at specific frequencies.
inst.write(":CALC:MARK1 ON")
# Set Marker 1 mode to position, meaning it can be moved to a specific frequency.
inst.write(":CALC:MARK1:MODE POS")
# Activate Marker 1, making it ready for use.
inst.write(":CALC:MARK1:ACT")
# Set the instrument to single sweep mode.
# This ensures that after each :INIT:IMM command, the instrument performs one
# sweep and then holds the trace data until another sweep is initiated.
inst.write(":INITiate:CONTinuous OFF")
# Pause execution for 2 seconds to allow the instrument to settle after configuration.
time.sleep(2)
# --------------------------------------------------------------------------
# File & directory setup
# This section prepares the output directory and generates a unique filename
# for the CSV export based on the current timestamp and user-defined prefix.
# --------------------------------------------------------------------------
# Define the directory where scan results will be saved.
# It creates a subdirectory named "N9340 Scans" in the current working directory.
scan_dir = os.path.join(os.getcwd(), "N9340 Scans")
# Create the directory if it doesn't already exist. `exist_ok=True` prevents
# an error if the directory already exists.
os.makedirs(scan_dir, exist_ok=True)
# Generate a timestamp for the filename to ensure uniqueness.
timestamp = datetime.now().strftime("%Y%m%d_%H-%M-%S")
# Construct the full path for the output CSV file.
filename = os.path.join(scan_dir, f"{file_prefix}--{timestamp}.csv")
# --------------------------------------------------------------------------
# Sweep and write to CSV
# This is the core logic of the script, performing the frequency sweep in
# segments, reading data from the spectrum analyzer, and writing it to the CSV.
# --------------------------------------------------------------------------
# Define the width of each frequency segment for sweeping.
# Sweeping in segments helps manage memory and performance on some instruments.
segment_width = 10_000_000 # 10 MHz
# Convert step size to integer, as some instrument commands might expect integers.
step_int = int(step)
# Convert end frequency to integer, for consistent comparison in loops.
scan_limit = int(end_freq)
# Open the CSV file in write mode (`'w'`). `newline=''` prevents extra blank rows.
with open(filename, mode='w', newline='') as csvfile:
# Create a CSV writer object.
writer = csv.writer(csvfile)
# Initialize the start of the current frequency block.
current_block_start = int(start_freq)
# Loop through frequency blocks until the end frequency is reached.
while current_block_start < scan_limit:
# Calculate the end frequency for the current block.
current_block_stop = current_block_start + segment_width
# Ensure the block stop doesn't exceed the overall scan limit.
if current_block_stop > scan_limit:
current_block_stop = scan_limit
# Print the current sweep range to the console for user feedback.
print(f"Sweeping range {current_block_start / 1e6:.3f} to {current_block_stop / 1e6:.3f} MHz")
# Set the start frequency for the instrument's sweep.
inst.write(f":FREQ:START {current_block_start}")
# Set the stop frequency for the instrument's sweep.
inst.write(f":FREQ:STOP {current_block_stop}")
# Initiate a single immediate sweep.
inst.write(":INIT:IMM")
# Query Operation Complete to ensure the sweep has finished before reading markers.
# This replaces the fixed time.sleep(2) for more robust synchronization.
inst.query("*OPC?")
# Initialize the current frequency for data point collection within the block.
current_freq = current_block_start
# Loop through each frequency step within the current block.
while current_freq <= current_block_stop:
# Set Marker 1 to the current frequency.
inst.write(f":CALC:MARK1:X {current_freq}")
# Query the Y-axis value (level in dBm) at Marker 1's position.
# .strip() removes any leading/trailing whitespace or newline characters.
level_raw = inst.query(":CALC:MARK1:Y?").strip()
try:
# Attempt to convert the raw level string to a float.
level = float(level_raw)
# Format the level to one decimal place for consistent output.
level_formatted = f"{level:.1f}"
# Convert frequency from Hz to MHz for readability.
freq_mhz = current_freq / 1_000_000
# Print the frequency and level to the console.
print(f"{freq_mhz:.3f} MHz : {level_formatted} dBm")
# Write the frequency and formatted level to the CSV file.
writer.writerow([freq_mhz, level_formatted])
except ValueError:
# If the raw level cannot be converted to a float (e.g., if it's an error message),
# use the raw string directly.
level_formatted = level_raw
# Optionally, you might want to log this error or write a placeholder.
print(f"Warning: Could not parse level '{level_raw}' at {current_freq / 1e6:.3f} MHz")
writer.writerow([current_freq / 1_000_000, level_formatted])
# Increment the current frequency by the step size.
current_freq += step_int
# Move to the start of the next block.
current_block_start = current_block_stop
except pyvisa.VisaIOError as e:
print(f"VISA Error: Could not connect to or communicate with the instrument: {e}")
print("Please ensure the instrument is connected and the VISA address is correct.")
# Decide if you want to exit or retry after a connection error
# For now, it will proceed to the wait and then try again.
except Exception as e:
print(f"An unexpected error occurred during the scan: {e}")
# Continue to the wait or exit if the error is critical
finally:
# ----------------------------------------------------------------------
# Cleanup
# This section ensures that the instrument is returned to a safe state and
# the VISA connection is properly closed after the scan is complete.
# ----------------------------------------------------------------------
if 'inst' in locals() and inst.session != 0: # Check if inst object exists and is not closed
try:
# Attempt to send the instrument to local control.
inst.write("SYST:LOC")
except pyvisa.VisaIOError:
pass # Ignore if command is not supported or connection is already broken
finally:
inst.close()
print("Instrument connection closed.")
# Print a confirmation message indicating the scan completion and output file.
if 'filename' in locals(): # Only print if filename was successfully created
print(f"\nScan complete. Results saved to '{filename}'")
# --------------------------------------------------------------------------
# Countdown and Interruptible Wait
# --------------------------------------------------------------------------
print("\n" + "="*50)
print(f"Next scan in {WAIT_TIME_SECONDS // 60} minutes.")
print("Press Ctrl+C at any time during the countdown to interact.")
print("="*50)
seconds_remaining = WAIT_TIME_SECONDS
skip_wait = False
while seconds_remaining > 0:
minutes = seconds_remaining // 60
seconds = seconds_remaining % 60
# Print countdown, overwriting the same line
sys.stdout.write(f"\rTime until next scan: {minutes:02d}:{seconds:02d} ")
sys.stdout.flush() # Ensure the output is immediately written to the console
try:
time.sleep(1)
except KeyboardInterrupt:
sys.stdout.write("\n") # Move to a new line after Ctrl+C
sys.stdout.flush()
choice = input("Countdown interrupted. (S)kip wait, (Q)uit program, or (R)esume countdown? ").strip().lower()
if choice == 's':
skip_wait = True
print("Skipping remaining wait time. Starting next scan shortly...")
break # Exit the countdown loop
elif choice == 'q':
print("Exiting program.")
sys.exit(0) # Exit the entire script
else:
print("Resuming countdown...")
# Continue the loop from where it left off
seconds_remaining -= 1
if not skip_wait:
# Clear the last countdown line
sys.stdout.write("\r" + " "*50 + "\r")
sys.stdout.flush()
print("Starting next scan now!")
print("\n" + "="*50 + "\n") # Add some spacing for clarity between cycles
Category Archives: Software
TWiRT 712 – Fun with AI Inspires Broadcast Engineers – Matt Aaron & Anthony Kuzub
The rise of AI-generated lyrics and music is giving engineers something to chuckle about. But could this “easy creativity” inspire other engineering solutions? Kirk drew a comparison with photographer Jeremy Cowart and his use of an LED wall to produce 60 different portraits in 60 seconds. Anthony Kuzub, an engineer at CBC in Canada, pointed out the AI that’s involved with lighting a new studio, matching accent lights to the video monitor feeds. Matt Aaron is programming a fully-AI streaming station that’s playing “Broadcast Engineers Gangster Rap”. Are these just passing curiosities? Or are they signals of technologies and techniques to come for broadcasting and content creation?
Show notes: “The Legend of Chris Tarr” from suno.com https://suno.com/song/ecb43422-a9a0-4…
And another version of “The Legend of Chris Tarr” https://suno.com/song/9f924c42-c5b7-4… Matt Aaron’s AI-music streaming station https://broadcastengineeringgangsters…
And if Kirk had a radio station, KIRK, this could be the theme song https://suno.com/song/7e61f354-34e0-4…
Anthony mentioned ElevenLabs for text-to-speech and AI voice generation https://elevenlabs.io/
Anthony noted the Roland VC-1-DMX video lighting converter https://proav.roland.com/global/produ…
GPIB shop tools
my favorite session ever…
Home Made Studer A80 16 Track remote
Scored a second function generator
Dolby Almost
Transparent button underlays
Arduino sketch – keyboard keys pressed with gpi
#include KEYBOARD.h
const int F9_PIN = 2;
const int F10_PIN = 3;
const int F9_LED_PIN = 4;
const int F10_LED_PIN = 5;
void setup() {
Keyboard.begin();
pinMode(F9_PIN, INPUT_PULLUP);
pinMode(F10_PIN, INPUT_PULLUP);
pinMode(F9_LED_PIN, OUTPUT);
pinMode(F10_LED_PIN, OUTPUT);
}
void loop() {
if (digitalRead(F9_PIN) == LOW) {
Keyboard.press(KEY_F9);
digitalWrite(F9_LED_PIN, HIGH);
delay(100);
Keyboard.release(KEY_F9);
digitalWrite(F9_LED_PIN, LOW);
}
if (digitalRead(F10_PIN) == LOW) {
Keyboard.press(KEY_F10);
digitalWrite(F10_LED_PIN, HIGH);
delay(100);
Keyboard.release(KEY_F10);
digitalWrite(F10_LED_PIN, LOW);
}
}
I asked Chat GPT to write arduino code – and it blew my mind!
Sure! Here is an example of an Arduino sketch that uses four motor controllers and receives s-bus inputs from a remote control, and also maps MIDI notes to each motor controller:
#include <SBUS.h> // include the SBUS library
#include <MIDI.h> // include the MIDI library
// define the pin numbers for the s-bus input and the four motor controllers
const int SBUS_PIN = 10;
const int MOTOR1_PIN = 3;
const int MOTOR2_PIN = 5;
const int MOTOR3_PIN = 6;
const int MOTOR4_PIN = 9;
// create an instance of the SBUS library
SBUS sbus(SBUS_PIN);
// create an instance of the MIDI library
MIDI_CREATE_DEFAULT_INSTANCE();
void setup() {
// initialize the s-bus input and the four motor controllers
sbus.begin();
pinMode(MOTOR1_PIN, OUTPUT);
pinMode(MOTOR2_PIN, OUTPUT);
pinMode(MOTOR3_PIN, OUTPUT);
pinMode(MOTOR4_PIN, OUTPUT);
// begin MIDI communication
MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop() {
// read the s-bus input
sbus.read();
// get the values of the channels from the s-bus input
int channel1 = sbus.getChannel(1);
int channel2 = sbus.getChannel(2);
int channel3 = sbus.getChannel(3);
int channel4 = sbus.getChannel(4);
// set the speed of the first motor based on the value of channel 1
analogWrite(MOTOR1_PIN, channel1);
// set the speed of the second motor based on the value of channel 2
analogWrite(MOTOR2_PIN, channel2);
// set the speed of the third motor based on the value of channel 3
analogWrite(MOTOR3_PIN, channel3);
// set the speed of the fourth motor based on the value of channel 4
analogWrite(MOTOR4_PIN, channel4);
// check for incoming MIDI messages
MIDI.read();
// if a MIDI note on message is received, set the speed of the corresponding motor
if (MIDI.getType() == midi::NoteOn) {
int note = MIDI.getData1(); // get the MIDI note number
int velocity = MIDI.getData2(); // get the MIDI velocity value
// map the MIDI note to a motor controller and set its speed
if (note == 60) { // map MIDI note 60 to motor 1
analogWrite(MOTOR1_PIN, velocity);
}
else if (note == 61) { // map MIDI note 61 to motor 2
analogWrite(MOTOR2_PIN, velocity);
}
else if (note == 62) { // map MIDI note 62 to motor 3
analogWrite(MOTOR3_PIN, velocity);
}
else if (note == 63) { // map MIDI note 63 to motor 4
analogWrite(MOTOR4_PIN, velocity);
Counting Binary on your fingers



LPKF proto mat PCB prototype engraver
Crowtail console – https://www.elecrow.com/crowtail.html
From https://www.elecrow.com/crowtail.html

Faders A0-7
Screens D12-15
UART GNSS? PTP?

Celebration of Chris Tobin
Alex and I attended the Celebration of a fellow engineer Chris Tobin.
I was on the TWRIT show three time I think with him. Solid questions, great interviewer, great ethic. I watched Many hours of him sharing wisdom with the internet. Smart guy and busy busy busy doing the worlds most amazing project. Some of his brilliance was captured on this week in radio tech
He was taken too soon.
We talked about the Emoji description protocol

Arduino Project – Digitally Controlled Analog Surround Sound Panning – Open Source
For your enjoyment:
Digitally Controlled Analog Surround Sound Panning
Presentation:
Circuit Explination:
Presentation documents:
0 – TPJ – Technical Presentation
0 – TPJ556-FINAL report DCASSP-COMPLETE
0 – TPJ556-FINAL report DCASSP-SCHEMATICS V1
Project Source Code:
Books of 2015 – Supplemental and future reading and reference
Adding to the book list for 2015. Lots learned and so much more to learn!
Generating Code with spreadsheet for Keyboard Assignments of CADSOFT Eagle
I needed a way of Generating Code, lots of code. In cadsoft eagle, the Keyboard Assignments are completely user customizable. They have a script language that allows you to modify the software. I’ve used hundreds of the ULP and SCRs and decided to write my own Generator.
Necessity is the mother of all innovation.

Keaton Music Typewriter
On Compressing the English Language
Someone picked my brain the other day looking for a technique to compress language files.
After walking away to think about it… my method was to re-order the ASCII code to the letters by their frequency and the most common words by their frequency.
Where lowercase e is stored as an ASCII value using 1 byte
ASCII e = 0x61 = 0b1100001 = 7 bits
vs
APK e = 0x1 = 1 bit
… this method stores an E in 1 bit. This is similar to the Huffman Code with the addition of whole words being included in the code.
For example:
“because” is the 94th most used word in the english language and in this method is stored in 7 bits.
I don’t know if this has been done before… but I would imagine it could compress Language files substantially.
I have thought about a third addition of using the most used 2 or three letter combinations commonly used.
| APK ORDER | APK | LET FREQ | WORD FEQ | APK BIN | APK HEX | APK BITS USED |
| 0 | space | 0 | 0 | 1 | ||
| 1 | e | 12.70% | 1 | 1 | 1 | |
| 2 | t | 9.06% | 10 | 2 | 2 | |
| 3 | a | 8.17% | 11 | 3 | 2 | |
| 4 | o | 7.51% | 100 | 4 | 3 | |
| 5 | i | 6.97% | 101 | 5 | 3 | |
| 6 | n | 6.75% | 110 | 6 | 3 | |
| 7 | s | 6.33% | 111 | 7 | 3 | |
| 8 | h | 6.09% | 1000 | 8 | 4 | |
| 9 | r | 5.99% | 1001 | 9 | 4 | |
| 10 | d | 4.25% | 1010 | A | 4 | |
| 11 | l | 4.03% | 1011 | B | 4 | |
| 12 | c | 2.78% | 1100 | C | 4 | |
| 13 | u | 2.76% | 1101 | D | 4 | |
| 14 | m | 2.41% | 1110 | E | 4 | |
| 15 | w | 2.36% | 1111 | F | 4 | |
| 16 | f | 2.23% | 10000 | 10 | 5 | |
| 17 | g | 2.02% | 10001 | 11 | 5 | |
| 18 | y | 1.97% | 10010 | 12 | 5 | |
| 19 | p | 1.93% | 10011 | 13 | 5 | |
| 20 | b | 1.49% | 10100 | 14 | 5 | |
| 21 | v | 0.98% | 10101 | 15 | 5 | |
| 22 | k | 0.77% | 10110 | 16 | 5 | |
| 23 | j | 0.15% | 10111 | 17 | 5 | |
| 24 | x | 0.15% | 11000 | 18 | 5 | |
| 25 | q | 0.10% | 11001 | 19 | 5 | |
| 26 | z | 0.07% | 11010 | 1A | 5 | |
| 27 | the | 1 | 11011 | 1B | 5 | |
| 28 | be | 2 | 11100 | 1C | 5 | |
| 29 | to | 3 | 11101 | 1D | 5 | |
| 30 | of | 4 | 11110 | 1E | 5 | |
| 31 | and | 5 | 11111 | 1F | 5 | |
| 32 | a | 6 | 100000 | 20 | 6 | |
| 33 | in | 7 | 100001 | 21 | 6 | |
| 34 | that | 8 | 100010 | 22 | 6 | |
| 35 | have | 9 | 100011 | 23 | 6 | |
| 36 | I | 10 | 100100 | 24 | 6 | |
| 37 | it | 11 | 100101 | 25 | 6 | |
| 38 | for | 12 | 100110 | 26 | 6 | |
| 39 | not | 13 | 100111 | 27 | 6 | |
| 40 | on | 14 | 101000 | 28 | 6 | |
| 41 | with | 15 | 101001 | 29 | 6 | |
| 42 | he | 16 | 101010 | 2A | 6 | |
| 43 | as | 17 | 101011 | 2B | 6 | |
| 44 | you | 18 | 101100 | 2C | 6 | |
| 45 | do | 19 | 101101 | 2D | 6 | |
| 46 | at | 20 | 101110 | 2E | 6 | |
| 47 | this | 21 | 101111 | 2F | 6 | |
| 48 | but | 22 | 110000 | 30 | 6 | |
| 49 | his | 23 | 110001 | 31 | 6 | |
| 50 | by | 24 | 110010 | 32 | 6 | |
| 51 | from | 25 | 110011 | 33 | 6 | |
| 52 | they | 26 | 110100 | 34 | 6 | |
| 53 | we | 27 | 110101 | 35 | 6 | |
| 54 | say | 28 | 110110 | 36 | 6 | |
| 55 | her | 29 | 110111 | 37 | 6 | |
| 56 | she | 30 | 111000 | 38 | 6 | |
| 57 | or | 31 | 111001 | 39 | 6 | |
| 58 | an | 32 | 111010 | 3A | 6 | |
| 59 | will | 33 | 111011 | 3B | 6 | |
| 60 | my | 34 | 111100 | 3C | 6 | |
| 61 | one | 35 | 111101 | 3D | 6 | |
| 62 | all | 36 | 111110 | 3E | 6 | |
| 63 | would | 37 | 111111 | 3F | 6 | |
| 64 | there | 38 | 1000000 | 40 | 7 | |
| 65 | their | 39 | 1000001 | 41 | 7 | |
| 66 | what | 40 | 1000010 | 42 | 7 | |
| 67 | so | 41 | 1000011 | 43 | 7 | |
| 68 | up | 42 | 1000100 | 44 | 7 | |
| 69 | out | 43 | 1000101 | 45 | 7 | |
| 70 | if | 44 | 1000110 | 46 | 7 | |
| 71 | about | 45 | 1000111 | 47 | 7 | |
| 72 | who | 46 | 1001000 | 48 | 7 | |
| 73 | get | 47 | 1001001 | 49 | 7 | |
| 74 | which | 48 | 1001010 | 4A | 7 | |
| 75 | go | 49 | 1001011 | 4B | 7 | |
| 76 | me | 50 | 1001100 | 4C | 7 | |
| 77 | when | 51 | 1001101 | 4D | 7 | |
| 78 | make | 52 | 1001110 | 4E | 7 | |
| 79 | can | 53 | 1001111 | 4F | 7 | |
| 80 | like | 54 | 1010000 | 50 | 7 | |
| 81 | time | 55 | 1010001 | 51 | 7 | |
| 82 | no | 56 | 1010010 | 52 | 7 | |
| 83 | just | 57 | 1010011 | 53 | 7 | |
| 84 | him | 58 | 1010100 | 54 | 7 | |
| 85 | know | 59 | 1010101 | 55 | 7 | |
| 86 | take | 60 | 1010110 | 56 | 7 | |
| 87 | people | 61 | 1010111 | 57 | 7 | |
| 88 | into | 62 | 1011000 | 58 | 7 | |
| 89 | year | 63 | 1011001 | 59 | 7 | |
| 90 | your | 64 | 1011010 | 5A | 7 | |
| 91 | good | 65 | 1011011 | 5B | 7 | |
| 92 | some | 66 | 1011100 | 5C | 7 | |
| 93 | could | 67 | 1011101 | 5D | 7 | |
| 94 | them | 68 | 1011110 | 5E | 7 | |
| 95 | see | 69 | 1011111 | 5F | 7 | |
| 96 | other | 70 | 1100000 | 60 | 7 | |
| 97 | than | 71 | 1100001 | 61 | 7 | |
| 98 | then | 72 | 1100010 | 62 | 7 | |
| 99 | now | 73 | 1100011 | 63 | 7 | |
| 100 | look | 74 | 1100100 | 64 | 7 | |
| 101 | only | 75 | 1100101 | 65 | 7 | |
| 102 | come | 76 | 1100110 | 66 | 7 | |
| 103 | its | 77 | 1100111 | 67 | 7 | |
| 104 | over | 78 | 1101000 | 68 | 7 | |
| 105 | think | 79 | 1101001 | 69 | 7 | |
| 106 | also | 80 | 1101010 | 6A | 7 | |
| 107 | back | 81 | 1101011 | 6B | 7 | |
| 108 | after | 82 | 1101100 | 6C | 7 | |
| 109 | use | 83 | 1101101 | 6D | 7 | |
| 110 | two | 84 | 1101110 | 6E | 7 | |
| 111 | how | 85 | 1101111 | 6F | 7 | |
| 112 | our | 86 | 1110000 | 70 | 7 | |
| 113 | work | 87 | 1110001 | 71 | 7 | |
| 114 | first | 88 | 1110010 | 72 | 7 | |
| 115 | well | 89 | 1110011 | 73 | 7 | |
| 116 | way | 90 | 1110100 | 74 | 7 | |
| 117 | even | 91 | 1110101 | 75 | 7 | |
| 118 | new | 92 | 1110110 | 76 | 7 | |
| 119 | want | 93 | 1110111 | 77 | 7 | |
| 120 | because | 94 | 1111000 | 78 | 7 | |
| 121 | any | 95 | 1111001 | 79 | 7 | |
| 122 | these | 96 | 1111010 | 7A | 7 | |
| 123 | give | 97 | 1111011 | 7B | 7 | |
| 124 | day | 98 | 1111100 | 7C | 7 | |
| 125 | most | 99 | 1111101 | 7D | 7 | |
| 126 | use | 100 | 1111110 | 7E | 7 |
GREEN HOME MONITORING SYSTEM
Title: GREEN HOME MONITORING SYSTEM – TRANSMITTER
Author: ANTHONY P KUZUB
DATE: 2015 04 01
Description:
REMOTE MONITORING TRANSMITTER
The GREEN HOME MONITORING SYSTEM controls, monitors then transmits the
status of three room lights to a remote monitoring station.
The code below is the local control and transmitter
Three light switches along with motion sensors control the functionality
of the rooms lights.
When the system is enabled:
The light turns on When motion is detected.
Once motion is detected a five second counter Starts.
If motion is not detected within the five seconds The light shut
off saving power.
When the system is disabled:
The light switch controls The light Directly.
A Peak Power cost value is captured based on the time of day.
To Test this feature: apply a slowly 10mHz Sine wave 1.25
Vpp with offset of 0.625V offset to TP7
This moving sine wave is converted to digital by means of A/D convertor
This power cost value is displayed on the segment display
Indicating the value of power throughout the day.
The Status of The System state, switch position, motion detection, Light
status, and Energy cost, are transmitted to a remote monitoring station
via serial port 1.
Title: GREEN HOME MONITORING SYSTEM – RECEIVER
Author: ANTHONY P KUZUB
DATE: 2015 04 01
Description:
The GREEN HOME MONITORING SYSTEM controls, monitors then transmits the
status of three room lights to a remote monitoring station.
The code below is the remote monitoring station
This program receives 2 bytes of data from the transmitter through
Serial port 1. The data is decoded and displayed on a screen by access
of serial port 2 of the controller.
A workstations TERMINAL session connects a a com port to the hardware receiver.
SESSION CONFIGURATION:
BAUD RATE: 9600
DATA BITS: 8
PARITY: NONE
FLOW CONTROL: NONE
EMULATION: ANSI
The Status of the system, switch positions, motion detection, Light status,
and Energy PEAK VALUE displayed on the terminal screen.
A Changing Peak Power cost is applied proportionaly to room cost acumulators.
By Pressing the respective key on the terminal keyboard, the rooms cost will
reset to zero.
Please note that with the exception of the push buttons all states are
ACTIVE HIGH




















































































































