--
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/a9dbc4f3-6a75-4689-9768-b9876943f2c8n%40googlegroups.com.
Scott, I believe you are on the right track, and this is good stuff to discuss. Here is some refinement info to work on.
Conceptually it seems you are treating the HL2 and the SDR app as a single device in your workflow below. Perhaps you mean the “SDR app” in steps 5 and 6, not the actual “HL2” device? It makes a big difference. Further you would need to define what you mean by “remoting”.
The SDR app (or a user script) is responsible for requesting the values from the IO board pico via I2C and then display/react however the SDR app author decides. The HL2 is not in the decision tree, it merely converts the i2c bus data to the ethernet stream so the SDR App can get/put values to the pico and/or N2ADR filter boards (separately). There are timing and data rate concerns.
So #5 and # 6 below would be reworded replacing “HL2” with “SDR App”.
That is a significant detail since the HL2 is just a conduit, it is up to the SDR app and Pico firmware authors to decide what to do with the values. There are no HL2 firmware changes required. As there are several SDR apps that support the HL2 and a subset of them currently offer limited support for the pico-based IO board, discussion is directed to the SDR app and any pico code authors, not the HL2 firmware. There is a set of registers agreed to for the pico and adding more is not difficult, it was designed for that. The SDR apps have to change to leverage the new registers – and still catch up to the existing ones more fully over time if they choose to do so.
You mention the HL2 needs to take care of this SWR process to permit remoting. You will need to clarify what remoting means to you. Since the HL2 is a headless device, you can argue remoting is always how things are done. By using the term “remoting”, you want to clarify at what level, and in or outside the LAN. If “remoting” to you is access outside the local network through a firewall/router, SDR apps can access the HL2 directly via ethernet if proper port forwarding/security work is done, provided the performance considerations are handled (difficult). Alternately, more robust, some SDR apps have built-in remote capability such as the new Quisk feature for example, or is accessed by a suitable remote desktop app. Either way, the SDR app or a user script (a modified hermeslite.py for example) has to request and process the I2C values received over ethernet and display the results. Since the SDR app runs on a “remote” computer separate from the HL2, there are real time considerations for response times, maximum update rates and congestion, and any resulting control type features such as protection and tuning, if any, you want to happen on site. Example: a high power amplifier HI SWR shutdown feature initiated by a SDR app vs the pico code.
As Jim pointed out, The forward and reflected pico ADC sample values are not sampled at the same moment. Highly variable modulation types like SSB and Tx/Rx transitions that happens during the sampling period will generate false SWR results requiring they be filtered out. PTT state is easily monitored in the pico (EXTTR) to help with the filtering process and place only good values in the new registers. Same for a tuning process. Doing this filtering at the SDR App which has time delays is less precise, especially if truly remote.
Once the SDR authors make the changes, if they do, to retrieve this new data, they will have 2 sets of meter data to choose. They could display either or both. You can also extend hermeslite.py script and build your own metering UI app that runs in parallel with the SDR apps thus not require any SDR app changes to get what you desire. Further, is there a case that both meter data sets interact and require action somewhere? At the SDR app, or on the pico, or both?
I had not looked at the Pico specs before. Thought I would share my investigation since it is relevant to Scott’s goal and likely many others.
About the ADC I summarized my findings below:
Reading the pico ADC specs and other data Raspberry Pi Pico Datasheet, it has a single 12bit resolution SAR ADC with 4 channels, 3 available externally (ADC0=26,ADC1=27,ADC2=28), one that measures internal temperature (ADC3). It does not have an onboard voltage reference. The ADCs can operate in polling, interrupt, and use FIFO in DMA mode. Conversion speed = 2uS, 500,000 samples per second max. Input range is 0 to 3.3VDC with the Picos’ switch mode power supply at 3.3V (plus noise impacts) used as the reference voltage. Further reading turns up a data sheet note the effective number of bits (ENOB is 8.64 if everything else was ideal for the full range usage. Grounding will impact this among other factors and the AGND runs under the ADC related pins and can be connected to DGND if high accuracy is not required. There an amount of offset due to current draw with temperature impacts. The ENOB (effective number of bits) of 8bits can be improved some by avoiding 4 particular ADC results and control of VCC and VDD noise.
On the IOBoard the DGND is connected to AGND and all 3 ADC inputs are unconnected. Solder a jumper direct to a pico edge connector pad (31, 32, or 34) to use them. The IOBoard has a 3.0VDC (+/-1%) LM4040DIM3X-3.0/NOPB precision voltage reference on the ADC_VREF pin so the ADC input range is max = 3.0VDC and lower noise than the internal Pico 3.3V. Using an unused ADC input tied to ground can help determine then noise floor if desired. Separating the AGND for DGND could also be done if you have a better plan to deal with it. jimahlstrom/HL2IOBoard (github.com)
With that, lets keep things simple and assume we get a decent 8 bit accuracy with a range of 0 to 3.0V inputs and assume that is good enough for our needs. Unknown for now is the accuracy of the external FWD and REF power signals. Let’s also assume they are good enough (It is what it is). Since there is only 1 ADC, the 4 inputs have to be selected one at a time, sampled in turn so it is not possible to get 2 readings at the exact same time so must account for that. In this case of not using temperature, and connecting ADC2 to ground to get a decent idea of what 0 volts is, we only need to switch between ADC0 and ADC1 keeping their results a bit closer to same time sampling.
To throw out another idea, in my external remote wattmeter projects I use one or more external surplus commercial bi-directional couplers appropriate for the power and frequency of interest. I use a ADL5519 RF Power Detector - sv1afn.com dual 10GHz log RF power detector board from SV1AFN. I do mostly VHF and microwave so this is handy but there are many lower cost, lower frequency detector boards also. I get a predictable output voltage for both channels that allows for easy coupler calibration and works for any amplifier chain. Not many amps come with voltage outputs for Power and SWR calc after all. You may have power sensors hanging around from old or current remote wattmeter products. They maybe diode based and require a lot more calibration effort. This does not address the problem of sampling at the same exact time.
The pico board runs complied code generated from C/C++ or Python(microPython) we call firmware. Let’s use the term script here to refer to the hermeslite.py Python code. The script has examples to access the HL2’s connected I2C busses which in turn connect to various IO objects in and outside of the HL2 main board, one is the Pico board. SDR app uses the same access. One useful detail to know is that you can talk to the HL2 on 2 ports. So while the SDR apps usually connect to a HL2 via UDP port 1024 another process like the script, or the IO Board Control app HL2IOBoard/software at main · jimahlstrom/HL2IOBoard (github.com) can connect via Port 1025. You should get familiar with that program by using it and looking at the code. It already reads ADC0, 1 and 2. Note the unconnected ADC pins input are not really 0.0 for reasons above. As seen below on ADC0, here it is 0.289V. Max will be around 3.0V. 4095 bits will give 3.0/4095 = 0.0007V per bit. In addition to the IO Board Control code you might find this useful - Raspberry pi PICO ADC reading - Stack Overflow
You could extend the Control app to add your own info printing out the ADC average voltages calculate SWR, check for nonsensical results. IN your Pico code you can stash the filtered sample results in a new “registers”. Note that registers 25-30 already exist but they raw readings by default. You can modify the pico code to process the values in these register and thus avoid defining new registers. SWR can be calculated on the UI side easily enough. If calculated on the Pico you will need want a new register to share that value to the SDR app or script easily. You will want to decide where you will store and apply calibration for your chosen sensors. It could be hardcoded, or a UI developed to input or acquire data during a calibration process.
Having built several remote band decoders+power meters on multiple CPU types, the details are the same and burned into my brain. 😊 My last QTH (and soon new QTH) VHF+ station is built around remote transverters and amps. IF rig is in the shack and all else for 144-1296 is located outside near the antennas connected by ethernet and a few control and low power IF cables) that depend on all of this stuff. Even the rotator controller is enet controlled from the same desktop monitor/calibration Python UI.
While hermeslite.py (see IO Board version link above) is useful I think you will get further faster by starting out with the IO board control program. Get your Pico build environment setup by reading/watching the many tutorials. Edit the code with any editor, compile it on the command line is simple enough. Drop the file on the Pico USB drive at pico boot per the instructions on the IO board page. You should practice that compiling and uploading the test and main example programs first as a baseline then attempt modifying things. You can get started very fast by modifying the Control program code on the PC side and simulate or connect pots to 3V for test voltages.
From: herme...@googlegroups.com <herme...@googlegroups.com>
On Behalf Of Scott Massey
Sent: Tuesday, January 23, 2024 5:53 AM
To: Hermes-Lite <herme...@googlegroups.com>
Subject: Re: Power / SWR Meter, Meter Display Calibration
Hi Mike,
--
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/fdefb177-c57a-4577-9c23-1c4ef75e5203n%40googlegroups.com.
Scott, the code on the GitHub page already does the ADC reads. Look at the i2c_slave_handler.c HL2IOBoard/n2adr_lib/i2c_slave_handler.c at main · jimahlstrom/HL2IOBoard (github.com) starting at line 166 for the pico side and line 215 for the Control program side code HL2IOBoard/software/n2adr_ioboard.pyw at main · jimahlstrom/HL2IOBoard (github.com) that makes the request and displays it.
Jim, regarding the 2 ADC values returned each read you mentioned. Looking at the i2c_slave_handler.c, I do not see in the code where 2 ADCs are read in sequence, I only see 1 ADC channel is read per request.
At line 166 for ADC0 for example it reads the ADC with input 0 selected and shifts data into the MSB and LSB registers then breaks. How does it come back around to pick up ADC1?
On the Python side (begins at line 215) each elif collects the MSB and LSB for 1 ADC only, I do not see how it becomes 2 ADCs read here. poll_state == 5 at that point so would exit after the one selected ADC is read each update cycle.
I see there are 4 bytes read from the returned pico data but I do not see how more than 2 bytes are filled with ADC data by the slave handler.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/322f70b7-fe9a-4de9-85a9-b40d44ab780dn%40googlegroups.com.
--
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/fdefb177-c57a-4577-9c23-1c4ef75e5203n%40googlegroups.com.
...
As we are limited to 0 to 255, logarithmic values should be used for the power readings, maybe even the current but linear for the temperature. There are a lot of more mathematical people on the group than me, so please use your talents to devise the correct scaling.
Jim, regarding the 2 ADC values returned each read you mentioned. Looking at the i2c_slave_handler.c, I do not see in the code where 2 ADCs are read in sequence, I only see 1 ADC channel is read per request.
I guess what am not seeing is where or how the slave handler is called the 4 times. Presumably from a IOboard i2c read function on the python side but I am not seeing it yet, it looks like reg 25 and 26 only are read to me.
From: herme...@googlegroups.com <herme...@googlegroups.com>
On Behalf Of James Ahlstrom
Sent: Wednesday, February 7, 2024 12:48 PM
To: Hermes-Lite <herme...@googlegroups.com>
Subject: Re: Power / SWR Meter, Meter Display Calibration
On Thursday, January 25, 2024 at 7:06:15 AM UTC-5 K7MDL wrote:
--
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/c0dd0132-20c4-405b-a9d9-6a0532561ad4n%40googlegroups.com.
That is why I did not see it. It was in the gateware. Thanks Jim!
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/f69fafe7-c933-4fd1-b454-04000314bd55n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/MW4PR10MB5728CAE900C1AC65D2160EE5F6442%40MW4PR10MB5728.namprd10.prod.outlook.com.
On Feb 10, 2024, at 11:24, James Ahlstrom <jah...@gmail.com> wrote:
No, the Pico never reads the ADC until requested by the SDR program. The request from the SDR program goes to i2c_slave_handler() and it returns the values to the SDR program.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/679822ed-83ff-433e-9546-49d1f52b5cb4n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/9ed2d788-7e85-43d6-83f6-ca1e14d93630n%40googlegroups.com.
On Feb 24, 2024, at 20:31, James Ahlstrom <jah...@gmail.com> wrote:
Hello Scott,
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/61b3d868-cf24-45a2-927c-1282d9b83921n%40googlegroups.com.
On Feb 26, 2024, at 13:03, Mike Lewis <k7...@hotmail.com> wrote:
Scott, from your description below you tried to rename, compile and load just the i2c_slave_handler. You want to compile main.c from the n2adr_basic folder. That include4s i2c_slave_handler. Run the cmake and make commands per this section
HL2IOBoard/n2adr_basic at main · jimahlstrom/HL2IOBoard (github.com)
Then drop the compiled app onto the pico usb drive. Watch for the correct flash fast flashing rate of the pico LED to verify it is talking (over i2c) when you start the SDR app or IO I0 board control program.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/d915203e-6917-4b5b-9d91-7f72dd2e298fn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/d915203e-6917-4b5b-9d91-7f72dd2e298fn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/fcc6bc2f-6b3a-4b14-8a5c-50f52733bcb2n%40googlegroups.com.
Just hit the PA values button seen in the screen shot.
--
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/f7a2a931-a60d-4aae-a941-98ee18baf69cn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/01cae1cb-012a-481c-90e6-45f5c4e77cecn%40googlegroups.com.
On Mar 30, 2024, at 12:24, James Ahlstrom <jah...@gmail.com> wrote:
A better solution to all this is an independent program to monitor and display power and SWR from the IO board. Then no modification of Thetis is required, and data from the HL2 and the power amp is available simultaneously. Such a program can be derived from n2adr_ioboard.pyw.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/ec257290-08c9-4e5f-b966-b2442c11db20n%40googlegroups.com.
On Mar 31, 2024, at 09:11, James Ahlstrom <jah...@gmail.com> wrote:
Perhaps I wasn't clear. I meant a completely different external program that displayed power and SWR in its own window.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/b5d3da52-9afc-459b-a5eb-2f36cdfb088cn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hermes-lite/B85F7BE6-EDEC-474B-9226-BEC2F7D460A1%40gmail.com.