After a good night of sleep, Mark comes up with a plan. First, he'll remove all of the oxygen from the Hab to eliminate the possibility of a giant explosion. Next, he'll slowly release some O2 and slowly burn off the hydrogen in "controlled bursts" (5.10).
As usual, there's just one problem–removing oxygen will probably kill off the soil. Mark has a possible solution to this, however. He'll store the potatoes outside, and then lower the temperature in the Hab super low, which should put all the soil's bacteria into hibernation.
Once everything is prepared, Mark gets to work "clearing out the hydrogen" and "making more water" (5.53). Things are going great.
... until the explosion.
Although the explosion knocks his socks off (almost literally), the Hab is fully functional—even the soil survived.
But what created this big bang?
Well, it turns out that Mark released a tiny bit of oxygen each time he breathed. In case you forgot, the Hab had to be completely free of oxygen in order to make things worth. Basically: oxygen + hydrogen + fire = boom.
Thankfully, the hydrogen is now gone, so Mark can finally sleep in the Hab. He still has to produce water in this risky way, but he at least knows what to avoid this time.