LongMynd to Nextion Interface

Uit Projectgroep .540
Ga naar: navigatie, zoeken

Longmynd to Nextion Interface


Info @ pe2jko@pg540.org


What is LongMynd @ LongMynd BATC information


Receiving part of my QO-100 station is build around Longmynd on PI4 close to my dish. Frequency/Symbolrate selection is done via QO-100-WB-Live-Tune from M0DTS and works fantastic. My experiment was trying to use HMI interface touch screen (Nextion 7 inch) controlling my complete QO-100 station incl the Longmynd tuner. Following flowchart (hardware) is used (only RX is explained here) :

Flow-nextion-quicktune.png


I choose the resolution of my interface maximum 14 channels. In each channel only 1Ms/s, 500Ks/s,333Ks/s can be detected. QO-100 WB Quicktune in Winterhill mode will scan the band each 2seconds and output via ethernet frequency and Symbolrate (on port 9900). This information is captured by the RPI-4 connected to the Nextion HMI display. It is being handled by Node-Red to make the decision what image to display on the Nextion. If the frequency is within specific window I determine what channel the station is received. If channel is for example 10, then I take into consideration the Symbolrate, if 333 Ks/s I display small green square, if 500Ks/s I use another picture with green wider bard, if 1 Ms/s even wider green bar. Each 8 seconds I clear all images on screen and recalculate what Quicktune is telling me. When I would like to see the station I touch the green bar and on the Nextion, a red indicator is drawn to let me know which channel is currently selected. Then I send command to Longmynd to tune to that frequency with that Symbolrate. The output ( video ) is captured in VLC or SMplayer on my PC. Due to the fact that I wrote also an MQTT interface publishing all information from Longmynd received station , I can easily show that on the Nextion display, showing MER/D value, Station name and FEC. Due to the fact that I also installed Node-red on my PC I am able to start/stop SMplayer in order to stop/start showing the stream (video). 3x Node-red, 1x Mosquitto and 1PC and 2 RPI-4 are working together. Sending commands to Nextion from Node-red is made out of 2 blocks, a function convert payload to ascii values and adding 3x code 255 :

var str = msg.payload;
var buf = []
for (var i=0, l = str.length; i < l; i++) {
    var ascii =str.charCodeAt(i);
    buf.push(ascii);
}
buf.push(255);
buf.push(255);
buf.push(255);
msg.payload = new Buffer(buf);
return msg;

Nextion-function-tx.png

Thats is feed into a serial out node. For receiving values from Nextion also a Serial node is used, but then a serial in node. This is first send to a switch which will detect which ID is touched on the Nextion. Each element will get a unique ID and send to Node-red. The switch will determine where this ID is needed. For example if the first channel is touched then it will go the a function "touch channel 1" :

code=parseInt(waarde,16)
if (code == 301) {
tune="[GlobalMsg],Freq=10492750,Offset=9750000,Doppler=0,Srate=333,WideScan=0,LowSR=0,DVBmode=Auto,FPlug=A,Voltage=0,22kHz=Of"
}
if (code == 501) {
tune="[GlobalMsg],Freq=10492750,Offset=9750000,Doppler=0,Srate=500,WideScan=0,LowSR=0,DVBmode=Auto,FPlug=A,Voltage=0,22kHz=Of"
}
if (code == 1001) {
tune="[GlobalMsg],Freq=10492750,Offset=9750000,Doppler=0,Srate=1000,WideScan=0,LowSR=0,DVBmode=Auto,FPlug=A,Voltage=0,22kHz=Of"
}
msg.payload=tune
return msg

In Nextion UI I define that when channel 1 is touched, code 301/501/1001 is send. In the same time QuickTune will tell Node-red if it is a 333/500/1000 Ks/s station on channel 1. I disable touch function for graphic element which is not the correct value. So if it is a 333ks/s station I disable the graphic element for 500ks and also the one for 1000 Ks. So when I touch channel 1, only element 333ks/s is visible and Nextion will send value 301 to my RX receive node, the function will create the string for Longmynd to tune to that frequency with that samplerate. If a station of 500ks appear on channel 5 for example, I make the 333ks and 1000ks/s inactive, and only the 500ks/s become visible. If I touch it, Nextion will send 505, the vaulie is then intepreted by the function as 500ks/s station on channel 5. It creates the string which is send over ethernet to Longmynd. This now works on all 14 channels.

Nextion-switch-flow.png


The Focus blocks will move a small red square indicating what channel is touched. This is handy so I can see which channel is selected. It will only move a smal red square in horizontal axis.

Port9900-nextion.png

Above Node-red blocks listen to Quicktune port 9900 and will split each message to the correct Symbolrate and frequency. These blocks take care that the correct image is displayed on nextion. As I mentioned there are 3 different size green blocks, the 333ks is the smallest, the 1000ks/ the biggest. So visually it can be seen quite quickly if it is 333/500/1000ks. It is also take that the green block is shown on the right channel. This in general the functioning of this experiment. Nextion design UI interface with all graphic elements activated (here are also the control for the Pluto and powerstages and portsdown4, but not explaned in this document)  :

Nextion-design-complete.png


Nextion interface after boot. I disable all TX settings because by default the transmitter is OFF. Below you see the graphic elements showing channels which are occupied, on the first 9 channels there can be 3 different Symbolrate stations, therefore 3 graphic elements with different width are on top of eachother, I make them visible or hide them whatever s currently active. If station of 1000KS. transmit on channel 5 then I disable the 333ks on channel 4 and 6, and disable the 500ks element on channel 4 and 6, then make element 1000ks/s visible on channel 5, if I tocuh it then Longmyd will get the command to go there and show the stream.

Nextion-rx-only.png

Experiment succeeded. Lessons : element ID by Nextion UI design software is changing whenever you add elements/switches/text/and so on. The nodes in Node-red are relying on the correct ID, so it happened few times that I had to define the correct ID to the correct Switch node. The ID numbers are generated from top left to top bottem and each element will get is't number automatically. Giving names to each element makes it easier to read what it is doing. Designing graphic elements was something new and I think that in other projects perhaps I will use Boxy SVG, looks quite powerfull. The experiment was fun, and again show that Node-Red/MQtt is super powerfull and handy for Ham radio use.

Info @ pe2jko@pg540.org