Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flat-Sat Cubesat Prototype

A working tabletop "cubesat": a Raspberry Pi Zero 2W (OBC) + Arduino Mega 2560 (real-time node) that reads three sensors, logs telemetry to disk, serves a web UI, and beams the same data over 868 MHz LoRa to a second receiver on your laptop. With the Pi + Mega + SD card + jumpers already on hand and a 3D-printed case, the remaining spend is ~1290 SEK (well under the 3000 SEK target — see BOM.md).

Satellite/
├── README.md              ← you are here
├── BOM.md                 ← parts list, Swedish prices, budget tally
├── BUILD_PLAN.md          ← architecture, power, pin-to-pin wiring, assembly
│                            (incl. §8 soldering the Pi header, §9 3D-printed case)
├── arduino/
│   ├── flight_node/       ← Mega sketch: reads sensors, TX LoRa, UART to Pi
│   │   ├── flight_node.ino
│   │   └── config.h
│   └── ground_station/    ← 2nd Arduino sketch: RX LoRa → terminal
│       └── ground_station.ino
└── pi/
    ├── obc.py             ← Pi: reads UART, logs CSV, Flask web UI
    ├── requirements.txt
    ├── obc.service        ← systemd autostart unit
    └── templates/
        └── index.html     ← the telemetry dashboard

STL/design files for the 3D-printed case are not included — see BUILD_PLAN.md §9 for mounting specs and where to source parametric CAD (Printables / Thingiverse). The section gives you every dimension and mount point you need to model or adapt one.

What it does (the demo mission)

Every 5 seconds, the flight node:

  1. Reads BMP280 (temperature °C, pressure hPa)
  2. Reads MPU6050 (3-axis accel in g, 3-axis gyro in °/s)
  3. Reads INA219 (battery voltage, current, power)
  4. Sends one compact CSV frame over two channels at once:
    • UART to the Pi → logged to data/telemetry.csv + shown on the web UI
    • LoRa 868 MHz → received by the ground station, printed to a terminal
  5. Increments a sequence number so you can spot dropped frames.

Quick start (do these in order)

1. Buy parts

See BOM.md. You already have the Pi + Mega + SD card + jumpers, so the buy list is short: radio, sensors, power electronics, breadboard, Pi PSU, a Micro-USB cable, and a 2×20 header for the Pi (item 18 — you need to solder it on). Two other things to decide up front:

  • Receiver option. Either a second Arduino + LoRa module (cheaper, ~210 SEK), or a pre-built SX1262 USB dongle (plug-and-play, ~300 SEK).
  • Battery. A 1200 mAh LiPo (cubesat-realistic, ~4 h runtime) or a protected 18650 (~7 h, safer to handle). Either works with the TP4056 charger.

2. Solder the Pi header & print the case (parallel, can start now)

  • Solder the 2×20 header onto your Pi Zero 2W — see BUILD_PLAN.md §8. You can't wire anything to the Pi until this is done. ~15–30 min with a fine-tip iron. (Press-fit "hammer header" is the no-solder alternative, item 18 note.)
  • Start the 3D-printed caseBUILD_PLAN.md §9 has all the mount dimensions (Mega 53.3×101.6 mm, Pi 49×58 mm) and material guidance (PETG preferred). Print overnight while you do the wiring; it doesn't block any other step.

3. Build & wire (2–4 h)

Follow BUILD_PLAN.md §5 step-by-step. Each step has a "check" that tells you when it's safe to move on. Don't skip the multimeter check on the 5 V rail (§5 Step 1) — it protects your Pi.

4. Flash the Arduino(s)

In the Arduino IDE (or PlatformIO), install these libraries via Library Manager:

  • RadioLib (by jgromes)
  • Adafruit BMP280 Library
  • Adafruit MPU6050
  • Adafruit INA219 Library

Open arduino/flight_node/flight_node.ino. Check the pins in config.h against your wiring (they default to the pins in BUILD_PLAN.md §4). Select Tools → Board → Arduino Mega 2560, the right COM port, and click Upload.

Repeat for arduino/ground_station/ground_station.ino on your second Arduino, if using one.

5. Set up the Pi

Flash Raspberry Pi OS Lite (64-bit) to the MicroSD with Raspberry Pi Imager. In Imager's settings: hostname flat-sat, enable SSH, set a password, join your WiFi, and disable the serial login shell while keeping serial hardware enabled. Boot headless, SSH in.

sudo raspi-config          # Interface Options → Serial → shell=No, hardware=Yes
sudo reboot
# after reboot:
ls /dev/serial0            # should exist

sudo apt update && sudo apt install -y python3-venv
cd ~ && git clone <your-repo> flat-sat        # or scp the pi/ folder over
cd flat-sat/pi
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python obc.py                                  # Ctrl-C to stop; works, but…

For autostart on boot:

sudo cp obc.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now obc
sudo journalctl -u obc -f                      # live logs

6. Run the demo

With the Pi and Arduino(s) powered:

  1. Open a browser on your laptop → http://flat-sat.local:5000 (or the Pi's IP). You should see live telemetry cards and rolling charts, updating every 5 s.
  2. Open the Arduino IDE Serial Monitor on the ground station at 115200 baud. You should see the same frames arriving over LoRa, each annotated with RSSI and SNR. Walk away from the receiver and watch RSSI drop.
  3. Check data/telemetry.csv on the Pi — rows append in real time.

Verifying the budget

From BOM.mdon hand: Pi Zero 2W, Arduino Mega, MicroSD, jumpers. Case is 3D-printed (~20 SEK of filament):

Bundle SEK
Radio + sensors (LoRa, BMP280, MPU6050, INA219) 452
Power + level shift + reg + antenna 280
Breadboard, Pi PSU, Mega USB cable, Pi header 256
3D-printed case (filament) ~20
Flight node — you pay 1008
Ground-station dongle (Option B) 299
Grand total ~1307
Headroom under 3000 SEK ~1693

Troubleshooting

Most issues are wiring, not code. See the table in BUILD_PLAN.md §7 ("Known traps for beginners"). The most common three:

  • /dev/serial0 missing on the Pi → serial hardware not enabled in raspi-config, or the login shell is still grabbing it.
  • LoRa begin() fails → 99 % of the time it's the level shifter rails (HV to 5 V, LV to 3.3 V, both GNDs tied) or NSS/RST/BUSY pins in config.h.
  • I²C sensor not found → run an i2c_scanner sketch; if a device shows at a different address, update config.h (BMP280_ADDR / MPU6050_ADDR / INA219_ADDR).

Safety notes

  • Always attach the antenna before powering a LoRa radio. Transmitting into no load can damage the power amplifier.
  • Never power the Pi's 5V pin and its USB power jack at the same time. This build powers the Pi through the 5V GPIO pin only (headless).
  • LiPo safety. Use a TP4056 with protection (DW01). Don't leave it charging unattended. If the pack puffs, stop and dispose of it at a recycling centre.
  • Set the boost converter to 5.00 V with a multimeter before connecting the Pi.

Where to go next

  • Swap CSV frames for a real cubesat protocol (CSP, AX.25, or ECSS PUS).
  • Add an ADCS demo: use the MPU6050 gyro to drive a reaction-wheel motor.
  • Wire the solar panel through a proper MPPT and log actual charge current.
  • Push telemetry to The Things Network (TTN) via a real LoRaWAN gateway.
  • Add an SD-card logger on the Arduino too, so you keep data if the UART link drops — true "store-and-forward".

About

Flat-Sat CubeSat prototype: Arduino Mega + Raspberry Pi Zero 2W with LoRa 868 MHz telemetry

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages