control Constant Current-Electromagnet

i do have a diode, could it be the electromagnet drawing too much current?
I am using a custom made one.(not the one i said before)
the current should be my voltage times resistance of the wire ,right?

maybe during charging or discharging the coil i am getting massive spikes?