Python stream data directly

178 views
Skip to first unread message

Jo Oak

unread,
Jul 7, 2021, 3:13:25 PM7/7/21
to herme...@googlegroups.com
Hi all
Is there a way to use python to stream data directly from hl2? Not the change config. The sampling data. Planning to make a vna program based using hl2


Eric

Alan Hopper

unread,
Jul 7, 2021, 3:29:55 PM7/7/21
to Hermes-Lite
Hi Eric,
you can connect to the hl2 directly with udp following this  Protocol · softerhardware/Hermes-Lite2 Wiki (github.com) there is not actually that much to do to get the basics going.
73 Alan M0NNB

Roger David Powers

unread,
Jul 7, 2021, 4:18:58 PM7/7/21
to Hermes-Lite, Alan Hopper
+++ On Wednesday, July 7, 2021, 03:38:00 PM EDT, 'Alan Hopper' via Hermes-Lite <herme...@googlegroups.com> wrote:
+++ Hi Eric,
+++ you can connect to the hl2 directly with udp following this  Protocol · softerhardware/Hermes-Lite2 Wiki (github.com) there is not actually that much to do to get the basics going.
+++ 73 Alan M0NNB

Yes, reading the protocol spec and banging out your own code is certainly one way to go.

At the other end of the "spectrum", Quisk has a quisk_vna.py app that uses Quisk's existing HL2 suppport (and perhaps other radios too) to implement a VNA in Python.  I've never used it, though.  I thought I read it was not being actively supported any more, but it certainly would be easier IMO to use that as a starting point rather than starting from scratch.  Not that starting from scratch is a bad idea, if that's what you like doing.  Of course Jim is a very helpful guy so if you ask some questions he is often willing to respond either here or on the Quisk mailing list.

So far I have not found a generic Python module that streams data to/from the radio.

As directed by Steve I have found that the rudiments of getting data out of the radio are in the HermesLite2 github repo in the software/ft8 directory and in particular the rx4000.py file and the _getdata() method.  One needs to keep in mind that it was written for a specific purpose, receiving data from two different HL2s synchronized together, and some of the code in that file that is specific to that task, but it's not hard to figure out what that code is once you take the time to read it all.

I'm just starting down the path of refactoring the code in a way that would not have such linkage to the sync'd radios problem and would support up to 10 RX streams.  I'm kind of concerned that unpacking N streams in Python is not a good idea performance wise, but time will tell.

As mentioned, our Wiki on github has a lot of useful references, both in terms of the Protocol itself and/or Software that implements the protocol.

Regards,
RDP


ron.ni...@gmail.com

unread,
Jul 7, 2021, 4:34:31 PM7/7/21
to Hermes-Lite

I wrote hl2_tcp to transcode from the HL2 Metis Protocol 1 format UDP to rtl_tcp format, which is a raw unformatted IQ sample TCP stream.  See: https://github.com/hotpaw2/hl2_tcp 
From there I can read the raw IQ data steam from the TCP socket using either Swift apps, C code, Python scripts, or even Chipmunk Basic programs.
73,
Ron
n6ywu

Steve Haynal

unread,
Jul 9, 2021, 12:25:05 AM7/9/21
to Hermes-Lite
Hi Eric,

I suggest looking at rx4000.py too.

It is quite simple as it does only one thing: collect 4000Hz IQ samples to pass on to decoders. Sometimes it is easier to start with the most basic code which this is.

73,

Steve
kf7o

Jo Oak

unread,
Jul 9, 2021, 12:32:46 PM7/9/21
to Steve Haynal, Hermes-Lite
Thanks Steve, great example 

Quick question, how is collecting on 4000hz? I thought the hl2 data package contains all HF spectrum 0-38.4Mhz 

Am I missing something here? 🤔

Eric

--
You received this message because you are subscribed to the Google Groups "Hermes-Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hermes-lite...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/a790f52d-2537-440f-835d-b31d2c96e133n%40googlegroups.com.

Roger David Powers

unread,
Jul 9, 2021, 1:43:30 PM7/9/21
to Hermes-Lite
The ADC produces the 0-38.4 MHz spectrum but in normal operation the protocol only specifies transferring 48/96/192/384 kHz from the ADC out of the FPGA via Ethernet.  Actually there is a bandscope / wideband mode where you can receive all of the 0-38.4 MHz spectrum but not with enough resolution to decode signals within that spectrum, it's really just meant for surveying the spectrum.

Useful references:



It is a good idea to set aside some time to go through these in detail.  Thanks to the recent rainy weather in the Northeast USA I am finding the time to do that right about now, and the effort is worth it.  A lot of the features I've seen on the various software available for HL2 are a lot easier to understand once you know the protocol between the radio and the computer.

Heck, at some point I may even reverse engineer support for my old Flex-1500, it is basically a usb-based protocol 1 hpsdr radio.  

Regards,
RDP

Steve Haynal

unread,
Jul 10, 2021, 8:33:50 PM7/10/21
to Hermes-Lite
Hi Eric,

That Python code was for a special gateware where I had 4kHz receivers. The standard gateware has four 48/96/192/384 kHz receivers as RDP says.

73,

Steve
kf7o

Reply all
Reply to author
Forward
0 new messages