Skip to content

Software

Charles Zhou edited this page Feb 20, 2023 · 6 revisions

Sensors

The transmitter uses the following sensors to gather data:

  • VL53L0X: Time-of-flight sensor

  • BMP388: Pressure sensor

  • LSM6DS33: Accelerometer, gyroscope, and magnetometer

Architecture

SkyNet has two parts. The hardware side of things: the onboard transmitter, and the receiver, are written in C++ like standard Arduino. The ground software is written in JavaScript(& HTML/CSS) using nodeJS wrapped in the electron framework.

Dataflow:

  1. On board, the transmitter interface with sensory via I2C, collects data, then sends the data in a package via LoRa following the package format.
  2. The receiver reads the data package and then appends the package RSSI, then prints it out via serial.
  3. The ground software reads the serial printout, prases it into a JSON struct, then plots and displays the data.

Transmitter Program Logic

The program logic is implemented in the loop function. The function executes continuously and performs the following tasks:

  1. Initialize the program and sensors using the setup function.

  2. Check the current state of the transmitter and perform appropriate actions based on the state:

    IDLE: Check if the rocket should be armed and send sensory states. If receive arm commands, change the state to ARMED.

    ARMED: Check if the rocket has launched. If launched, change the state to LAUNCHED.

    LAUNCHED: Gather data from sensors and transmit it wirelessly to the ground station. Check if the rocket has landed. If landed, change the state to RECOVERY.

    RECOVERY: Send GPS coordinates and wait for recovery.

  3. Wait for a specified amount of time before rerunning the loop.

Package

Data mostly floats and is sent byte by byte using a uint8_t array for the LoRa library to transmit. Then the transmitted data is reconstructed back to float. ToF data is the only exception and is uint8_t. The package payload size is 49 bytes.

Raw Package Format:

tof_data,
bmp.temperature,
bmp.pressure,
bmp.readAltitude(SEALEVELPRESSURE_HPA),
accel_event.acceleration.x,
accel_event.acceleration.y,
accel_event.acceleration.z,
gyro_event.gyro.x,
gyro_event.gyro.y,
gyro_event.gyro.z,
mag_event.magnetic.x,
mag_event.magnetic.y,
mag_event.magnetic.z

Plus Receiver Addition

Package RSSI
Clone this wiki locally