Electromagnets and coils for potentially explosive areas