# How do I analyze Mg<->C galvanic cell?

I've made a battery for middle school, and I want to figure out the chemistry, especially so I can say whether the little bubbles in there are $\ce{CO_2}$ or hydrogen.

In salt water, I have a strip of magnesium, and a graphite bar. They connect outside of the jar with wires to an LED, and the cell produces a little electricity. The magnesium strip slowly corrodes, and as it runs it produces little gas bubbles on the magnesium.

I think the bubbles might be hydrogen, but my partner thinks they might be $\ce{CO_2}$. We've tried googling for equations for magnesium and carbon, but haven't found someone who seems to be talking about a cell like this. What's going on? Also, what is the stuff forming on the magnesium? Some of it seems to be flaking down to the bottom of the jar. I think it's some kind of magnesium oxide, but that's a guess. Can someone guide us? Thanks!