I have made a simple electromagnet with an iron nail, insulated copper wiring, and a 9v battery. My intention is to use the electromagnet to repel a small permanent magnet, but for some reason, I can only get the electromagnet to attract the permanent magnet. I figure I must have a problem...