Skip to content

Instantly share code, notes, and snippets.

@tomvdb
Last active June 25, 2022 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomvdb/72b78eee2b39e0e69bca150ecf928123 to your computer and use it in GitHub Desktop.
Save tomvdb/72b78eee2b39e0e69bca150ecf928123 to your computer and use it in GitHub Desktop.
Basic satellite station controller. Basic rotctld server implemented as well as communication to rotator arduinos
[
{
"id": "800528f16bfd8a64",
"type": "tab",
"label": "Az/El Rotator Control",
"disabled": false,
"info": "",
"env": []
},
{
"id": "4ead5f54128c8ab2",
"type": "serial out",
"z": "800528f16bfd8a64",
"name": "",
"serial": "3e70fa9940e51b28",
"x": 670,
"y": 140,
"wires": []
},
{
"id": "92c90d4ed125cc44",
"type": "serial in",
"z": "800528f16bfd8a64",
"name": "",
"serial": "3e70fa9940e51b28",
"x": 190,
"y": 500,
"wires": [
[
"3dbea99f0be32883"
]
]
},
{
"id": "3dbea99f0be32883",
"type": "function",
"z": "800528f16bfd8a64",
"name": "Get Azimuth",
"func": "if (msg.payload.startsWith(\"A,\"))\n{\n msg.payload = msg.payload.trim();\n msg.payload = msg.payload.substring(2);\n \n var d = new Date();\n \n var timestamp = { payload: d.getHours().toString().padStart(2, '0') + \":\" + d.getMinutes().toString().padStart(2, '0') + \":\" + d.getSeconds().toString().padStart(2, '0') } \n \n return [msg, timestamp]\n}\n \nreturn [null,null]",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 350,
"y": 500,
"wires": [
[
"3a7281928fa12cb1",
"13698d3c56537b41"
],
[
"abd0b552b5a43c0d"
]
]
},
{
"id": "3a7281928fa12cb1",
"type": "ui_gauge",
"z": "800528f16bfd8a64",
"name": "",
"group": "c8727dcfabf6aa89",
"order": 1,
"width": 0,
"height": 0,
"gtype": "compass",
"title": "Azimuth",
"label": "Degrees",
"format": "{{value}}",
"min": 0,
"max": "360",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "360",
"seg2": "",
"className": "",
"x": 520,
"y": 500,
"wires": []
},
{
"id": "53b1ef447f18e6bb",
"type": "function",
"z": "800528f16bfd8a64",
"name": "Set Azimuth",
"func": "msg.payload = msg.payload + \"\\n\"\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 120,
"wires": [
[
"4ead5f54128c8ab2",
"acac95eebd8cec47"
]
]
},
{
"id": "127c99864249ae98",
"type": "tcp in",
"z": "800528f16bfd8a64",
"name": "",
"server": "server",
"host": "",
"port": "4533",
"datamode": "stream",
"datatype": "utf8",
"newline": "\\n",
"topic": "t",
"base64": false,
"tls": "",
"x": 100,
"y": 240,
"wires": [
[
"30d478b17629690d"
]
]
},
{
"id": "30d478b17629690d",
"type": "function",
"z": "800528f16bfd8a64",
"name": "",
"func": "if ( msg.payload.startsWith(\"p\") )\n{\n var az = flow.get(\"az\")\n var el = flow.get(\"el\")\n msg.payload = az + \"\\n\" + el + \"\\n\";\n return [msg, null, null];\n}\n\nif ( msg.payload.startsWith(\"P\") )\n{\n var data = msg.payload.split(\" \");\n var allowed = flow.get(\"enabletcp\")\n\n var newAzimuth = { payload: data[1] }\n var newElevation = { payload: data[2] }\n \n msg.payload = \"RPRT 0\\n\";\n //return msg;\n \n\n if (allowed)\n {\n return [msg, newAzimuth, newElevation];\n }\n else\n {\n return [msg, null, null]\n }\n}\n\nif ( msg.payload.startsWith(\"S\") )\n{\n msg.payload = \"RPRT 0\\n\";\n return [msg, null, null];\n}\n\n\nmsg.payload = \"RPRT 0\\n\";\nreturn [msg, null, null];\n",
"outputs": 3,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 280,
"y": 240,
"wires": [
[
"47ff8f4f9d146436"
],
[
"53b1ef447f18e6bb"
],
[
"32dce04be4f5a377"
]
]
},
{
"id": "47ff8f4f9d146436",
"type": "tcp out",
"z": "800528f16bfd8a64",
"name": "",
"host": "",
"port": "4533",
"beserver": "reply",
"base64": false,
"end": false,
"tls": "",
"x": 460,
"y": 200,
"wires": []
},
{
"id": "13698d3c56537b41",
"type": "function",
"z": "800528f16bfd8a64",
"name": "Store Azimuth",
"func": "flow.set(\"az\", msg.payload)\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 540,
"y": 460,
"wires": [
[]
]
},
{
"id": "46d7d08edfed2d61",
"type": "status",
"z": "800528f16bfd8a64",
"name": "",
"scope": [
"127c99864249ae98"
],
"x": 980,
"y": 600,
"wires": [
[
"3a02a16d5f44dd79"
]
]
},
{
"id": "3a02a16d5f44dd79",
"type": "ui_toast",
"z": "800528f16bfd8a64",
"position": "top right",
"displayTime": "50",
"highlight": "",
"sendall": true,
"outputs": 0,
"ok": "OK",
"cancel": "",
"raw": false,
"className": "",
"topic": "Hello world!",
"name": "",
"x": 1190,
"y": 600,
"wires": []
},
{
"id": "32dce04be4f5a377",
"type": "function",
"z": "800528f16bfd8a64",
"name": "Set Elevation",
"func": "msg.payload = msg.payload + \"\\n\"\nreturn msg;\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 300,
"wires": [
[
"89441c69f039f014",
"6658069df99670d9"
]
]
},
{
"id": "fce9b596d1a94c43",
"type": "serial in",
"z": "800528f16bfd8a64",
"name": "",
"serial": "e75ac408205351b2",
"x": 190,
"y": 660,
"wires": [
[
"c59a3f19ec312e6b"
]
]
},
{
"id": "c59a3f19ec312e6b",
"type": "function",
"z": "800528f16bfd8a64",
"name": "Get Elevation",
"func": "if (msg.payload.startsWith(\"E,\"))\n{\n msg.payload = msg.payload.trim();\n msg.payload = msg.payload.substring(2);\n \n var d = new Date();\n \n var timestamp = { payload: d.getHours().toString().padStart(2, '0') + \":\" + d.getMinutes().toString().padStart(2, '0') + \":\" + d.getSeconds().toString().padStart(2, '0') } \n \n return [msg, timestamp]\n}\n \nreturn [null,null]",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 360,
"y": 660,
"wires": [
[
"00c8b4977759f774",
"8f388e8c322a19c2"
],
[
"c672e07d3ce44081"
]
]
},
{
"id": "00c8b4977759f774",
"type": "ui_gauge",
"z": "800528f16bfd8a64",
"name": "",
"group": "c8727dcfabf6aa89",
"order": 2,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Elevation",
"label": "Degrees",
"format": "{{value}}",
"min": 0,
"max": "180",
"colors": [
"#0094ce",
"#0094ce",
"#0094ce"
],
"seg1": "180",
"seg2": "",
"className": "",
"x": 540,
"y": 660,
"wires": []
},
{
"id": "8f388e8c322a19c2",
"type": "function",
"z": "800528f16bfd8a64",
"name": "Store Elevation",
"func": "flow.set(\"el\", msg.payload)\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 560,
"y": 620,
"wires": [
[]
]
},
{
"id": "89441c69f039f014",
"type": "serial out",
"z": "800528f16bfd8a64",
"name": "",
"serial": "e75ac408205351b2",
"x": 670,
"y": 320,
"wires": []
},
{
"id": "abd0b552b5a43c0d",
"type": "ui_text",
"z": "800528f16bfd8a64",
"group": "c8727dcfabf6aa89",
"order": 3,
"width": 0,
"height": 0,
"name": "",
"label": "Asimuth Update",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 540,
"y": 540,
"wires": []
},
{
"id": "c672e07d3ce44081",
"type": "ui_text",
"z": "800528f16bfd8a64",
"group": "c8727dcfabf6aa89",
"order": 4,
"width": 0,
"height": 0,
"name": "",
"label": "Elevation Update",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 570,
"y": 700,
"wires": []
},
{
"id": "345ed803b8d9d808",
"type": "ui_switch",
"z": "800528f16bfd8a64",
"name": "",
"label": "Disable TCP Control",
"tooltip": "",
"group": "21cbecce15e5120c",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "topic",
"topicType": "msg",
"style": "",
"onvalue": "false",
"onvalueType": "bool",
"onicon": "",
"oncolor": "",
"offvalue": "true",
"offvalueType": "bool",
"officon": "",
"offcolor": "",
"animate": false,
"className": "",
"x": 1020,
"y": 180,
"wires": [
[
"7e5e34a276be5140"
]
]
},
{
"id": "7e5e34a276be5140",
"type": "function",
"z": "800528f16bfd8a64",
"name": "EnableTCPFlag",
"func": "flow.set(\"enabletcp\", msg.payload) \n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1240,
"y": 180,
"wires": [
[]
]
},
{
"id": "20bbb53ef3dbb251",
"type": "function",
"z": "800528f16bfd8a64",
"name": "",
"func": "flow.set(\"sliderel\", msg.payload) \n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1160,
"y": 240,
"wires": [
[]
]
},
{
"id": "dccf220abf895a74",
"type": "function",
"z": "800528f16bfd8a64",
"name": "",
"func": "flow.set(\"slideraz\", msg.payload) \n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1160,
"y": 300,
"wires": [
[]
]
},
{
"id": "a40f26924ae11d5d",
"type": "ui_button",
"z": "800528f16bfd8a64",
"name": "",
"group": "21cbecce15e5120c",
"order": 3,
"width": 0,
"height": 0,
"passthru": false,
"label": "Go To Az/El",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 110,
"y": 180,
"wires": [
[
"6a88ca7e3d5cc7bf"
]
]
},
{
"id": "6a88ca7e3d5cc7bf",
"type": "function",
"z": "800528f16bfd8a64",
"name": "",
"func": "var newAzimuth = { payload: flow.get('slideraz') }\nvar newElevation = { payload: flow.get('sliderel') }\n\nreturn [newAzimuth, newElevation]",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 280,
"y": 180,
"wires": [
[
"53b1ef447f18e6bb"
],
[
"32dce04be4f5a377"
]
]
},
{
"id": "d2149e2be3b649be",
"type": "ui_numeric",
"z": "800528f16bfd8a64",
"name": "",
"label": "Azimuth",
"tooltip": "",
"group": "21cbecce15e5120c",
"order": 1,
"width": 0,
"height": 0,
"wrap": true,
"passthru": true,
"topic": "topic",
"topicType": "msg",
"format": "{{value}}",
"min": 0,
"max": "360",
"step": "2",
"className": "",
"x": 980,
"y": 300,
"wires": [
[
"dccf220abf895a74"
]
]
},
{
"id": "e9facc2c826ba3ae",
"type": "ui_numeric",
"z": "800528f16bfd8a64",
"name": "",
"label": "Elevation",
"tooltip": "",
"group": "21cbecce15e5120c",
"order": 2,
"width": 0,
"height": 0,
"wrap": true,
"passthru": true,
"topic": "topic",
"topicType": "msg",
"format": "{{value}}",
"min": 0,
"max": "180",
"step": "2",
"className": "",
"x": 980,
"y": 240,
"wires": [
[
"20bbb53ef3dbb251"
]
]
},
{
"id": "209333fb77b25d95",
"type": "simpletime",
"z": "800528f16bfd8a64",
"name": "",
"mydate": true,
"myymd": true,
"myyear": true,
"mymonth": true,
"mymonthn": true,
"mydom": true,
"mydoy": true,
"myday": true,
"myhourpm": true,
"myhour": true,
"mytime": true,
"mytimes": true,
"myminute": true,
"myminutes": true,
"mysecond": true,
"mymillis": true,
"myepoch": true,
"myrawdate": true,
"mypm": true,
"x": 1190,
"y": 380,
"wires": [
[
"6cfe0c29eb64cf44"
]
]
},
{
"id": "6cfe0c29eb64cf44",
"type": "ui_text",
"z": "800528f16bfd8a64",
"group": "f407d2f7c7011868",
"order": 1,
"width": 0,
"height": 0,
"name": "",
"label": "Time (UTC)",
"format": "{{msg.mytimes}}",
"layout": "row-spread",
"className": "",
"x": 1390,
"y": 380,
"wires": []
},
{
"id": "f7b58050541ea039",
"type": "sun-position",
"z": "800528f16bfd8a64",
"name": "",
"positionConfig": "e468d94a8e0f53e2",
"rules": [],
"onlyOnChange": "true",
"topic": "",
"outputs": 1,
"start": "",
"startType": "none",
"startOffset": 0,
"startOffsetType": "none",
"startOffsetMultiplier": 60000,
"end": "",
"endType": "none",
"endOffset": 0,
"endOffsetType": "none",
"endOffsetMultiplier": 60000,
"x": 1190,
"y": 440,
"wires": [
[
"99786cdddfd944c4"
]
]
},
{
"id": "de5c26aaa566b557",
"type": "inject",
"z": "800528f16bfd8a64",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "1",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1010,
"y": 440,
"wires": [
[
"f7b58050541ea039",
"209333fb77b25d95",
"eb718efe8de21997"
]
]
},
{
"id": "99786cdddfd944c4",
"type": "function",
"z": "800528f16bfd8a64",
"name": "",
"func": "flow.set(\"sunaz\", msg.payload.azimuthDegrees) \nflow.set(\"sunel\", msg.payload.altitudeDegrees) \n\n//node.warn( \"Sun Az: \" + msg.payload.azimuthDegrees);\n//node.warn( \"Sun El: \" + msg.payload.altitudeDegrees);\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1380,
"y": 440,
"wires": [
[]
]
},
{
"id": "ce66e5dc415a23cb",
"type": "ui_button",
"z": "800528f16bfd8a64",
"name": "",
"group": "58b3bed8821066d9",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"label": "Go to Sun",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 100,
"y": 120,
"wires": [
[
"34cafbae99504b7f"
]
]
},
{
"id": "34cafbae99504b7f",
"type": "function",
"z": "800528f16bfd8a64",
"name": "",
"func": "var newAzimuth = { payload: flow.get('sunaz') }\nvar newElevation = { payload: flow.get('sunel') }\n\nreturn [newAzimuth, newElevation]",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 280,
"y": 120,
"wires": [
[
"53b1ef447f18e6bb"
],
[
"32dce04be4f5a377"
]
]
},
{
"id": "d06fe43fb7808d32",
"type": "ui_worldmap",
"z": "800528f16bfd8a64",
"group": "f407d2f7c7011868",
"order": 1,
"width": 0,
"height": 0,
"name": "",
"lat": "-26.709",
"lon": "27.834",
"zoom": "2",
"layer": "OSMG",
"cluster": "",
"maxage": "",
"usermenu": "hide",
"layers": "hide",
"panit": "false",
"panlock": "false",
"zoomlock": "false",
"hiderightclick": "true",
"coords": "gth",
"showgrid": "false",
"allowFileDrop": "false",
"path": "/worldmap",
"overlist": "DR,CO,RA,DN,HM",
"maplist": "OSMG,OSMC,EsriC,EsriS,EsriT,EsriDG,UKOS,SW",
"mapname": "",
"mapurl": "",
"mapopt": "",
"mapwms": false,
"x": 1360,
"y": 500,
"wires": []
},
{
"id": "325462fe44c9858d",
"type": "ui_button",
"z": "800528f16bfd8a64",
"name": "",
"group": "58b3bed8821066d9",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"label": "Sasolburg",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 100,
"y": 60,
"wires": [
[
"e645b6c9c5fc7283"
]
]
},
{
"id": "e645b6c9c5fc7283",
"type": "function",
"z": "800528f16bfd8a64",
"name": "",
"func": "var newAzimuth = { payload: 180 }\nvar newElevation = { payload: 0 }\n\nreturn [newAzimuth, newElevation]",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 280,
"y": 60,
"wires": [
[
"53b1ef447f18e6bb"
],
[
"32dce04be4f5a377"
]
]
},
{
"id": "acac95eebd8cec47",
"type": "ui_text",
"z": "800528f16bfd8a64",
"group": "0a824e569d14d3f5",
"order": 2,
"width": 0,
"height": 0,
"name": "",
"label": "Az Request",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 670,
"y": 100,
"wires": []
},
{
"id": "6658069df99670d9",
"type": "ui_text",
"z": "800528f16bfd8a64",
"group": "0a824e569d14d3f5",
"order": 3,
"width": 0,
"height": 0,
"name": "",
"label": "El Request",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 670,
"y": 280,
"wires": []
},
{
"id": "eb718efe8de21997",
"type": "function",
"z": "800528f16bfd8a64",
"name": "",
"func": "az = flow.get('az')\n\nmsg.payload = { \"name\":\"Home\", \"bearing\" : parseInt(az), \"icon\" : \"arrow\", \"lat\":-26.70891, \"lon\":27.83386 }\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1180,
"y": 500,
"wires": [
[
"d06fe43fb7808d32"
]
]
},
{
"id": "7568567adf288fd6",
"type": "ui_button",
"z": "800528f16bfd8a64",
"name": "",
"group": "58b3bed8821066d9",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"label": "Johannesburg",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 120,
"y": 300,
"wires": [
[
"d38f4c9f7e3f9ca7"
]
]
},
{
"id": "d38f4c9f7e3f9ca7",
"type": "function",
"z": "800528f16bfd8a64",
"name": "",
"func": "var newAzimuth = { payload: 0 }\nvar newElevation = { payload: 0 }\n\nreturn [newAzimuth, newElevation]",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 280,
"y": 300,
"wires": [
[
"53b1ef447f18e6bb"
],
[
"32dce04be4f5a377"
]
]
},
{
"id": "3e70fa9940e51b28",
"type": "serial-port",
"serialport": "/dev/ttyUSB0",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"waitfor": "",
"dtr": "none",
"rts": "none",
"cts": "none",
"dsr": "none",
"newline": "\\n",
"bin": "false",
"out": "char",
"addchar": "",
"responsetimeout": "10000"
},
{
"id": "c8727dcfabf6aa89",
"type": "ui_group",
"name": "Rotator Position",
"tab": "a34fb69124762ead",
"order": 3,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "e75ac408205351b2",
"type": "serial-port",
"serialport": "/dev/ttyUSB1",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"waitfor": "",
"dtr": "none",
"rts": "none",
"cts": "none",
"dsr": "none",
"newline": "\\n",
"bin": "false",
"out": "char",
"addchar": "",
"responsetimeout": "10000"
},
{
"id": "21cbecce15e5120c",
"type": "ui_group",
"name": "Rotator Control",
"tab": "a34fb69124762ead",
"order": 4,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "f407d2f7c7011868",
"type": "ui_group",
"name": "General",
"tab": "a34fb69124762ead",
"order": 1,
"disp": true,
"width": "12",
"collapse": false,
"className": ""
},
{
"id": "e468d94a8e0f53e2",
"type": "position-config",
"name": "",
"isValide": "true",
"longitude": "0",
"latitude": "0",
"angleType": "deg",
"timeZoneOffset": "99",
"timeZoneDST": "0",
"stateTimeFormat": "3",
"stateDateFormat": "12",
"contextStore": ""
},
{
"id": "58b3bed8821066d9",
"type": "ui_group",
"name": "Rotator Presets",
"tab": "a34fb69124762ead",
"order": 5,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "0a824e569d14d3f5",
"type": "ui_group",
"name": "Debug",
"tab": "a34fb69124762ead",
"order": 5,
"disp": true,
"width": "6",
"collapse": true,
"className": ""
},
{
"id": "a34fb69124762ead",
"type": "ui_tab",
"name": "ZR6TG Satellite Ground Station",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment