I am building a PEMF style device using a number of electromagnet coils. They are ZYE1-P20/15 12v 0.25A units from china capable of lifting 2.5kg. I took a chance on the strengh but that is not the issue. I am controlling 1 at the moment using an 8 channel relay board and raspberry pi. The boards relays can take 30v 10A dc so I assumed there would be no problem. I am using the relay as a switch with a 12v 200mA transformer to switch the coils on and off. It is just the supply, coil and relay in series. I set a program to switch it on for 5 seconds and off for 1 second, I couldn't find a duty cycle so don't know if this is inappropriate but the coils were sold as being able to be used in machines for packing and they are switch on and off frequently. The problem I have is after about 5 minutes the coil was very hot and the raspberry pi was being affected. Is this feedback and will a 1N5349B diode in the circuit stop it getting hot?
First, you haven't actually told us what your problem is. You say that the Raspberry is being affected. Why? Do you have both in closed box and the Raspberry is getting hot? Well, there's an old joke about a guy who goes to a doctor and says, "Doctor, it hurts when I do this". The doctor responds, "Well, don't do it." If the coil heating the Raspberry isn't your problem, what is? What, exactly, does "being affected" mean? If the coil is heating the Raspberry, move the coil or move the Raspberry.
That said, you actually know the answer, but you're not willing to face it.
"I couldn't find a duty cycle so don't know if this is inappropriate but the coils were sold as being able to be used in machines for packing and they are switch on and off frequently."
So you got a unit off the internet and you don't know if it will do the job. So instead of figuring out whether or not the duty cycle is giving you problems, you have fixed on a flyback diode as your savior. This simply isn't going to work.
So what you need to do is this:
1) Get yourself a tin can. Place it on a flat, fireproof surface - a cinderblock will do nicely.
2) Take one of your coils and put it in the can.
3) Hook up 12 volts to the solenoid.
4) Let it run overnight.
5) If it hasn't caught fire, find the coil temperature. You can touch it with a thermometer, or pour enough water in the can to cover the coil and let it run for another hour, then measure water temperature. As a very rough indicator, 60 C is the "Ouch!" point, where most folk can't hold a hot object.
6) Check to see that the coil is still working.
If the coil has not caught fire and is still working properly, you know how hot it gets and that it can survive this temperature and still work, so you don't need to do anything.
A flyback diode is always a good idea to limit switching transients and extend the lifetime of your relay contacts, but it will do nothing to solve your temperature problem.
(1) You have "12v 0.25A" adapter. You are using "12v 200mA" transformer.
Your transformer is not rated even for a single relay. Most likely it overheats as well.
(2) Is this feedback and will a 1N5349B diode in the circuit stop it getting hot.
You have a relay board, right? Then it is not feedback. Diode is needed to protect raspberry pi side of things, and looks like your problem is on relay side.
(2) the raspberry pi was being affected.
This is strange -- relays should be good at isolating parts from each other. Is raspberry pi close to your coil? Could it be pi overheating?