Cubesat With Ultrasonic Sensor

149

1

1

For this project we asked how we could design, build an program a model of a Mars Orbiter that will collect data and inform us on specific aspects of the planet. We decided to make a Orbiting Cubesat that contained an Arduino, breadboard, SD card, and ultrasonic sensor. We ended up collecting data that was stored on the SD card.

Step 1: Design - Paul

Our cubesat was designed with functionality in mind. We needed different shelves for the sensors and breadboards and also the arduino. We effectively designed the cubesat's sides so that it was as open as possible while allowing for shelves that could be glued to them. We thought about making our cubesat out of metal, but decided cardboard was the best option because it was widely available and light weight while offering necessary integrity.

Step 2: Cut - Spencer

We then started looking for our materials that we were going to use. Once we had our cardboard that we were going to use, we started to lay out where we were going to cut the cardboard. Each piece was 10x10x10 cm.

Step 3: Continue Cutting - Spencer

Once we had our initial pieces cut out, we started to decide where we were going to put our ultrasonic sensor so that it could read against Mars. By doing this we had to cut out holes in the cardboard pieces or windows. We did this on 3 sides and left on side to make a door so that we could put the arduino and sensor inside.

Step 4: Start Gluing - Spencer

After we had all of the sides cut out we then started gluing the sides together. After we glued them together, we kept the other cardboard piece to cut out the door. We used glue instead of other options because it was easy to use and much stronger than tape.

Step 5: Arduino - Paul

Before we could put anything in the cubesat, we had to get our arduino wired up and working. For us, this was the hardest part of our project. We had to place the wires in the correct locations for the specific sensor, and we had to make sure these specific wiring locations matched up with the code we were using. It took a long time, but eventually we found a combination that worked very well.

Step 6: Fritzing Diagram - Luke

This Fritzing Diagram shows the correct placement of wires between the Arduino/Breadboard/SD card. Hopefully this helps to guide you while wiring for the specific sensor.

Step 7: Arduino Code - Paul

This is the code that was used for our specific sensor (Ultrasonic Sensor). The code includes comments explaining the nuances of the code. The code also measures the distance in cm when viewing the data in the SD card or Serial Monitor.

Here is the code:

#include
#include #define trigPin 9 //was 13 #define echoPin 8 //was 11 File myFile; int pinCS = 10; void setup() { Serial.begin (9600); pinMode(pinCS, OUTPUT); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); if (SD.begin()) { Serial.println("SD card is ready to use."); } else { Serial.println("SD card initialization failed"); return; } // Create/Open file myFile = SD.open("test.txt", FILE_WRITE); // if the file opened okay, write to it: if (myFile) { Serial.println("Writing to file..."); // Write to file myFile.println("Testing text 1, 2 ,3..."); myFile.close(); // close the file Serial.println("Done."); } // if the file didn't open, print an error: else { Serial.println("error opening test.txt"); } // Reading the file myFile = SD.open("test.txt"); if (myFile) { Serial.println("Read:"); // Reading the whole file while (myFile.available()) { Serial.write(myFile.read()); } myFile.close(); } else { Serial.println("error opening test.txt"); } } void loop() { long duration, distance; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; if (distance >= 300 || distance <= 0) { Serial.println("Out of range"); } else { myFile = SD.open("test.txt", FILE_WRITE); Serial.print(distance); Serial.println(" cm"); SD.open("test.txt"); myFile.print(distance); myFile.println(" cm"); myFile.close(); } delay(100); }

Step 8: Puting Arduino in Cubesat - Luke

In order to place our Arduino in the cubesat so it could collect data effectively, we had to construct a shelf where the breadboard could rest while it was wired to the Arduino located on the floor of the cubesat.

Step 9: Hole Drilling - Paul

After placing and securing our Arduino in the cubesat, we realized we had no way to power the Arduino via a battery. The sides of the cubesat prevented effective placement of the battery wires to power the Arduino. To fix this, we drilled a hole on the side where the battery port was. We chose a drill bit that was big enough to allow for passage of the battery wire, but not too big that it would jeopardize the integrity of the cubesat's side.

Step 10: Testing - Luke

To ensure arduino safety we ran a few tests. We preformed a shake test which simulated the cubesat exiting the earth atmosphere. The flight test showed us how the cube sat would fly when we started collecting data. It also allowed us to get a feel for how we would maintain a constant plane so the Arduino could collect the most data.

Arduino Contest 2019

Participated in the
Arduino Contest 2019

Share

    Recommendations

    • Frozen Treats Challenge

      Frozen Treats Challenge
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest
    • Sensors Contest

      Sensors Contest

    Discussions

    0
    None
    ThomasW165

    4 weeks ago

    Great start guys.. but ultrasonic sensors only work with air present.. not in space.

    How would you go about collecting real distance data? :)