N4 Flight Software N4
Flight software used for the N4 flight computers
Loading...
Searching...
No Matches
N4 Flight Software

Introduction

Welcome to N4 Flight software docs. N4 Flight software is the code used to run N4 rockets at Nakuja Rocket Project. This code is built using FreeRTOS on the Arduino-ESP32 framework. It is designed to run either on AI-Thinker NodeMCU-ESP32 boards or ESP32-DOIT-DEVKIT V1.

Major features

This firmare has been improved tremendously from the previous versions and includes the following features:

Modularity

  • Most of the code is now contained in separate files each perfoming its own singular task to ensure code maintainability and testing.

System Logging

  • We have built a system logger to keep track of each and every operation that the flight computer undertakes. This can be be retrieved later and reviewed for post-flight analysis

HIL Testing Engine

  • A hardware-in-the-loop testing engine has been built into the flight software to allow us to "Test Like We Fly". This allows the flight computer to be tested and debugged way before flight day. Using an improvised XMODEM algorithm, we are able to upload test flight data and run necessary integration tests.
    Note
    See Integration and Testing Procedures for more info

Flight data logging

  • Flight data logging has been improved. Using an onboard SPI Flash memory, we are able log sensor data and flight states.

Data dump interface

  • A data dumping hardware interface has been added to ease the retrieval of data post flight data.

SAFE and FLIGHT modes

  • To prevent misfires during intergration and testing, this firmware implements SAFE_MODE that among others operations, disables the pyro-charges before POWERED_FLIGHT.

XBEE, MQTT, LORA, WIFI telemetry selection

  • For backward and forward compatibility, we implement a method to allow choice of data telemetry protocol being used.

Double ejection

  • We implement drogue and main chute ejection algorithms for successful vehicle recovery

Building, Compilation and Downloading.

System requirements

The following must be installed to build this release:

  1. PlatformIO Core. Download the core here: PlatformIO Core
  2. PlatformIO IDE (recommended on VS Code but you can use IDE of your choice). To install PlatformIO IDE, follow the steps listed here: PlatformIO IDE
  3. Serial Monitor tool e.g. Putty, Ai-Thinker Serial, RealTerm etc

Building the code

  • Clone the repo on your local machine
    git clone https://github.com/nakujaproject/N4-Flight-Software.git
Note
You can also download the folder as a zip file and extract it to a folder of your choice. But we recommend cloning it so you can keep up to date with the remote changes.
  • Change the directory to
    N4-Flight-Software\n4-flight-software
    . This is the folder containing
    platformio.ini
  • Install code dependencies
    pio pkg install
  • Build
    pio run
  • Connect your flight computer using a USB cable and make sure it is seen by your PC. It should be listed under Device Manager>Ports, if you are on windows
Note
If your ESP32 is note recognized, you have to install USB-TO-TTL chip driver manually. For ESP32 Boards using CH340 chip, download the driver here CH340 Driver-SparkFun. Run the driver and it will be automatically installed on your machine. For ESP32 Boards using CP2102 chip, follow the procedure here CP2102-driver-POLOLU. Run the driver and it will be automatically installed on your machine.
  • Upload and run Close any open serial ports connected to that ESP32 and run the command below
    pio run -t upload
    The firmware will be uploaded to the flight computer

Hardware, pin assignment and peripherals

Note
In development

Integration and Testing Procedures

Note
In development

Pre-flight software checks

The following checks MUST be performed pre-flight to ensure the software operates as designed:

  1. test mode pin toggle
  2. telemetry protocol selection
  3. clientID (rocket ID)
  4. arming check
  5. DEBUG_to_terminal check - defs.h
  6. LOG_TO_MEMORY - defs.h

WIFI network configuration

The software is written such that it allows the launch crew to connect to any WIFI they are using, without hardcoding the WIFI credentials into the flight software. Follow the procedure below to connect to the WIFI:

  1. When powered on, the flight computer will create an open WIFI network called "flight-computer". This network will be visible on any device within range.
  2. On the ground station computer, connect to "flight-computer".
  3. Open the browser and go to the following IP address "192.168.4.1". This should open the following window in your browser. [image here]
  4. Enter the WIFI SSID and password for the network you want to connect to. In this case it is the WIFI network used for telemetry transmission.
  5. Press save. The flight computer will save the network credentials and auto-reconnect itself to the launch WIFI network. You can now stream telemetry over the network.

MQTT configuration

Contributors

Our thanks go to the following current and previous avionics team members for their contribution:

  1. Edwin Mwiti
  2. Junn Hope
  3. Jones Kisaka
  4. Ruth
  5. Safa Osman
  6. Tabby Achieng
  7. Sharlyn
  8. Pat
  9. Emmanuel
  10. Fortune
  11. Newton
  12. Rodney
  13. Sammy
  14. Michael Kimani
  15. George Bange
  16. Maisha
  17. Naomi Chesang
  18. Brian Munene
  19. Samson Onyambu
  20. Cate Kabura
  21. Amos Korir
  22. Graig Kipkorir
  23. Jerry Mumo
  24. Esther Mamai
  25. Martin Simbona
  26. Jeff Mboya
  27. Washington Kamadi
  28. Ian Muchiri
  29. Kibandi
  30. Emmanuel Obara
  31. Victoria

    Ad Astra!!