I'm thinking of doing a project to make a Raspberry Pi controlled chess playing robot arm similar to the Raspberry Turk I've read about online (https://www.raspberryturk.com/). Like the Turk, at the end of my robot arm would be a small electromagnet that would be used to pick up and place the chess pieces. But unlike the Turk, I would use a home-made electromagnet made with 16 AWG gauge copper wire and an iron screw. This brings me to two questions:

**1.**According to the research I've done online, the formula for calculating the force applied to a piece of metal by an electromagnet is:

F = (n * (V/R))^2 * K * a / (2 * g^2)

where:

F = force in Newtons

n = number of turns in the solenoid

V = the voltage in the circuit

R = the resistance of the circuit in ohms

K = the magnetic constant which is equal to 4 * PI * 10^-7.

a = the cross-sectional area of the wire in meters

and g = the distance between the electromagnet and the piece of metal in meters

According to my calculations, if:

n=100

V=5

R=0.0147286821705 ohms (The resistance in 1 meter of 16 gauge copper wire)

a = 0.00000130698108371 meters (the cross-sectional area of 16 gauge copper wire)

and g = 0.0254 meters (1 inch),

then the force applied to the piece of metal by the electromagnet would be 1.506 Newtons or 0.339 pounds of force. This would be plenty of strength to pick up the chess pieces, but I'm wondering if my math is correct.

**2.**Keeping the above description of the electromagnet I have planned in mind, would I be able to protect the RPi against the reverse EMF current produced when the electromagnet is turned off with just a simple LED serving as a Fly-back Diode? I understand LEDs are usually not sufficient to protect against the reverse EMF currents produced when more powerful electromagnets are turned off, and that special diodes are needed instead, but will an LED do the trick for a weaker electromagnet like the one I'm talking about? If not, then what would be the simplest way to prevent the electromagnet from frying my Pi?

Thank you kindly in advance,

ZetaPi1