Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

Remote operating and Node Red

Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
I have always wanted to build a better remote station interface, but I struggle with coding anything beyond "Hello World" and usually even that has a bug or two.  

Several times, I have played with NodeRed on the PI, and I keep coming back to it.  

NodeRed is a GUI based coding platform, much like wiring, and it has great promise.  I do know 1 or 2 hams that are using it, so I am hoping they might jump in and help mentor the rest of us and share some ideas.

https://nodered.org/docs/hardware/raspberrypi

This is what it looks like controlling my simple 4 relay RPI board:



And, this is an export of the code that you can paste into a NodeRed console.  

[{"id":"6fc89136.65404","type":"rpi-gpio out","z":"2c0e83c7.f7ad2c","name":"Relay 3","pin":"31","set":true,"level":"0","freq":"","out":"out","x":380,"y":540,"wires":[]}]

Next, add MQTT to the above to send out messages to other bits, including IOT devices.

At this point, this is about as far as I have gotten, but my goal is a control panel I can read/use on a web page or an iPhone to turn things on or off.

I have seen Dashboards added, reading wattmeters and maybe even handling rotator control too.

Mike 
«13456710

Comments

  • W9OYW9OY Alpha Team Member ✭✭
    edited February 2019
    I've been looking at this using ESP 8266 wifi modules and the arduino environment.  Here is a node red example  

    https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/

    The 8266 has multiple digital I/O and an analogue input as well plus an I2C bus and can drive an OLED display.  You can do the "relay control" from a phone or browser without MQTT but MQTT can be configured to receive as well as feed back in a publish/subscribe format with several levels of robustness to understand if the job really got done.  I would love to see I2C enabled in the radio to allow status query and thing like freq query and then set up wif AP wireless intranets around the station off the main router and maybe a rasp pi as a MQTT broker for running relays, like antenna switching or 4 square controllers or turning rotors with positive feed back of the status of the remote device.  The best dev board is the NodeMCU 12E   Here is a web based web server relay control

    https://www.instructables.com/id/Control-ESP8266-Over-the-Internet-from-Anywhere/

    MQTT servo controller

    https://www.instructables.com/id/Simple-IoT-Remote-Switch-With-MQTT-and-ESP8266/ 

    There are a million pages and youtube vids on this kind of setup 

    Alternatively you could do the radio query over ethernet but more complicated 

    I built a band switch capable of being run from Yaesu BCD as an experiment.  The Flex USB puts out Yaesu BCD

    73  W9OY
     

  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited June 10
    Thanks Lee

    You are way ahead of me.

    But, I did get my basic switch working and a web page built for it.  The learning curve is key, but in about an hour, I now have my basic web interface that even looks good on an iPhone.  If anyone is interested in the very very basics, I'm happy to explain further as I find getting from getting it installed to sort of working is a big jump and all the tutorials have a different focus.    Let me know and I can a video in baby step mode and how it works for us ham operators.

    I even added a few hosts to ping to see if they are running.  

    This is with 2 relays and I really didn't have to write a single line of code.  Relays 3 and 4 haven't been moved to display on a web page yet.

    This is how I created the actual dashboard http://www.steves-internet-guide.com/node-red-dashboard/

    Mike va3mw


    image

    image
  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited January 12
    An update.

    I managed to figure out the KPA500 communication and I had some help from some others for the W2 watt meter and the Rotator Controller (thanks N6NU).

    The hardware is a Raspberry PI, KMTronic Web Switch, a StarTech USB to 4 Port RS232 controller, KPA500  Amp, an RC-1 RS232 Rotator Controller and a W2 wattmeter.

    There is a 'little bit' of Java code for the KPA500 band detection.  I still need to do the Alarms and resets for the Wattmeter and the Amp.  The differences in the wattage are due to calibration and I need to get the Bird wattmeter out and do the calibration (right now, I don't know which one is right! LOL ).

    Now I don't have multiple little applications and I can run this from a PC or a mobile device.

    Mike va3mw



  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited February 18
    An update on this.

    I feel I have been reasonably succesful with this, especially since I'm not really a programmer and the last time I did some programming, Basic had Line numbers and my $3000 IBM PC booted off single sided floppies.  

    I'm headed down the path of now being able to do things like:

    • IF Amp is turned on in Operate mode and if RF Power of Flex radio is greater than 25 watts, set drive to 25 watts on radio.
    • Or, if RF power of radio is set higher than 26 watts as example (maybe that is my maximum RF drive), send a command to move the Amp into a StandBy state
    • Or, if, in the CW portion of the band, set mode automatically to CW
    • Or, if the PA Temp on the Amp is starting to climb maybe reduce the RF drive level of the radio.
    What is great with using NodeRed is the ability to make it look like 1 big RF solution.

    I haven't done any of the above yet, but it can be done with limited programming skills.  Maybe over the coming days I'll get it done.

    Anyone else want to play?  I know of 2 others who are working to streamline their station.

    Mike va3mw 


  • John - K3MAJohn - K3MA Member ✭✭
    edited June 11
    Mike

    Thanks for your work and sharing.  I already have a reasonably good control interface but it can always be better.  And it fun to play with new tools.  A couple questions I have that you might be able to answer.

    1) Does Node Red interface with the Digital Logger Web Switch?  https://www.amazon.com/Web-Power-Switch-Pro-Model/dp/B0765NCB2L/ref=asc_df_B0765NCB2L/?tag=hyprod-20&linkCode=df0&hvadid=228860412633&hvpos=1o1&hvnetw=g&hvrand=8963734946813561216&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=1024840&hvtargid=pla-377660188761&psc=1

    2) Does Node Red have capability to intercept from the Flex and send UDP info to devices like the Palstar HFAuto?

    3) Is there voice control capability like Alexa control?

    Thanks, John K3MA
  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited June 2019
    Hi John

    If the Digital Logger Web switch can be commanded via an API or something similar, I would say yes.  You  may want to look in the NodeRed repository and see if anyone else has done it.  

    Yes, it could.  I am already querying the radio for RF power and such.  This is a big advantage of the Flex  product and their API's.

    No idea, as I don't do any remote connections such as that.  Again, you could ask in the NodeRed user group and I am sure someone has played with it already.

    Mike va3mw
  • Steve K9ZWSteve K9ZW Member ✭✭✭
    edited June 2019
    @Michael - Just set up Node-Red on a Linux box to experiment with the environment.  Looks great!

    Would appreciate a step-by-step guide on how you did your implementation.  Thinking this could be a very fine way to handle some of the things I want to do in an integrated fashion.

    Thank you for pointing out the possibilities of Code-Red to the community and sharing you implementation!  

    73

    Steve
    K9ZW

    Blog:  http://k9zw.wordpress.com 
  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited June 2019
    Hi Steve

    If you got it running, that is great.  

    I think the next step is to build some of your own flows and see if you can get a GPIO port to turn on and off.  

    Since all our HAM stuff is generally RS232 (except Flex Radios which does LAN based communication), what is it that you want to control?  Let me know and I can help you get started.  If it is RS232, there are some Palettes, you'll need to install.  

    The Palettes are the plug ins to do things.  You will need the Dashboard palette.  And the Serial (RS232) one.  

    See if you can get those loaded and then share with us what you want to control.

    Mike

  • David Decoons, wo2xDavid Decoons, wo2x Member ✭✭✭
    edited June 13
    Hi all,

    To revive the topic of Node Red, I've been out on medical leave and needed something to take my mind off my recovery. So I worked on my Node Red project.

    Node Red is software I am running on a Raspberry Pi 3B plugged in my network. I've interfaced it to my Flex 6600, Elecraft KPA1500, Yaesu G1000dxa rotor with Idiom Press serial card, and my DLI Web Switch Pro network controllable outlet ****.

    This gives me a simple web page to provide control and status of the various equipment. It also allows controlling equipment without the need for a PC to be on. We all know a bad Windows update can wreak havoc on a remote station depending on a PC.

    The only band I need a tuner on is 80 and I set up the KPA1500 to memorize settings every 20 kHz.

    My antenna switching is done via a SainSmart USB8 board connected to a W2IHY 1x4 antenna switch and antenna switching follows active TX slice on radio. So amp is set to have tuner active on 80 and only use antenna 1 out.

    Here is a screenshot of Node Red as seen in a normal web browser. When using a Smartphone such as my iPhone XS each section is stacked vertically so I only need to scroll down the page to the section I want. Very handy when operating remote.

    I have some more work to do and will probably add rest commands to allow shortcuts in Node Red to radio functions such as preprogrammed memories, profiles, etc.

    Always fun! And thanks to Mike Walker, VA3MW and Andreas Junge, N6NU for getting me started and providing some guidance along the way.

    73
    Dave wo2x





  • David Decoons, wo2xDavid Decoons, wo2x Member ✭✭✭
    edited September 2019
    John

    I have the DLI Web Switch Pro working fine now.

    Also you can parse the radio frequency and send it out as a UDP broadcast (I haven't done it since I no longer have the HF Auto).

    Dave wo2x

  • AlanAlan Member ✭✭
    edited June 24
    Hi Mike

    Well...you got me hooked!

    I do not have a Rasberry Pi, so I loaded up Debian Linux on my Mac using Parallels which created a virtual Rasberry Pi.

    Next, I loaded up Node-Red simply by running the script in Debian terminal shown on the Node-Red website.

    So far using Node-Red, I connected to the Flex Server, I created a switch to control the GPIO pins on a Rasberry, loaded the Dashboard Pallet and made a simple switch on the dashboard (very ugly, not as pretty as others on this page).

    I ordered a real Raspberry Pi and relay board from Amazon.

    My first goal is to control eight relays for various functions in the station using a web interface.  I really do not like using Apple HomeKit and Node-Red as a more refined remote solution.

    Ok, I was able to connect to the Flex 6600 Server, but could not figure out how to do anything useful.  Could you or others give me an example of how to set up Node-Red to send a Flex Command and display the result?


    Alan
    WA9WUD

    imageimage
  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited September 2019
    That is awesome!!  Nice job.  

    What I liked about playing with Node-red is that it was easy to make progress and be successful.


    Case in point.

    I added 2 temperature probes to my RPI so that I could see and be alerted if the cooling fans in my remote case failed.  

    But, first, I need to be able to read the LM75s could be imported into the Dashboard.

    The LM75 uses the I2C buss and getting them working is well documented.  http://www.pibits.net/code/raspberry-pi-and-lm75-temperature-sensor-example.php

    But, I needed to be able to just see the temperature.  I had to make sure I2C was working on the RPI and what 'address' they were using.  Again, Google.   There are other Temperature probes like the bmp180, bmp280, bme280 and more (https://www.adafruit.com/product/2652).  

    Then, I found this code, which I could never write on my own to pull the temperature from the probe (I am going to **** this line apart so I understand it later this week).

    sudo i2cget -y 1 0x48 0x00 w |awk '{printf("%0.1f C
    ",(a=((("0x"substr($1,5,2)substr($1,3,1))*0.0625)+0.1) )>128?a-256:a)}'


    That turned into this using the Node-red Exec box (you paste the above in the Exec).  That means you want Node-Red to Execute the command on the RPI which is a Linux operating system.  

    image

    And, then using the Dashboard tools (for others to see how it is done).  This is called a Pallet and you will need to install it https://flows.nodered.org/node/node-red-dashboard.  This is the tool that helps you to be so successful to create a web interface.

    Now, I can monitor the temperature in my case, and even write some more actions to turn fans on and off.  

    image


    Here is my flow in case you want to look at it.  I added the I2C scan stuff.

    [{"id":"e91d7619.a8a808","type":"tab","label":"Temps","disabled":false,"info":""},{"id":"ebd6490b.83a8d8","type":"inject","z":"e91d7619.a8a808","name":"","topic":"","payload":"","payloadType":"date","repeat":"30","crontab":"","once":true,"onceDelay":0.1,"x":147,"y":95,"wires":[["94bd0a6b.717018","962dd4e9.d622d8"]]},{"id":"94bd0a6b.717018","type":"exec","z":"e91d7619.a8a808","command":"sudo i2cget -y 1 0x48 0x00 w |awk '{printf(""%0.1f C\n"",(a=(((""0x""substr($1,5,2)substr($1,3,1))*0.0625)+0.1) )>128?a-256:a)}'","addpay":false,"append":"","useSpawn":"false","timer":"10","oldrc":false,"name":"Temp","x":431,"y":130.5,"wires":[["3f59295f.8041e6","fb9bbee7.2754c"],[],[]]},{"id":"962dd4e9.d622d8","type":"exec","z":"e91d7619.a8a808","command":"sudo i2cget -y 1 0x4a 0x00 w |awk '{printf(""%0.1f C\n"",(a=(((""0x""substr($1,5,2)substr($1,3,1))*0.0625)+0.1) )>128?a-256:a)}'","addpay":false,"append":"","useSpawn":"false","timer":"10","oldrc":false,"name":"Temp","x":435,"y":216,"wires":[["f04cc7b4.eb6988","98197d69.8d7c3"],[],[]]},{"id":"3f59295f.8041e6","type":"ui_text","z":"e91d7619.a8a808","group":"2dbe67ac.f10de8","order":12,"width":0,"height":0,"name":"","label":"Mid Temp","format":"{{msg.payload}}","layout":"row-spread","x":784,"y":221,"wires":[]},{"id":"f04cc7b4.eb6988","type":"ui_text","z":"e91d7619.a8a808","group":"2dbe67ac.f10de8","order":11,"width":0,"height":0,"name":"","label":"Top Temp","format":"{{msg.payload}}","layout":"row-spread","x":753,"y":309,"wires":[]},{"id":"98197d69.8d7c3","type":"ui_chart","z":"e91d7619.a8a808","name":"","group":"cd1c8110.1e37e","order":1,"width":0,"height":0,"label":"Top Temp","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":778,"y":390,"wires":[[]]},{"id":"fb9bbee7.2754c","type":"ui_chart","z":"e91d7619.a8a808","name":"","group":"cd1c8110.1e37e","order":2,"width":0,"height":0,"label":"Mid Temp","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":791,"y":270,"wires":[[]]},{"id":"7de9d007.be84c","type":"i2c in","z":"e91d7619.a8a808","name":"","address":"74","command":"0","count":"1","x":432.07643127441406,"y":544.6805801391602,"wires":[["a76aec42.2ce13"]]},{"id":"c0ed8a1e.519778","type":"i2c scan","z":"e91d7619.a8a808","x":427.07643127441406,"y":443.72571563720703,"wires":[["a76aec42.2ce13"],[]]},{"id":"7222be8f.680f5","type":"inject","z":"e91d7619.a8a808","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":195.07987213134766,"y":439.9722261428833,"wires":[["c0ed8a1e.519778","7de9d007.be84c"]]},{"id":"a76aec42.2ce13","type":"debug","z":"e91d7619.a8a808","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":717.5277862548828,"y":495.94791412353516,"wires":[]},{"id":"2dbe67ac.f10de8","type":"ui_group","z":"","name":"RF Info","tab":"d6ba9a2a.f3f0d8","order":7,"disp":true,"width":"5","collapse":false},{"id":"cd1c8110.1e37e","type":"ui_group","z":"","name":"Temps","tab":"1abf24f5.9cd13b","disp":false,"width":"8","collapse":false},{"id":"d6ba9a2a.f3f0d8","type":"ui_tab","z":"","name":"VA3MW Shack Control","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"1abf24f5.9cd13b","type":"ui_tab","z":"","name":"RPi Control","icon":"dashboard","order":1}]
  • N2WQN2WQ Member
    edited September 2019
    How do you guys monitor the RX/TX state to prevent hot switching? How about some sort of conflict resolution for SO2R or when accessing from multiple clients?
  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited September 2019
    Hi Rudy

    I don't, but then, I am the only user and I don't hot switch.  :)  When I change bands, I stop for 10 seconds and check Antenna settings and RF power settings.  That comes from blowing a few things up at 3 in the morning.  At least any current equipment today has amazing protection built-in, and the Flex radios are no exception.  

    However, since all the status of the radio is available by doing a TCP connection to the radio, you could script it then do some lockouts.

    As for SO2R and multiple clients, I haven't tested that at all personally.  Others are playing with it, so you might want to ask in the main community as they might miss it in this thread.

    FRStack has some of these features http://www.mkcmsoftware.com/Flex/Index.  I think that Carl N4PY's Pegasus may also have some features to help with that. http://www.n4py.com/.  And, both Authors are active on the community here and have been known to make changes to improve the user interaction.  Check out the features on both.

    Both of those programs have some very slick add ons.  

    I also know we have a significant number of stations that have our radios but have their own members who program.  They have done some cool stuff, but they choose not to share it since they don't want to have to support it.  With the right person, you could actually write your own GUI.


    Mike
  • N2WQN2WQ Member
    edited September 2019
    Mike, is there a ham Node Red community? Perhaps I am over-engineering switching, but chances are others are thinking of such issues. Was thinking of using MQTT messages that go into a buffer that will take care of multi-client conflicts...but who knows, there might be easier solutions.
  • AlanAlan Member ✭✭
    edited September 2019
    Mike

    Looks good.

    Check this node out for reading temperature sensors like these;

    https://www.amazon.com/gp/product/B013GB27HS/ref=ox_sc_act_title_4?smid=ADHH624DX2Q66&psc=1

    and

    https://www.amazon.com/DS18B20-Temperature-Waterproof-Electronic-Building/dp/B0753VSGP1/ref=as_li_ss...

    On a Rasberry Pi:

    https://www.youtube.com/watch?v=j7LLVkPpQ78&t=421s

    Using this Node-Red Node:

    https://flows.nodered.org/node/node-red-contrib-sensor-ds18b20

    I found the forums and Flow Library on the Node-Red web site to contain lots of useful information and many "plugin" building blocks for flows.  You can also search for nodes; like I found the DS1820 Temperature Sensor Node.

    For example, here is a flow from the Node-Red library for a configurable switch that toggles and changes color:

    https://flows.nodered.org/flow/7325d06be6c8a415c877a941172dbc86

    The developer incorporated the ability to configure the switch within the function node on the flow.

    I looked for "ham radio" flows in the Node-Red library and found a few.  I would suggest we could start populating the Node-Red library with flows for common Flex User devices....like the KAP500 and the wattmeter flows.

    The Node-Red Flow Library solves my lack of programming knowledge by allowing me to use building blocks containing code written by others.

    Alan


  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited September 2019
    Hi Alan

    I have used those devices on my Arduino for a weather station.  I think those require an A/D converter on the RPI and I forgot how many of those there are on  RPI3.  

    I wanted the I2C ones so that I could have a whole bunch on the 'buss'.  I think with the ones I use I can more than I will ever use as there is 3 binary bits that you can solder on the board.

    Lots of options too.  

    We have been discussing where to host the Node-Red stuff we want to share and should it be on GIT or Node-Red Flows.  I think GIT makes more sense so that you can easily modify and share your own version.  Personally, I think I will use GIT for my stuff.

    Mike

  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited September 2019
    To the best of my knowledge, this is it but I haven't really searched.  I  posted about it once in the Facebook ham radio group that has over 20,000 members  and no one had heard about it.   

    Andreas N6NUis doing the most to the best of my knowledge.  He is using MQTT to share data to muliple stations and offloading the RPI of data.  I only use MQTT to move the Rotator Data.  
  • Joe N3HEEJoe N3HEE Member ✭✭
    edited September 2019
    Milke.  I am querying the radio for Mode, CW Speed, RF Power and such.  I am finding that the mode and speed messages coming from my radio never change.  They are always CW and 30 ?  Can you confirm this on your message debug.  Is this perhaps a bug in Flex messages ?  Thanks -Joe N3HEE

    Also, thanks for your Node Red flows.  I imported them and learned a bunch on how to interact with the radio.  Very powerful and cool !
  • AlanAlan Member ✭✭
    edited September 2019
    Baby Steps:

    Received my Rasberry Pi from Amazon.  Set up VNC Viewer so I could work remotely.  Installed Node-Red.

    Like Mike, I want to monitor the temperatures in my remote cabinet containing the Flex radio.  Bought these devices for temperature monitoring:

    https://www.amazon.com/gp/product/B013GB27HS/ref=ppx_yo_dt_b_asin_title_o06_s00?ie=UTF8&psc=1

    Installed this Palette from Node-Red:

    https://flows.nodered.org/node/node-red-contrib-sensor-ds18b20

    Note to Mike:  You mentioned earlier you thought these sensors needed an A/D converter on the pi and would limit the number one could deploy.  I learned that is not the case.  The sensor does the A/D work.  The devices are digital and each has a unique id so they can all be added to the same GPIO pin allowing a large number of devices to be deployed.

    Here is a screenshot of the node showing the id numbers of the two sensors I hooked up to pin 4 of the GPIO:



    I added this palette to convert the temperature units to degrees Fahrenheit:

    https://flows.nodered.org/node/node-red-contrib-unit-converter

    Here is the flow with the output shown in the "debug" window:



    Next to set up a USB Relay Board.

    I found this palette to control USB Relays using a Rasberry Pi:

    https://flows.nodered.org/node/node-red-contrib-usb-hid-relay

    Had to learn some basic Linux commands to add a text file to a rules folder.  The node has a pulldown menu to select the USB relay:



      Here is the Node-Red Flow:


    Next, I loaded the Flex Radio, VITA49 data reader provided by Dave, WO2X.....thanks Dave!  It worked!  Received some basic data from my radio into Node-Red.  The Flex API remains a mystery for me.

    That's all for now.

    Alan



  • Joe N3HEEJoe N3HEE Member ✭✭
    edited June 11
    I have opened a ticket with Flex support to report a possible bug in the messages sent over TCP 4992.  It is always sending CW speed of 30 and mode of CW.  I am building a Node Red dashboard to display Mode, CW Speed, Frequency, etc.  -Joe N3HEE
  • David Decoons, wo2xDavid Decoons, wo2x Member ✭✭✭
    edited September 2019
    Joe, Send me your flow for the monitoring. I am guessing you built it off my FlexRadio. Flow. I will load it and see if I can replicate the issue you have. I have running around, er hobbling around actually til about 3 p.m. then I have plenty of time and some of my sanity back. 73 Dave wo2x
  • Joe N3HEEJoe N3HEE Member ✭✭
    edited September 2019
    Dave. Im at work right now so I cant send you my flow.  Just attach a debug node to the node that is connected to TCP 4992 on your Flex Radio tab and watch the debug window for speed and mode messages.  You will see they are always CW and 30.  Mark WS7M has also confirmed what I am seeing.
  • David Decoons, wo2xDavid Decoons, wo2x Member ✭✭✭
    edited September 2019
    I will test and let you know. Dave wo2x
  • AlanAlan Member ✭✭
    edited September 2019
    I continue to work on flows for temperature and antenna controls.

    For antenna control, I started with Rotation Control for my 2M and 70CM antennas.  There are switches mounted on each antenna allowing selection for Right-Hand or Left-Hand rotation.   Energizing the switch coil on each antenna switches the antennas from RH to LH rotation.

    I am using this USB Board:

    https://www.amazon.com/gp/product/B07DYNVB38/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

    I added this Palette to Node-Red to control the board:

    https://flows.nodered.org/node/node-red-contrib-usb-hid-relay

    I downloaded this flow from the Node-Red library for a toggle switch that changes state and color when pushed:

    https://flows.nodered.org/flow/7325d06be6c8a415c877a941172dbc86

    The first button will operate relay #1 and will “ARM” the other two polarization /rotation relays.  This will turn on/off 12 VDC to both the 2M and 70M polarization relay circuits.  I want to add a timer on the Flow to remove power from the relays if not in use for ???? amount of time.  That way I will not forget to remove power from the antenna relays when not searching for Satellites.

    The second button will toggle between Right-Hand and Left-Hand Rotation for both the 2M and 70cm antennas.  The single  "Polorizaion" button operates relay #2 and #3, one USB relay for each antenna polarization switch.

    Help — I want to add an interlock to not allow switching polarization if the Flex is in TX.  Can anyone help me get started with the front end part to import the Flex TX status into Node-Red?  I think N2WQ had the same kind of request..

    Here is a screen shot of the flow:


    Here is a screen shot of the Dashboard.  Pressing "ARM" toggles relay #1 on/off and will be in series with Relay #2 and #3 on the 12 VDC power.  Toggling the bottom button toggles relays #2 and @3 to change antenna polarization from RH to LH.  The buttons change color and text with each push/state change:


    In addition, the Dashboard looks great on my iPhone.  I used the App Maker in Safari to add an icon to my iPhone home screen.

    I will end here with a copy of the flow to follow.  I do not have knowledge of how or where to post flows for community use   (help).  Also, could not find how to just upload the text as a file.

    Alan

    ======================

    [{"id":"8c67269f.065cd8","type":"tab","label":"USB Relay","disabled":false,"info":""},{"id":"2ce6934e.fc6844","type":"usb relay","z":"8c67269f.065cd8","name":"Arm Polorizaton","usbrelayport":"6QMBS_0","x":653,"y":547.9999847412109,"wires":[]},{"id":"f2b0ab73.90ac5","type":"function","z":"8c67269f.065cd8","name":"Push Button","func":"var state = context.get(\"STATE\")||0;\n\n//  Look for a !X message to get values.\nif (msg.payload != \"X\")     //Do this if the message is NOT \"X\"\n{\n    //\n    //  Background colours first.\n    //\n    context.set(\"ABGC\", msg.colourA);\n    context.set(\"BBGC\", msg.colourB);\n    //\n    //  Now do text.\n    //\n    context.set(\"Atxt\", msg.txtA);\n    context.set(\"Btxt\", msg.txtB);\n    //\n    //  Font colours.\n    //\n    context.set(\"AFC\",msg.txtclrA);\n    context.set(\"BFC\",msg.txtclrB);\n    //\n    //  Payloads.\n    //\n    context.set(\"PayloadA\", msg.payloadA);\n    context.set(\"PayloadB\", msg.payloadB);\n    //\n    //  Topic.\n    //\n    if (msg.topicSET !== null)\n    {\n        context.set(\"Topic\",msg.topicSET);\n    } else\n    {\n        context.set(\"Topic\",\"~\");\n    }\n    return;\n}\n//      Now on to the real stuff.\nif (msg.payload == \"X\")\n{\n    state = (state + 1)% 2;\n    //node.warn(state);\n    context.set(\"STATE\",state);\n}\nif (state === 0)\n{\n    //  Condition A\n    msg.payload = context.get(\"PayloadA\");\n    msg.colour = context.get(\"ABGC\");\n    msg.txt = context.get(\"Atxt\");\n    msg.fontclr = context.get(\"AFC\");\n} else\n{\n    //  Condition B\n    msg.payload = context.get(\"PayloadB\");\n    msg.colour = context.get(\"BBGC\");\n    msg.txt = context.get(\"Btxt\");\n    msg.fontclr = context.get(\"BFC\");\n}\nif (context.get(\"Topic\") == \"~\")\n{\n    msg.topic = \"\";\n} else\n{\n    msg.topic = context.get(\"Topic\");\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":375.1358642578125,"y":236,"wires":[["66c30b92.25b98c","2ce6934e.fc6844"]]},{"id":"66c30b92.25b98c","type":"ui_button","z":"8c67269f.065cd8","name":"Polorization - Arm","group":"2f18cfd.a50b3b","order":1,"width":4,"height":2,"passthru":false,"label":"{{msg.txt}}","tooltip":"","color":"{{msg.fontclr}}","bgcolor":"{{msg.colour}}","icon":"","payload":"X","payloadType":"str","topic":"","x":163.1358642578125,"y":396,"wires":[["f2b0ab73.90ac5"]]},{"id":"e2f42dd6.93f158","type":"inject","z":"8c67269f.065cd8","name":"Setup","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"3","x":147.1358642578125,"y":155,"wires":[["74479b57.227e84"]]},{"id":"dae9a2e1.bda8d","type":"comment","z":"8c67269f.065cd8","name":"Push Button Flow","info":"This has two states:\nA and B.\nAll future refrence is to these two state names.\n\nREQUIRED:\nInputs:\nButton background colour for state A.  msg.colurA\nButton background colour for state B.  msg.colourB\nButton text for state A.               msg.txtA\nButton text for state B.               msg.txtB\nFont colour for state A.               msg.txtclrA\nFont colour for state B.               msg.txtclrB\nPayload for state A.                   msg.payloadA\nPayload for state B.                   msg.payloadB\nTopic.                                 msg.topicSET\n\nOutputs:\nmsg.payload - this is used to control what ever you need.\nmsg.topic - this is if it is needed for control of the next node.\nmsg.colour - this sets the colour of the button.\nmsg.txt - this is the text to be displayed in the button.\nmsg.fontclr - this is the colour of the text on the button.\n","x":151.1358642578125,"y":72,"wires":[]},{"id":"74479b57.227e84","type":"function","z":"8c67269f.065cd8","name":"Setup","func":"msg = {\n    \"colourA\": \"green\",\n    \"colourB\": \"red\",\n    \"txtA\": \"Arm - On\",\n    \"txtB\": \"Arm - Off\",\n    \"txtclrA\": \"black\",\n    \"txtclrB\": \"white\",\n    \"payloadA\": true,\n    \"payloadB\": false,\n    \"topicSET\": \"2M Antenna\"\n}\nreturn msg;","outputs":1,"noerr":0,"x":133.1358642578125,"y":268,"wires":[["f2b0ab73.90ac5"]]},{"id":"8886d75f.f2a1e8","type":"usb relay","z":"8c67269f.065cd8","name":"2M Polorization","usbrelayport":"6QMBS_1","x":643.8641357421875,"y":673.521728515625,"wires":[]},{"id":"efb95a37.c7a548","type":"function","z":"8c67269f.065cd8","name":"Push Button","func":"var state = context.get(\"STATE\")||0;\n\n//  Look for a !X message to get values.\nif (msg.payload != \"X\")     //Do this if the message is NOT \"X\"\n{\n    //\n    //  Background colours first.\n    //\n    context.set(\"ABGC\", msg.colourA);\n    context.set(\"BBGC\", msg.colourB);\n    //\n    //  Now do text.\n    //\n    context.set(\"Atxt\", msg.txtA);\n    context.set(\"Btxt\", msg.txtB);\n    //\n    //  Font colours.\n    //\n    context.set(\"AFC\",msg.txtclrA);\n    context.set(\"BFC\",msg.txtclrB);\n    //\n    //  Payloads.\n    //\n    context.set(\"PayloadA\", msg.payloadA);\n    context.set(\"PayloadB\", msg.payloadB);\n    //\n    //  Topic.\n    //\n    if (msg.topicSET !== null)\n    {\n        context.set(\"Topic\",msg.topicSET);\n    } else\n    {\n        context.set(\"Topic\",\"~\");\n    }\n    return;\n}\n//      Now on to the real stuff.\nif (msg.payload == \"X\")\n{\n    state = (state + 1)% 2;\n    //node.warn(state);\n    context.set(\"STATE\",state);\n}\nif (state === 0)\n{\n    //  Condition A\n    msg.payload = context.get(\"PayloadA\");\n    msg.colour = context.get(\"ABGC\");\n    msg.txt = context.get(\"Atxt\");\n    msg.fontclr = context.get(\"AFC\");\n} else\n{\n    //  Condition B\n    msg.payload = context.get(\"PayloadB\");\n    msg.colour = context.get(\"BBGC\");\n    msg.txt = context.get(\"Btxt\");\n    msg.fontclr = context.get(\"BFC\");\n}\nif (context.get(\"Topic\") == \"~\")\n{\n    msg.topic = \"\";\n} else\n{\n    msg.topic = context.get(\"Topic\");\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":368,"y":675.521728515625,"wires":[["d6a3f958.db0808","8886d75f.f2a1e8","985d51a2.8d4558"]]},{"id":"d6a3f958.db0808","type":"ui_button","z":"8c67269f.065cd8","name":"Polorization - RH/LH","group":"2f18cfd.a50b3b","order":2,"width":4,"height":2,"passthru":false,"label":"{{msg.txt}}","tooltip":"","color":"{{msg.fontclr}}","bgcolor":"{{msg.colour}}","icon":"","payload":"X","payloadType":"str","topic":"","x":166,"y":835.521728515625,"wires":[["efb95a37.c7a548"]]},{"id":"4668eb4.745c994","type":"inject","z":"8c67269f.065cd8","name":"Setup","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"3","x":140,"y":594.521728515625,"wires":[["ee83b4b0.2c5ae"]]},{"id":"8966c6c4.69e42","type":"comment","z":"8c67269f.065cd8","name":"Push Button Flow","info":"This has two states:\nA and B.\nAll future refrence is to these two state names.\n\nREQUIRED:\nInputs:\nButton background colour for state A.  msg.colurA\nButton background colour for state B.  msg.colourB\nButton text for state A.               msg.txtA\nButton text for state B.               msg.txtB\nFont colour for state A.               msg.txtclrA\nFont colour for state B.               msg.txtclrB\nPayload for state A.                   msg.payloadA\nPayload for state B.                   msg.payloadB\nTopic.                                 msg.topicSET\n\nOutputs:\nmsg.payload - this is used to control what ever you need.\nmsg.topic - this is if it is needed for control of the next node.\nmsg.colour - this sets the colour of the button.\nmsg.txt - this is the text to be displayed in the button.\nmsg.fontclr - this is the colour of the text on the button.\n","x":144,"y":511.521728515625,"wires":[]},{"id":"ee83b4b0.2c5ae","type":"function","z":"8c67269f.065cd8","name":"Setup","func":"msg = {\n    \"colourA\": \"yellow\",\n    \"colourB\": \"blue\",\n    \"txtA\": \"Right\",\n    \"txtB\": \"Left\",\n    \"txtclrA\": \"black\",\n    \"txtclrB\": \"white\",\n    \"payloadA\": true,\n    \"payloadB\": false,\n    \"topicSET\": \"2M Antenna\"\n}\nreturn msg;","outputs":1,"noerr":0,"x":126,"y":707.521728515625,"wires":[["efb95a37.c7a548"]]},{"id":"985d51a2.8d4558","type":"usb relay","z":"8c67269f.065cd8","name":"70 CM Polorization","usbrelayport":"6QMBS_2","x":638.2608642578125,"y":774.6658020019531,"wires":[]},{"id":"2f18cfd.a50b3b","type":"ui_group","z":"","name":"Polorization","tab":"e2c15bb.f2346a8","order":2,"disp":true,"width":"6","collapse":false},{"id":"e2c15bb.f2346a8","type":"ui_tab","z":"","name":"Antenna","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

  • AlanAlan Member ✭✭
    edited September 2019
    Here is a photo of the hardware setup on the bench:

    image
  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited September 2019
    If you are getting started, here is a simple one to play with.

    This is the exact code I use for my Host monitor.  It display the Text of the ping times on one page and then the graphs of the ping times on another page.

    If you haven't already, you will need to install the Dashboard via the Pallet manager.

    In the screen shot of my graphs, I have 2 LM75 temperature probes that I use to keep an eye on the case the equipment is mounted in.  Yes, it was 30C at one point today as that was the air temp.




    Here is the flow:

    [{"id":"5654447b.7f9c7c","type":"tab","label":"Host Monitor","disabled":false,"info":""},{"id":"a523322d.dc65f","type":"ping","z":"5654447b.7f9c7c","name":"Internet","host":"8.8.8.8","timer":"20","x":150,"y":80,"wires":[["e39702ca.10652"]]},{"id":"2b6202ce.baa2ee","type":"ui_text","z":"5654447b.7f9c7c","group":"e6fc9a45.855d38","order":1,"width":0,"height":0,"name":"","label":"Internet","format":"{{msg.payload}}","layout":"row-spread","x":440,"y":60,"wires":[]},{"id":"e8bcd2b4.96b05","type":"ping","z":"5654447b.7f9c7c","name":"Flex 6600","host":"192.168.110.76","timer":"60","x":160.01737213134766,"y":181.01043510437012,"wires":[["d8270cab.e7c12"]]},{"id":"9bc2bc52.53a97","type":"ui_text","z":"5654447b.7f9c7c","group":"e6fc9a45.855d38","order":3,"width":0,"height":0,"name":"","label":"Flex 6600","format":"{{msg.payload}}","layout":"row-spread","x":440,"y":180,"wires":[]},{"id":"db65259d.670028","type":"ping","z":"5654447b.7f9c7c","name":"Flex 6500","host":"192.168.110.78","timer":"60","x":160,"y":240,"wires":[["fdc1a230.3cba7"]]},{"id":"5d3c901e.875a4","type":"ui_text","z":"5654447b.7f9c7c","group":"e6fc9a45.855d38","order":4,"width":0,"height":0,"name":"","label":"Flex 6500","format":"{{msg.payload}}","layout":"row-spread","x":440,"y":240,"wires":[]},{"id":"bad8987e.b97948","type":"ping","z":"5654447b.7f9c7c","name":"PC","host":"192.168.110.14","timer":"60","x":150,"y":300,"wires":[["e14c8a43.0c07b8"]]},{"id":"7ca6fcf8.7422f4","type":"ui_text","z":"5654447b.7f9c7c","group":"e6fc9a45.855d38","order":5,"width":0,"height":0,"name":"PC","label":"PC","format":"{{msg.payload}}","layout":"row-spread","x":430,"y":300,"wires":[]},{"id":"c055a2df.64611","type":"ping","z":"5654447b.7f9c7c","name":"Web Switch 1","host":"192.168.110.12","timer":"60","x":170,"y":360,"wires":[["db11f626.50de08"]]},{"id":"98b718ef.2e52a8","type":"ui_text","z":"5654447b.7f9c7c","group":"e6fc9a45.855d38","order":6,"width":0,"height":0,"name":"Web Switch 1","label":"Web Switch 1","format":"{{msg.payload}}","layout":"row-spread","x":480,"y":360,"wires":[]},{"id":"c1d8d83c.447be8","type":"ping","z":"5654447b.7f9c7c","name":"Web Switch 2","host":"192.168.110.13","timer":"60","x":170,"y":420,"wires":[["f1e53a07.86c568"]]},{"id":"a97e6083.bac93","type":"ui_text","z":"5654447b.7f9c7c","group":"e6fc9a45.855d38","order":7,"width":0,"height":0,"name":"Web Switch 2","label":"Web Switch 2","format":"{{msg.payload}}","layout":"row-spread","x":480,"y":420,"wires":[]},{"id":"99e37eca.e1dd1","type":"ping","z":"5654447b.7f9c7c","name":"RPI - Modem","host":"192.168.110.4","timer":"60","x":170,"y":480,"wires":[["7a2d4aa2.38fa34"]]},{"id":"7f5b8818.83b3a8","type":"ui_text","z":"5654447b.7f9c7c","group":"e6fc9a45.855d38","order":8,"width":0,"height":0,"name":"RPI - Modem","label":"RPI - Modem","format":"{{msg.payload}}","layout":"row-spread","x":490,"y":480,"wires":[]},{"id":"8c2b92bd.e0946","type":"ping","z":"5654447b.7f9c7c","name":"Antenna Switch","host":"192.168.110.153","timer":"60","x":180,"y":540,"wires":[["eb5ca7bd.f21808"]]},{"id":"f0d85da3.77cee","type":"ui_text","z":"5654447b.7f9c7c","group":"e6fc9a45.855d38","order":9,"width":0,"height":0,"name":"Antenna Switch","label":"Antenna Switch","format":"{{msg.payload}}","layout":"row-spread","x":500,"y":540,"wires":[]},{"id":"e39702ca.10652","type":"smooth","z":"5654447b.7f9c7c","name":"","property":"payload","action":"mean","count":"1","round":"1","mult":"single","x":280,"y":80,"wires":[["65d41e6e.9ed02","2b6202ce.baa2ee"]]},{"id":"d8270cab.e7c12","type":"smooth","z":"5654447b.7f9c7c","name":"","property":"payload","action":"mean","count":"2","round":"1","mult":"single","x":300,"y":180,"wires":[["9bc2bc52.53a97"]]},{"id":"fdc1a230.3cba7","type":"smooth","z":"5654447b.7f9c7c","name":"","property":"payload","action":"mean","count":"2","round":"1","mult":"single","x":300,"y":240,"wires":[["5d3c901e.875a4"]]},{"id":"e14c8a43.0c07b8","type":"smooth","z":"5654447b.7f9c7c","name":"","property":"payload","action":"mean","count":"1","round":"2","mult":"single","x":300,"y":300,"wires":[["7ca6fcf8.7422f4"]]},{"id":"db11f626.50de08","type":"smooth","z":"5654447b.7f9c7c","name":"","property":"payload","action":"mean","count":"1","round":"2","mult":"single","x":320,"y":360,"wires":[["98b718ef.2e52a8"]]},{"id":"f1e53a07.86c568","type":"smooth","z":"5654447b.7f9c7c","name":"","property":"payload","action":"mean","count":"2","round":"1","mult":"single","x":320,"y":420,"wires":[["a97e6083.bac93"]]},{"id":"7a2d4aa2.38fa34","type":"smooth","z":"5654447b.7f9c7c","name":"","property":"payload","action":"mean","count":"2","round":"1","mult":"single","x":320,"y":480,"wires":[["7f5b8818.83b3a8"]]},{"id":"eb5ca7bd.f21808","type":"smooth","z":"5654447b.7f9c7c","name":"","property":"payload","action":"mean","count":"1","round":"2","mult":"single","x":340,"y":540,"wires":[["f0d85da3.77cee"]]},{"id":"a6aa9aff.9383e8","type":"ping","z":"5654447b.7f9c7c","name":"VPN","host":"192.168.113.1","timer":"20","x":150,"y":620,"wires":[["28fff299.f60f9e"]]},{"id":"c2dadda0.6ce2d","type":"ui_text","z":"5654447b.7f9c7c","group":"e6fc9a45.855d38","order":2,"width":0,"height":0,"name":"","label":"VPN","format":"{{msg.payload}}","layout":"row-spread","x":470,"y":600,"wires":[]},{"id":"28fff299.f60f9e","type":"smooth","z":"5654447b.7f9c7c","name":"","property":"payload","action":"mean","count":"1","round":"1","mult":"single","x":320,"y":620,"wires":[["c2dadda0.6ce2d","89a97caa.6ac69"]]},{"id":"65d41e6e.9ed02","type":"ui_chart","z":"5654447b.7f9c7c","name":"","group":"e969582f.047798","order":0,"width":0,"height":0,"label":"Internet","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":440,"y":120,"wires":[[]]},{"id":"89a97caa.6ac69","type":"ui_chart","z":"5654447b.7f9c7c","name":"","group":"e969582f.047798","order":0,"width":0,"height":0,"label":"VPN","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":470,"y":660,"wires":[[]]},{"id":"e6fc9a45.855d38","type":"ui_group","z":"","name":"Hosts (ms)","tab":"1abf24f5.9cd13b","disp":true,"width":"5","collapse":false},{"id":"e969582f.047798","type":"ui_group","z":"","name":"Hosts","tab":"53920b4.5b13bf4","disp":true,"width":"6","collapse":false},{"id":"1abf24f5.9cd13b","type":"ui_tab","z":"","name":"RPi Control","icon":"dashboard","order":2},{"id":"53920b4.5b13bf4","type":"ui_tab","z":"","name":"Graphs","icon":"dashboard","order":3,"disabled":false,"hidden":false}]



  • AlanAlan Member ✭✭
    edited September 2019
    Mike - Thanks.

    I like your WAN performance graphs.  

    Tried to install your flows, but my Node-Red would not allow.  Perhaps because I do not have the correct Palettes installed.

    Could you give me the name of the required Palletts to run your flow?

    Alan
  • Mike-VA3MWMike-VA3MW FlexRadio Employee, Community Manager admin
    edited September 2019
    I have a bunch installed, but the dashboard is the only one on those flows.  

    Did you get an error message that might help.

    This is what it looks like:

    image
  • AlanAlan Member ✭✭
    edited September 2019
    Update

    Regarding inputting the RX status into Node-Red.

    For now, solved this by using a HIT USB cable from the Flex Radio to a GPIO pin on the Rasberry Pi.  Sort of a "hardware" solution.  On the Flex side, configured the pin to be high if between 100MHZ to 500MHZ and PTT enabled.   Could have also used one of the ACC outputs as an input to a Rasberry PI GPIO pin.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.