Avionics 2018
Avionics introductory project designed to introduce new and returning members to the type of work done in this subteam.
Last updated
Avionics introductory project designed to introduce new and returning members to the type of work done in this subteam.
Last updated
You have been given a design for a very simple rocket flight computer that consists of six components: a battery, a voltage regulator, an ATMega328P microprocessor, an MPL3115A2 altimeter, and two black powder ports. You will be describing the system in more detail and writing firmware to control the rocket’s recovery system (parachutes) via the two black powder ports.
If you are confused, read the Avionics guides under the "Tutorials" tab!
The details of the battery and voltage regulator do not matter, but they must both be included in the final system diagram that you create.
You have been provided with an interface for a HAL (Hardware Abstraction Layer). You will use its functions to write the firmware for the ATMega328P. The file is below, in the Files section.
The pinMode, digitalRead, and digitalWrite functions act as they would in Arduino.
The i2c_*** functions act as they would in the Arduino Wire library.
The millis function returns time, in milliseconds, from program start.
Arduino reference materials and the HAL are listed below, in the Resources section.
When configured correctly, the MPL3115A2 provides integer altitude data, in feet, via the I2C protocol.
Registers implemented in the simulator are:
Pressure Data Out MSB/CSB/LSB (OUT_P_XSB)
System Mode (SYSMOD)
Control Register 1 (CTRL_REG1)
Control Register 2 (CTRL_REG2)
Who Am I (WHOAMI)
Data Ready Status (DR_STATUS)
Pressure/Temperature Data Config (PT_DATA_CFG)
Depending on how you use the altimeter, you may not need all of these registers.
The simulation runs at 100 times real time, i.e. millis() returns 100 * (milliseconds elapsed since start of program). Be careful if using sleeps and while debugging.
The two black powder ports are activated by two specific GPIO pins on the ATMega328P. To activate each one, turn on the pin for at least 50 milliseconds.
The drogue chute ignition pin is PB3.
The main chute ignition pin is PD7.
The firmware must be written in C.
The initial altitude reported by the MPL3115A2 will be somewhere within [-100, +100] feet in altitude (inclusive)
The altitude will remain within [-5, +5] feet of an unspecified constant altitude between [-100, +100] feet -- the ground altitude -- for at least 30 seconds after flight computer startup and before launch. All altitudes following are in reference to this ground altitude. It is expected that there will be some inaccuracy in the timing of the ejections in your firmware due to the fluctuation of altitude readings while the rocket is on the ground.
The black powder ignitions must happen at apogee, +/- 2 seconds, and at 600 feet of altitude during descent, +/- 2 seconds.
Neither black powder ignition should happen unless the rocket has passed 200 feet in altitude.
Determine and implement a proper strategy for the case in which the flight computer passes 200 feet in altitude, but does not reach an apogee of 600 feet in altitude.
Describe at least three failure modes and how they are being mitigated or avoided.
Describe test procedures you would use to verify correct functionality in the lab (i.e. not at a launch) and at a launch.
Show how the microprocessor should be hooked up to the MPL3115A2 and any additional hardware added in order to mitigate failure modes and run test cases (such as status LEDs or buttons). This must be in the form of a wiring diagram or schematic.
Add at least one feature to the code and/or schematic that is used for safety, such as beeping when black powder is connected. Describe the feature and explain any changes made to accommodate it. You are encouraged to look at how COTS (Commercial Off-the-Shelf) altimeters work for inspiration. Some examples are the Stratologger CF and the MissileWorks RRC3.
The HAL you are provided is in fc.h. You are expected to write an fc.c file that defines fc_setup and fc_loop.
fc_setup is called once, followed by fc_loop called repeatedly until the simulation is complete.
All of the other functions declared in fc.h are defined by the simulation runner, in fc_sim.mac.o or fc_sim.win.o.
Download the appropriate fc_sim.***.o file from the Files section and rename it to fc_sim.o (if you want).
You are provided with a compiled, but not linked, simulation runner, called fc_sim. You will compile your flight computer code and link it with fc_sim to create an executable that, when run, will tell you how the launch went!
To compile your flight computer:
The -g is to compile with debug symbols.
Note: On linux you may have to add a "-lm" flag to link the math library.
To test your flight computer, simply run fc_sim.
To debug your flight computer, use your favorite C debugging tool, such as gdb. You are not provided the code for the flight computer simulator, but you can debug your own code.
Tip: VSCode makes it very easy to write, build, run, and debug code once you have it set up!
One simple electrical system consists of a battery and a microcontroller with a single button connected with a pullup resistor and a single LED with current-limiting resistor, as shown below. Determine how long it will last on battery power. Explain your answer.
Vbatt = 15V, and its capacity is 1A-hr. For safety, only 80% of its full capacity should be used.
U1 outputs 5V, and is 90% efficient.
The microcontroller draws a constant 20mA.
R1= 10kΩ, and S1 is pressed 5% of the time.
R2 = 200Ω, D1's Vf = 2.1V, and D1 is on 50% of the time.
2. Write a short snippet of C code that, given an 8-bit register r and a bit index b:
Sets bit b.
Clears bit b.
Toggles bit b.
Assigns bit b to a boolean value v.
Please PM Jacob, the Avionics Lead (Jashaszun#9329) a ZIP of the following files via Discord:
Any C files you wrote that are required to compile and run your flight computer.
A text file or PDF containing your answers to all other parts of the project.