Show the current position of the International Space Station (ISS)

This is a spin-off from a question I answered for someone on the forum recently.

I thought it would make a great fill-in exercise for any of my IoT students who have a few minutes to spare towards the end of a session of my IoT Club.

Here's a screen-shot of a simple dashboard - I'm sure most people could improve it.

ISS_flow

[{"id":"7969e7f53683abdf","type":"debug","z":"a9b12d67e974b017","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":560,"wires":[]},{"id":"605c9ce313e4a5a7","type":"ui_worldmap","z":"a9b12d67e974b017","group":"2976f0b10d880a55","order":1,"width":"12","height":"10","name":"ISS","lat":"51","lon":"0","zoom":"4","layer":"EsriS","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"true","panlock":"false","zoomlock":"false","hiderightclick":"true","coords":"none","showgrid":"false","allowFileDrop":"false","path":"/worldmap","overlist":"CO,RA,DN","maplist":"EsriS,EsriT,NatGeo","mapname":"","mapurl":"","mapopt":"","mapwms":false,"x":590,"y":500,"wires":[]},{"id":"060a72676e03f9d3","type":"inject","z":"a9b12d67e974b017","name":"Trigger every 5-secs","props":[{"p":"headers","v":"{\"Accept\":\"text/json\"}","vt":"json"},{"p":"url","v":"http://api.open-notify.org/iss-now.json","vt":"str"}],"repeat":"5","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":200,"y":440,"wires":[["3b88474842c4750d"]]},{"id":"3b88474842c4750d","type":"http request","z":"a9b12d67e974b017","name":"Get ISS coordinates","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":200,"y":500,"wires":[["6b32ca2b8bafb6cf"]]},{"id":"6b32ca2b8bafb6cf","type":"function","z":"a9b12d67e974b017","name":"Extract lat, lon","func":"let out = [];  // Declare an array\n\nlet id  = \"ISS\";\nlet lat = \"\";\nlet lon = \"\";\n\nlon = msg.payload.iss_position.longitude;\nlat = msg.payload.iss_position.latitude;\n\nout.push({\"name\": id, \"lat\": lat, \"lon\": lon, \"layer\": \"ISS position\", \"icon\": \"iss\"});\n\nmsg.payload = out;\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":500,"wires":[["605c9ce313e4a5a7","7969e7f53683abdf"]]},{"id":"2976f0b10d880a55","type":"ui_group","name":"World_Map","tab":"906026b74a1ed967","order":1,"disp":true,"width":"12","collapse":false,"className":""},{"id":"906026b74a1ed967","type":"ui_tab","name":"ISS","icon":"dashboard","order":41,"disabled":false,"hidden":false}]

I'm using the API at... http://api.open-notify.org/iss-now.json to obtain the 'lat' & 'lon' of the ISS, then send these details to the worldmap node. I suggest you restrict the Trigger interval to 5-sec or more otherwise the server at open-notify might get a bit stressed. (The animation looks pretty good at 1-sec intervals.)

I hope someone finds this flow useful.

EDIT: Updated flow and screenshot with ISS icon.

6 Likes

Perhaps if you have a clever student who wants to push ahead, get them to convert the source for open-notify to JavaScript so that Node-RED can go direct to the source :exploding_head:

Open-Notify-API/iss.py at master · open-notify/Open-Notify-API (github.com)

1 Like

Great idea - thanks Julian.
I'll keep that one up-my-sleeve for one of my "keen" students to tackle.

the worldmap does have an ISS icon built in....

3 Likes

Is the ISS modeled on the TIE/sh VIP Shuttle?

1 Like

Thanks Dave - I've updated my screenshot and NR-flow to incorporate the ISS icon.

Amazing. Thank you for sharing

You can also use following node to calculate the position yourself. That way you can go around the poll limit.
I haven't used the node myself, but I have a similar project where I did the calculations on an esp8266.

1 Like

Indeed I forgot we had that ! It also includes a 3d world view "earth" node

1 Like