This previous question Controlling an electromagnet with Arduino deals with binary control (ON or OFF) only. On my side I need to choose the strength of the magnetic field.
It is a home made electromagnet, I managed to power it with 12V DC + a 5ohm resistor which gives around 2Amps. The resulting magnetic field is big enough. The resistor gets hot, but this is bearable.
Now I want to modulate the intensity between 0 and 2 amps from some sensor reading, so I'm planning to use an Arduino.
Can I use PWM knowing that the inductive load is significant? Is the frequency choice of the PWM critical? Will I have trouble with Eddy currents in the soft core? (I can't use laminated core).
So my question is : is PWM a good choice really? If yes, should I keep the 5ohm resistor? How can I calibrate my PWM frequency + alpha? If no, what could I do instead? Which circuit?