icon

How to Track the ISS Location with Node-RED

0 85 Medium

How to Track the ISS Location with Node-RED

Node-RED is a visual programming tool that allows you to create flows of data and logic using nodes. In this article, we will use Node-RED to track the location of the International Space Station (ISS) and display it on a world map.

 

 

 

What You Need

To follow this tutorial, you will need the following:

A computer with Node-RED installed. You can download and install Node-RED from here.An internet connection to access the ISS location API and the world map node.Two Node-RED nodes: node-red-contrib-iss-location and node-red-contrib-web-worldmap. You can install them from the Node-RED palette or by running the following commands in your Node-RED user directory, typically ~/.node-red: 

npm install node-red-contrib-web-worldmap

 

 

 

Get PCBs for Your Projects Manufactured

You must check out PCBWAY for ordering PCBs online for cheap!

You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Also, check out this useful blog on PCBWay Plugin for KiCad from here. Using this plugin, you can directly order PCBs in just one click after completing your design in KiCad.

 

 

 

The Flow

The flow we will create consists of four nodes:

An inject node that triggers the flow every 10 seconds.An HTTP-request node that queries the ISS location API and returns the current latitude and longitude of the ISS.A function node that formats the location data into a message object that the world map node can use.A worldmap node that displays a world map and a marker for the ISS location.

The flow looks like this:

 

 

 

The Nodes

Let’s take a closer look at each node and how to configure them.

 

 

 

The Inject Node

The inject node is used to trigger the flow at regular intervals. To configure it, double-click on it and set the following properties:

Name: Every 10 secondsRepeat: intervalEvery: 10 seconds

This will make the node send a timestamp message every 10 seconds.

 

 

 

The HTTP Request Node

The ISS location node is used to query the ISS location API and return the current latitude and longitude of the ISS. To configure it, double-click on it and set the following properties:

Name: ISS LocationURL: api.open-notify.org/iss-now.json

This will make the node send a message object with the following properties:

This node will return the following payload:

the return payload contains thefollowing properties:

latitude: a string indicating the current latitude of the ISS in degrees.longitude: a string indicating the current longitude of the ISS in degrees.

 

 

 

The Function Node

The function node is used to format the location data into a message object that the world map node can use.

To configure it, double-click on the JSON node and set the following properties.

Next, set the following properties on the change node:

This will make the node send a message object with the same properties as the original message, except for the payload, which will be an object suitable for the world map node.

Here is the final transformed payload that the map node can understand.

 

 

 

The World Map Node

The world map node displays a world map and a marker for the ISS location. To configure it, double-click on it and set the following properties:

This will make the node display a world map widget on the dashboard, with various options to customize the view. The node will also listen for incoming messages with location data and display a marker on the map accordingly.

 

 

 

The Result

To see the result, deploy the flow and open the dashboard. You should see a world map with a blue globe icon indicating the current location of the ISS. The icon will move as the ISS orbits the Earth. You can also click on the icon to see the name and the coordinates of the ISS.

 

 

 

Conclusion

In this article, we have learned how to use Node-RED to track the location of the ISS and display it on a world map. We have used node-red-contrib-web-worldmap to query the ISS location API and display the map widget. We have also used a function node to format the location data into a message object that the world map node can use.

We hope you have enjoyed this tutorial and learned something new. If you want to learn more about Node-RED and its nodes, you can check out these web pages:

Node-REDnode-red-contrib-iss-location (node) - Node-REDnode-red-contrib-web-worldmap (node) - Node-RED

Happy coding!

License
All Rights
Reserved
licensBg
0