The Final Ascent
The ocean floor trembles beneath your damaged spacecraft. Through the murky depths, emergency lights cast eerie shadows across the control panels as warning systems chirp their urgent messages. Your fingers hover over the depth control encoder, knowing that the next few minutes will determine whether you see home again or become another casualty of the deep.
Mission Control's voice crackles through the damaged communications array, distorted but determined. "Explorer, we've calculated your ascent profile. You're sitting at negative sixty meters, and every meter between you and the surface is a test of your engineering skills. The hull integrity sensors are showing stress fractures, so this isn't just about getting up there – it's about getting up alive."
The depth gauge glows with its familiar amber numbers: -60. Your rotary encoder sits ready, its mechanical precision the only thing standing between controlled ascent and catastrophic decompression. Through the porthole, bioluminescent creatures drift past like alien constellations, unaware that they're witnessing a desperate race against physics itself.
But you're not just relying on manual controls anymore. The passive buzzer mounted to pin 10 will scream warnings if you rise too fast. The TM1637 display will flash critical hold messages at the 50% and 75% ascent points, where decompression stops are mandatory. Every component in your circuit has a role in this final performance, and failure is not an option.
Your hand steadies on the encoder. The surface seems impossibly far above, but your code is solid, your wiring is tested, and your determination is unshakeable. Time to prove that twenty days of survival training weren't for nothing. The ascent begins now.
Mission Objectives
When you complete this mission, you'll have mastered the art of controlled ascent systems. You'll understand how to implement rate limiting in real-time control systems, how to use percentage calculations without floating-point math, and how to coordinate multiple feedback systems for safety-critical operations.
You'll be able to program milestone detection that triggers at specific progress points, implement audio warning systems that respond to dangerous rate changes, and create custom display patterns that communicate critical status information. These are the skills of spacecraft systems engineers – professionals who design the software that keeps astronauts alive in the most unforgiving environments imaginable.
By the end of today's mission, your depth control system will intelligently monitor ascent rate, enforce safety holds at predetermined depths, provide both visual and audio warnings, and celebrate successful surface arrival with a victory sequence. Your code will demonstrate the kind of robust, safety-first programming that real spacecraft depend on.
Understanding Rate-Limited Control Systems
Think about riding an elevator in a skyscraper. The elevator doesn't just rocket from the ground floor to the 50th floor at maximum speed – it accelerates gradually, maintains a safe speed, and decelerates before reaching your destination. This isn't just for comfort; it's for safety. The same principles apply to spacecraft ascending through water or atmosphere.
Rate limiting is the engineering technique of controlling how fast something can change over time. In our case, we're limiting how quickly our spacecraft can ascend to prevent structural damage from rapid pressure changes. Real submarines use similar systems – they can't just blow all their ballast tanks and rocket to the surface because the hull would implode from the sudden pressure differential.
Our system monitors the difference between the current depth and the previous depth each time through the control loop. If that difference exceeds our safety threshold (one meter per loop iteration), we trigger an audio warning. This is exactly how real spacecraft systems work – they continuously monitor critical parameters and alert operators when values approach dangerous limits.
The genius of this approach is that it transforms a simple rotary encoder into a sophisticated control interface. Instead of just reading "turn left" or "turn right," our system interprets encoder movements as ascent commands, validates them against safety limits, and provides immediate feedback when the operator exceeds safe parameters. This is the foundation of all fly-by-wire control systems used in modern aircraft and spacecraft.
Mission Critical Wiring

Today's circuit builds directly on Day 18's foundation with one critical addition: the passive buzzer connected to pin 10. This buzzer serves as our audio warning system, alerting us when ascent rate exceeds safe limits.
This is lesson 20 of 31 in 30 Days Lost in Space — a professionally produced Arduino course taught by Dr. Greg Lyzenga (NASA JPL scientist, Harvey Mudd professor). Each lesson features cinematic-quality video produced with a 20-30 person professional crew.
All video lessons are free to watch. Get the kit at craftingtable.com — $100 with a 30-day money-back guarantee.