lots of info on hyperventilation on the net, to avoid it, get into the habit of breathing deep and slow especially when stressed
if suddenly panicky it can help to hold your breath for a while