ISS tracker with the plug and make kit!

Ever wondered where the ISS is right now? Or how close it is to you? Then this project will solve that mystery!

Mar 12, 2025

955 views

2 respects

Components and supplies

1

Arduino Plug and Make Kit

Apps and platforms

Arduino Cloud

1

arduino IDE

Project description

Code

ISSTracker

csharp

ISS tracker code

drawings.h

csharp

LED Matrix drawings

Downloadable files

ISS tracker schematic

ISS tracker schematic

isstracker_schematic.png

Immagine

Comments

Only logged in users can leave comments

Immagine
Immagine

aq31

6 days ago

the code was not completely good here is the correction: #include "arduino_secrets.h" #include “thingProperties.h” #include <math.h> #include "Arduino_LED_Matrix.h" #include "drawings.h" #include <ArduinoJson.h> #include <ArduinoHttpClient.h> #include <Modulino.h> ArduinoLEDMatrix matrix; Modulino LED pixels; // Keeps track of which direction the ISS should be going on the LED matrix bool dirSwitch = false; // Variables for keeping track of distances float distance; // Enter your coordinates here: float myLongitude = 1.4442469; float myLatitude = 43.6044622; // These variables will hold the ISS coordinates float spaceLong, spaceLat; String timeOfDay; void setup() { // Initialize serial and wait for port to open: Serial.begin(9600); // This delay gives the chance to wait for a Serial Monitor without blocking if none is found delay(1500); matrix.begin(); Modulino.begin(); leds.begin(); // Defined in thingProperties.h initProperties(); // Connect to Arduino IoT Cloud ArduinoCloud.begin(ArduinoIoTPreferredConnection); /* The following function allows you to obtain more information related to the state of network and IoT Cloud connection and errors the higher number the more granular information you’ll get. The default is 0 (only errors). Maximum is 4 */ setDebugMessageLevel(2); ArduinoCloud.printDebugInfo(); } void loop() { ArduinoCloud.update(); // Calls a function that will get the ISS position getISSposition(); // Calculate distance in km calculateDistanceInKm(); // Display time of day with the Modulino pixels displayLEDs(); // Checking the distance and drawing on the LED Matrix according to how close the ISS is if (distance > 2500) { matrix.loadFrame(furthestAway); dirSwitch = false; } else if (distance < 2500) { if (dirSwitch) { matrix.loadFrame(leavingFar); } else { matrix.loadFrame(farAway); } } else if (distance < 1500) { if (dirSwitch) { matrix.loadFrame(leaving); } else { matrix.loadFrame(gettingCloser); } } else if (distance < 500) { matrix.loadFrame(contact); dirSwitch = true; } delay(15000); } void getISSposition() { int httpPort = 443; char serverAddress[] = "api.wheretheiss.at"; // server address WiFiSSLWi-fi client; HttpClient client = HttpClient(wifi, serverAddress, httpPort); client.get("/v1/satellites/25544"); String result = client.responseBody(); // Collects the API response if (result.length() > 0) { DynamicJsonDocument doc(32000); deserializeJson(doc, result); // Extracts the information from the API call spaceLong = doc["longitude"]; spaceLat = doc["latitude"]; timeOfDay = String(doc["visibility"]); } } void calculateDistanceInKm() { int R = 6371; // Radius of the earth in km float converter = M_PI / 180; float calculateLat = (spaceLat - myLatitude) * converter; float calculateLon = (spaceLong - myLongitude) * converter; float a = sin(calculateLat / 2) * sin(calculateLat / 2) + cos(myLatitude * converter) * cos(myLongitude * converter) * sin(calculateLon / 2) * sin(calculateLon / 2); float c = 2 * atan2(sqrt(a), sqrt(1 - a)); distance = R * c; // Distance in km } void displayLEDs() { // Set the LEDs to yellow if (timeOfDay == "daylight") { for (int i = 0; i < 8; i++) { leds.set(i, 100, 100, 0, 25); leds.show(); } } // Set the LEDs to blue else if (timeOfDay == "eclipsed") { for (int i = 0; i < 8; i++) { leds.set(i, 0, 0, 100, 25); leds.show(); } } }