# Optimizing magnetic field force of a coil

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?

As mentioned in another answer, the magnetic field strength is proportional to amps and turns. However, the current is dictated by drive voltage and coil inductive reactance. Given that inductance (for a tightly wound coil) increases with turns squared it's usually counter-productive to add turns. A simple example is doubling the turns - the inductance rises 4 times and the current therefore falls 4 times and the net effect is that ampere-turns have reduced by two.

As I understand it, adding turns will increase field strength, but adding turns will increase the coil's resistance and therefore reduce current.

If your coil design is at the point of causing worries about coil resistance then it's not a good design - the dominant impedance should be reactive as implied above.

There is always an optimal value but this depends on several factors that you haven't really told us about: -

• Oscillator design
• Tuning regime
• Current available for the oscillator/coil
• Coil design/shape etc..

The magentic field is proportional to ampere turns. You can either increase number of turns or the current. Higher current is possible using thicker wire, simple ohms law I=U/R, where R=ρl/A where l is the length of the conductor, A is the cross-sectional area of the conductor and ρ (rho) is the specific electrical resistance of the material.

For the same ammount of turns (same l), increasing the wire thickness - cross section (A) you get lower resistance.

It should e noted also, that at higher current also the core material (iron choke) can get saturated, so perhaps using larger choke also.