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:
- PlatformIO Core. Download the core here: PlatformIO Core
- 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
- 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
- Install code dependencies
- Build
- 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 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:
- test mode pin toggle
- telemetry protocol selection
- clientID (rocket ID)
- arming check
- DEBUG_to_terminal check - defs.h
- 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:
- 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.
- On the ground station computer, connect to "flight-computer".
- 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]
- 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.
- 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:
- Edwin Mwiti
- Junn Hope
- Jones Kisaka
- Ruth
- Safa Osman
- Tabby Achieng
- Sharlyn
- Pat
- Emmanuel
- Fortune
- Newton
- Rodney
- Sammy
- Michael Kimani
- George Bange
- Maisha
- Naomi Chesang
- Brian Munene
- Samson Onyambu
- Cate Kabura
- Amos Korir
- Graig Kipkorir
- Jerry Mumo
- Esther Mamai
- Martin Simbona
- Jeff Mboya
- Washington Kamadi
- Ian Muchiri
- Kibandi
- Emmanuel Obara
Victoria
Ad Astra!!