Remove the erasers and metal parts from the pencils. Sharpen both ends.
Push the pencils through the middle of the cardboard square, about an inch apart.
Fill the glass with warm water. Add a teaspoon of salt to the water and stir it until the salt is completely dissolved. Salt is an electrolyte; salt water conducts electricity better than fresh water.
Twist the end of a copper wire around the positive side of the 9-volt battery. Connect the other end of the wire to the sharpened graphite tip of one of the pencils. Connect the other wire from the negative side of the battery to the tip of the other pencil.
Lower the other two ends of the pencils into the salt water, with the cardboard across the top of the glass. Hydrogen bubbles will form around the pencil connected to the positive side of the battery, and oxygen will bubble from the negative end.