Cheap spectrum analyzer protocol

06 Sep 2020 - tsp
Last update 06 Sep 2020
Reading time 5 mins

Introduction

Since I bought a cheap spectrum analyzer (note: Amazon affiliate link) some time ago I decided that I wanted to develop an own service to work with that device since I required to have some automation available - as well as automatic data analysis. These cheap devices usually are designed to work with a software called WinNWT / LinNWT that has been developed for a specific spectrum analyzer by an amateur radio operator with the call-sign dl4jal. Usually these devices are sold without his consent - i.e. they’re used with this software without any license. This was also a reason that I wanted to develop some own software for this series of cheap spectrum analyzers. I don’t think it’s right (not talking about legal) to use some software without consent of the original author, especially not if a huge number of spectrum analyzers are developed to target his software - and even having him flooded with support requests.

Also I wanted to have an network attached device instead of a locally operated one that supports remote control as well as a web interface. To support that mode of operation I attached the cheap spectrum analyzer board to an Raspberry Pi (note: Amazon affiliate link) and put everything including an 5V power supply (note: Amazon affiliate link) into a 19 inch case (note: Amazon affiliate link) that has been mounted into my local experimental rack.

Cheap spectrum analyzer board, 35 MHz - 4.4 GHz

Since documentation was hard to find - except for the reference to an software that was not licensed to be used with this hardware - I started to write this page as some kind of reference for myself (information is also included in my own measurement daemon of course - which is also developed to be modular to support own devices using a totally different and more robust protocol). There is no guarantee this information is complete or correct though, it’s just a collection of what I’ve been capable of gathering from various sources.

Commands

Every command starts with the byte 0x8F and is then followed by a single byte that identifies the command:

Some firmware versions also support a new set of commands:

Numbers are passed in ASCII decimal in commands (!). ADC counts on the other hand are passed in binary in little endian format.

Linear scan

The linear scan simply runs the tracking generator starting at a specified start address with a specified step width. The analyzer samples a specified number of bytes and transmits an ADC count for each of two channels (usually only one is supported on cheap devices).

The response is simply consisting of 2 bytes per channel for 2 channels (i.e. 4 bytes) per step.

Logarithmic scan

Works exactly the same way but does a logarithmic scan.

The response is simply consisting of 2 bytes per channel for 2 channels (i.e. 4 bytes) per step.

VFO settings

Sets the VFO frequency without any response.

Recall current measurement value

Recalls the current measurement value. This can be used to manually step the analyzer without any of the automatic scan commands.

The response consists of 4 byte.

Calibrate / set reference frequency

Calibrates the reference frequency.

Version query

Query version from the device.

Response is a single byte containing the firmware version.

Set attenuator

Switches the attenuator (if present). This is usually not supported on many of the Chinese clones - and is usually only a simple binary output somewhere on the device. For PIC based devices the specified byte is directly written into PORTB without any further firmware interaction.

Logarithmic scan, version 2

Also does a logarithmic scan as the classical logarithmic scan but allows to specify a delay to be waited in microseconds between each measurement to allow reaching a steady state.

The response is the same as for the version 1 scan command.

Linear scan, version 2

Also does a linear scan as the classical linear scan command but allows to specify a delay in microseconds between each measurement to allow reaching a steady state.

The response is the same as for the version 1 scan command.

This article is tagged:


Data protection policy

Dipl.-Ing. Thomas Spielauer, Wien (webcomplains389t48957@tspi.at)

This webpage is also available via TOR at http://rh6v563nt2dnxd5h2vhhqkudmyvjaevgiv77c62xflas52d5omtkxuid.onion/

Valid HTML 4.01 Strict Powered by FreeBSD IPv6 support