For a personal project, I've done a redesign of Samy Kamkar's MagSpoof project. Basically, it is possible to use an electromagnet, h-bridge, and microcontroller to trick a magnetic card reader into thinking a card was swiped, and feed it arbitrary data. I've designed and soldered up a small PCB that has USB charging, Li-ion pack, and a smaller h-bridge driver (DRV8835 - no fun to solder) than the original.
It works beautifully when running of 5V ISP power, with a ~100 turn coil, 30mm diameter, 30AWG wire. The problem is, when I run it off the lithium ion battery (~3.7v, the battery is connected directly to the h-bridge driver through a switch), the magnetic field doesn't have enough power to transmit meaningful data to the card reader - the card reader simply spits out an error message, indicating it saw something but didn't catch any data. With 5V power and the coil configuration described above, I can hold it more than a couple inches away and still get reliable transmission.
I have since added a boost converter to the board to bump up my voltage to 5V. However, I would like to determine the coil design that will produce the strongest magnetic field.
How do I go about determining this? As I understand it, adding turns will increase field strength, but adding turns will increase the coil's resistance and therefore reduce current. Therefore, there is an optimum number of turns somewhere in the midddle.
How would this value be determined?