pH is arguably the most finicky aspect of an aquaponics system to manage. This is due to the fact that pH is an intrinsic property of the water that is affected by the fish, nitrifiers, and all the water additions we add so it's hard to manage all the factors individually. Without the proper mix your system pH may shoot up or down drastically leaving you clueless and frustrated.
One of the best practices to help you avoid the violent pH swings is simply to have a buffer. Buffers work by resisting the swings of pH through the dissociation of, in this case, carbonate and bicarbonate molecules. In layman's terms potassium and calcium, at certain pH levels, will separate from their respective carbonate groups, which can soak up the free hydrogen atoms that correspond to the pH. So, in practice Calcium Carbonate will want to keep a system at a pH of around 9 while Potassium Bicarbonate will want to stabilize around 6 (this is called the pKa).
This works wonderfully for the aquaponic grower since you'd generally like a ratio of 4:1 of potassium to calcium which will keep the pH around 6.8-7. After then you can add half as much magnesium as you did calcium and that should balance the biggest ionic nutrients in an aquaponic system. The important properties of each nutrient is not their concentration but their respective ratios. This is true because the same ionic channels in the plant roots are responsible for Calcium and potassium, for example. Optimally, you'd want the right ratios of each nutrient interacting with the cellular channels, and this all happens by chance so it is, in the end, just a game of chance. To give yourself a fighting chance start with a well balanced solution. What I'd recommend is to start with rain water or Reverse Osmosis water which would have a pH of 5.5-6. From there make a 4:1 mixture of potassium bicarbonate and calcium carbonate and slowly add little by little to move the pH to 7. From there you can add half as much magnesium as you did calcium (this means keeping track of how much you added to achieve the pH of 7 and add 1/8 that amount in magnesium sulfate). From then on, it's just a matter of maintaining the desired pH 6.8-7 with additions of potassium and calcium as it is natural for a healthy system to drop in pH over time. To further ensure that your buffer is set up, measure the kH of your water. This is a measure of the alkalinity which is affected by the amount of carbonates in your system. Our systems run between a kH of 5 and 10 and we have never experienced a wild pH swing, even in our small ten gallon systems which are more susceptible to erratic pH changes.
Finally, we like to keep the input factors that affect pH to a minimum as they can also affect other nutrient levels. For this reason we don't like adding phosphoric acid unless for some reason we want to drop the pH just a little. If your pH is very high (above 8) we need to first reduce kH to 0 (we did this once when we used well water with a kH of 16 and pH of 8.5) with muriatic acid so you don't end up adding a ridiculous amounts of phosphorus to your system. To supplement phosphate we simply use a dual root zone method. Unfortunately this method is more difficult for the traditional deep water cultures, but in media beds it is perfect. This is done by placing a soil-filled burlap sack an inch above the highest water level in a media bed which allows us to add in chelated iron, rock phosphate and other rhizosphere-amplifying goodies directly into the soil pot. The nutrients are not washed away by the water, don't affect pH and the plant is able to access them as needed. We highly recommend the dual root zone method especially for any fruiting/flowering plants.
Keep your kH between 4-10. To lower your pH if it's 8+ use Muriatic Acid To lower your pH if it's below 8 use Phosphoric Acid To raise your pH without affecting the kH use Potassium Silicate To raise your pH and your kH use Potassium Bicarbonate or Calcium Carbonate