Adaptive power control using MQTT (DATV on QO-100)
Automatic Adaptive power settings for DATV on WB Transponder QO-100
Info @ pe2jko@pg540.org
Credit F5OEO, Evariste
Hardware Equipment used :
1.1m offset dish
Raspberry PI4
Pluto + Amplifier
Software used :
Longmynd DATV receiver software ( Source on GitHub )
Node-Red Starting point install Node-Red on PC)
F5OEO firmware v.0303 ( still in beta, March 2021 )
UDP message conversion LongMynd to MQTT ( source available , please send mail )
Advantages :
1) When crowded Transponder DATV station remains with constant powerlevel, easy for other receiving stations to have signal @ minimum Snr level.
2) With changing weather conditions power level is adjusted acordingly, rain/snow have no influence for receiving stations.
3) Automatic power level when changing fec or samplerate.
4) Effective use of Transponder.
Method of Operation :
System is using MQTT messaging to receive Snr values from LongMynd receiver and sending messages to modulator setting powerlevels. This setup create a locked loop and when defining the correct levels system is automatic and stays between defined levels. When swiching on the DATV modulator , LongMynd receiver must be tuned to same frequency and setup with the correct SampleRate. ( Currently it is manual, but plan is to make this also automatic ). When tuned the LongMynd will detect a lock and start sending MQTT messages to central broker (in my case running on a Raspebrry PI3). Node-red ( in my case on PC ) subscribe to this topic. Settings of Modulation code and Fec determine the minimum Snr. This value + 1 dB is set as min_snr value. Max_snr value is 1 dB higher then min_snr. This will give a 1dB window and minimum D1 on receiver. Then when receiving Snr drops below the min_snr the modulator will be told to step up it's power. Once it reaches the min_snr it stops increasing power. When receiving Snr is above snr_max then modulator will reduce it's power output. System is dynamic so when other samplerate or fec is choosen the system calculate min_snr and max_snr and modulator start to adjust to find the correct power leven to be just above the min_snr value. Same time dus to changed Fec/Samplerate the transport stream has to be stopped and calculated and started again. The modulator add null packets during that process and modulator continue to output. To prevent overshoot or undershoot of powerlevel message limit was introduced to 1 message per 2 seconds. So power adjustments are slow. Dynamic power can be switched on/off using Gate node.
LongMynd currently is not supporting MQTT messages, therefore an convertor was made between the standard UDP messaging build into LongMynd and MQTT. Information from LongMynd is converted to MQTT using the opensource MQTT-C implementation . This program runs on Raspebrry PI4 together with LongMynd software.
Modulator from F5OEO starting with Firmware 0303 supports MQTT messaging and Node-Red on PC subscribe to topics on the local MQTT broker on Pluto device and also publish messages on the local Pluto MQTT broker. For example to set the power level. The flexible Node-Red will make all the connections and build the GUI around this solution.
Please see some Node-Red examples :
Full Dashboard March 2021
Global settings for FFMPEG :
These 3 parameters are captured in order to pass to a batch file which tell FFMPEG what to do. Resolution, Frames per second and Mode. The batch file will select the correct input sources depending on this setting. The output of these nodes are going to other tab where the paramaters are send to the batch file. I write the settings to a local file, so when the system starts up it will remember what was the last settings. Each time you change the global setting the file linked will be overwritten with the new setting.
Pluto MQTT Status flow
Pluto have it's own MQTT broker inside which will plublish messages. In this flow I connect to Pluto mqtt broker and sunscribe to few topics. There are many topics, this is for me the most important ones. MQTT.fx client can help you finding out which topics are availbel, becuase there is a scan feature inside. The full list is not yet available. But from the flow you can see the ones I use. Just use a nice GUI widget to show the content.
Adaptive Power control flow
It starts with subscribe to the MER topic ( the LongMynd tuner will send messages about its received value when locked ). This will be send into a GATE node, this node will block or allow payload to travel through the gate. A function will compare the MER value to min_snr and max_snr. If it is between these threshold it will send "OK" , when it is too low it will send "UP", when it is too high it will send a "DOWN" message. Then I added a limit Node to limit the amount of messages to 1 message each 2 seconds. This message will be send to second funciton node who will drive the power of the Pluto. As the power window is from -60 to 0 I am counting up or down with steps of 1. SO if I receive message UP then I increase ( more closer to 0 ) the value, when I receive a DOWN message I will reduce power by decrease the value. I set the absolute minimum and maximum values to -18, becuase I don't want to burn my AMP. So the counting down will stop at -18. That is the highest possible value I send to Pluto power. In addition the LongMynd receiver must be tuned to the frequency and the samplerate of the transmitter, otherwise it can't lock. Once we go "on air" then UDP message with frequency and smaplerate values ( similar to the QuickTune appiication ) are being send to Raspberry PI4 with Longmynd. It will tune automatically. So now both receiver and transmiter are in sync.
Function what to do of MER is lower or higher then threshold:
var mer = msg.payload var pwr var min = flow.get("min_db"); var max = flow.get("max_db"); var mm = parseFloat(mer).toFixed(2); if (mm >= min) { if (mm <= max) { msg.topic = "OK" } else { msg.topic = "DOWN" } } else { msg.topic = "UP" } return msg;
Function to in/decrease power level depending on status (UP/DOWN/OK):
var count = flow.get("count")||-40; if (msg.topic === "init") { count = msg.payload; } else if ((msg.topic === "UP") && (count< -18)) { count++; } else if ((msg.topic === "DOWN") && (count > -60)) { count--; } else if ((msg.topic === "OK") ) { } // Save the new value back to context so it will be available next time flow.set('count',count); // Update the message payload and return - no need to create a new msg msg.payload = count; return msg;
Scary complete flow, don't be afraid
This is the full flow controlling some more devices, as I also can switch on/off my pre-amp and final amp. Called "trap1/2/3". Please see the incoming MQTT nodes, the functions and UI output widgets. Also the nodes are included to define the min_snr and max_snr values. I write 2 files in a directory which contains the value of FEC and Modulation Code ( QPSK/8PSK etc ), these 2 parameters define the miniumum Snr required to receive the signal. For example QPSK Fec 1/2 needs 1 dB above the noise. A batch file input = fec and modcode, output is Snr value. This Snr value I read into the flow and add 1dB for min_snr and +2 dB for max_snr values. This in theory will bring the receiver on D1 receive level. ( Snr - min required Snr = D value ). So in the flow the min_snr and max_snr is feed into the Function to define UP/DOWN/OK messages. So this is all dynamic, means that if I change the FEC or Modulation Code automatically the Pluto will adapt to this min_snr and max_snr values by increasing or decreasing the Pluto Power levels. ( min = -60, max = 0 )
Connections to manually set parameters in Pluto using MQTT :
In this flow I am able to set other parameters in Pluto using MQTT publish messages. Also the connections are visible to write the snr_min and snr_max values and the process to stop/start ffmpeg. This is required becuase when dynamically change the fec/samplerate first FFMPEG needs to be killed , then the new minimum samplerate ( calculated by the Pluto ) needs to be given as muxrate. If you don't do it, then video/audio will be intermittant. As with this new firmmware from F5OEO we can change it on the fly without stopping and starting the the transmissing. F5OEO add null packets when input stream is missing.
Conclusion:
Although very nice feature works nice. Beatifull to see it work when transponder is busy and strong signal arrive and disappear. The output power of Pluto changes with small steps. This setup require some experience with Node-Red, but there is so much information on internet how to build flows and how to create functions that it is not too difficult. Question ? pe2jko@pg540.org
'73