SmartSDR v3.9.19 and the SmartSDR v3.9.19 Release Notes
SmartSDR v2.12.1 and the SmartSDR v2.12.1 Release Notes
The latest 4O3A Genius Product Software and Firmware
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.
New USB passthough question
I have a sainsmart USB relay board I control via a small python program locally in the shack. I would like to be able to conroling using the new pass through feature as I seem to do most of my operating on my laptop now away ffrom the shack. When I configure the passthough based on the discussion it seems to set up correcty but the program soesn't work. It tells be there are not ftdi devices. My radio can switch the relays without any problem. Any ideas
Answers
-
btw here is the pyhon code that works locally
import customtkinter as ctk
import ftd2xx
import osRELAY_COUNT = 8
LABEL_FILE = "relay_labels.txt"relay_labels = []
relay_states = [False] * RELAY_COUNT
buttons = []
ftdi = Nonedef load_labels():
labels = [f"Relay {i+1}" for i in range(RELAY_COUNT)]
if os.path.exists(LABEL_FILE):
with open(LABEL_FILE, "r") as f:
lines = f.readlines()
for i in range(min(RELAY_COUNT, len(lines))):
clean = lines[i].****()
if clean:
labels[i] = clean
return labelsdef connect_ftdi():
global ftdi
try:
ftdi = ftd2xx.open(0)
ftdi.setBitMode(0xFF, 0x01)
status_label.configure(text="Connected to FTDI relay board")
turn_all_off()
for btn in buttons:
btn.configure(state="normal")
except Exception as e:
status_label.configure(text=f"FTDI connection failed: {e}")
for btn in buttons:
btn.configure(state="disabled")def update_relay_outputs():
if ftdi:
mask = 0x00 # All OFF
for i, state in enumerate(relay_states):
if state:
mask |= (1 << i) # HIGH = ON
else:
mask &= ~(1 << i) # LOW = OFF
ftdi.write(bytes([mask]))def make_toggle(relay_id):
def toggle():
for i in range(RELAY_COUNT):
relay_states[i] = (i == relay_id - 1)
buttons[i].configure(fg_color="green" if relay_states[i] else "gray")
update_relay_outputs()
return toggledef turn_all_off():
for i in range(RELAY_COUNT):
relay_states[i] = False
buttons[i].configure(fg_color="gray")
update_relay_outputs()ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("blue")
app = ctk.CTk()
app.title("Antenna Relay Selector")
app.geometry("400x650")relay_labels = load_labels()
for i in range(RELAY_COUNT):
btn = ctk.CTkButton(
app,
text=relay_labels[i],
fg_color="gray",
state="disabled",
command=make_toggle(i + 1)
)
btn.pack(pady=6, padx=20, fill='x')
buttons.append(btn)status_label = ctk.CTkLabel(app, text="Not connected")
status_label.pack(pady=20)connect_ftdi()
app.mainloop()
if ftdi:
ftdi.write(bytes([0x00])) # All relays OFF
ftdi.close()0 -
Sorry to be the bearer of bad news, but it looks like this script is talking directly to the FTDI drivers (e.g. not via the serial interface). As such, I'm don't think that this is going to work through the passthrough interface as what is exposed on the client side for passthrough cables is just a serial port (as opposed to a full USB device). I suspect this is why the script is complaining that there are no FTDI devices as this is accurate from the local point of view when the Sainsmart device is plugged into the radio.
0 -
it seems the sainsmart cards that look exactly alike come with two different chips sets… one will except serial commands, the one I have onky excepts ftdi links with precludes the pass though…. looking at options
0
Leave a Comment
Categories
- All Categories
- 339 Community Topics
- 2.1K New Ideas
- 607 The Flea Market
- 7.9K Software
- 6.3K SmartSDR for Windows
- 172 SmartSDR for Maestro and M models
- 404 SmartSDR for Mac
- 265 SmartSDR for iOS
- 248 SmartSDR CAT
- 186 DAX
- 372 SmartSDR API
- 9.2K Radios and Accessories
- 19 Aurora
- 194 FLEX-8000 Signature Series
- 7.1K FLEX-6000 Signature Series
- 916 Maestro
- 53 FlexControl
- 859 FLEX Series (Legacy) Radios
- 888 Genius Products
- 451 Power Genius XL Amplifier
- 321 Tuner Genius XL
- 116 Antenna Genius
- 283 Shack Infrastructure
- 199 Networking
- 442 Remote Operation (SmartLink)
- 137 Contesting
- 744 Peripherals & Station Integration
- 137 Amateur Radio Interests
- 963 Third-Party Software