Topics

Python script for controlling relays using SDRAngel reverse API


James Dallas
 

Hi everyone:

Here is my first stab at a script for controlling USB relay control boards using the SDRAngel reverse API.


I have only tested it on Linux (Ubuntu 18.04).

So far, I have been able to control both a single-channel CH341 "LCUS-1" device as well as a four-channel FTDI FT245R "1982-USB4CH" device (eg. Sainsmart).

It seems to switch within a few milliseconds of hitting "play."

Here are some things that I think ought to be done/ added in the future, and which I will work on in my spare time:

1. Actually testing this in Windows. I have read that the ftd2xx module for Python does work on Windows, but I didn't actually try it.

2. Refactor the code a bit so that it is a little more universal, rather than tied to the two boards I tried it on. For example, I think there are multi-channel CH340 devices out there.

3. Maybe add some sort of delay so that, for example, a transmit amplifier doesn't kick on until an antenna switch has had a few milliseconds to switch. This is a pretty important safety feature that ought to be implemented.

4. Better documentation. I wrote this up quickly and I am not sure all the ideas are well-explained.

73s,
James AD5NL


James Dallas
 

Addendum: I have since added a delay and also a PROCESS pseudo-relay type, so you can run third-party processes (either for unsupported hardware, or to do things like log transmissions). I still need to test on Windows...

On Sat, Mar 16, 2019 at 4:37 PM James Dallas via Groups.Io <jim.dallas=gmail.com@groups.io> wrote:
Hi everyone:

Here is my first stab at a script for controlling USB relay control boards using the SDRAngel reverse API.


I have only tested it on Linux (Ubuntu 18.04).

So far, I have been able to control both a single-channel CH341 "LCUS-1" device as well as a four-channel FTDI FT245R "1982-USB4CH" device (eg. Sainsmart).

It seems to switch within a few milliseconds of hitting "play."

Here are some things that I think ought to be done/ added in the future, and which I will work on in my spare time:

1. Actually testing this in Windows. I have read that the ftd2xx module for Python does work on Windows, but I didn't actually try it.

2. Refactor the code a bit so that it is a little more universal, rather than tied to the two boards I tried it on. For example, I think there are multi-channel CH340 devices out there.

3. Maybe add some sort of delay so that, for example, a transmit amplifier doesn't kick on until an antenna switch has had a few milliseconds to switch. This is a pretty important safety feature that ought to be implemented.

4. Better documentation. I wrote this up quickly and I am not sure all the ideas are well-explained.

73s,
James AD5NL


Marty Wittrock
 

James,

When you get a chance, can you tell me how this connects to SDRAngel and from what actions in 'Angel can certain events (like PTT) can be performed? I would also like to know if there's a way to apply some sort of app-to-app communication such that when WSJT-X wants to transmit off a COM port that specific event can trigger 'Angel to go into transmit and then take the audio off the port selected by WSJT-X. Is any of this even remotely possible? Please let me know - thanks,

73 de Marty, KN0CK


James Dallas
 

Hi Marty,

My intent is to develop a YouTube video explaining all of this in the near future.


On Tue, Mar 19, 2019 at 1:00 PM Marty Wittrock <martywittrock@...> wrote:
James,

When you get a chance, can you tell me how this connects to SDRAngel and from what actions in 'Angel can certain events (like PTT) can be performed? I would also like to know if there's a way to apply some sort of app-to-app communication such that when WSJT-X wants to transmit off a COM port that specific event can trigger 'Angel to go into transmit and then take the audio off the port selected by WSJT-X. Is any of this even remotely possible? Please let me know - thanks,

73 de Marty, KN0CK