Toggling circuit hundreds of times per second with arduino

I am trying to use the Arduino to control another circuit where it needs to switch the circuit on and off 400 times a seconds. I initially thought of using a relay, but I don't think there exists a cheap relay that toggles so quickly. So I was looking for transistors which could do that and it does not seem that the datasheets records this type of information.

What transistors or other electrical components can I use to toggle a circuit on and off very quickly?

Any transistor will do this.

Tell us exactly what you are doing.

A logic level MOSFET will probably do just fine.

Some example circuits are seen in the attached circuits, i.e. row 1.

The motor component would be replaced by your electromagnet.

Some suggestions for logic level MOSFETs:

https://forum.arduino.cc/index.php?action=dlattach;topic=445951.0;attach=354033

What is the coil resistance of your electromagnet ?

nirmalp:
I would like to generate an oscillating magnetic field by toggling an electromagnet on and off. These electromagnets require higher voltages (12V - 24V) and currents so I cannot connect it directly to an Arduino. Hence I was looking into relays or transistors which could toggle the electromagnet circuit at high frequencies.

At 400Hz the inductance of the magnet will have a significant limiting effect on the current. Also, now this is something I vaguely remember from college 40+ years ago, the core material might not be able to respond that quickly to a changing magnetic field. However, if you are experimenting then go ahead and learn something and be ready for results different to what you might be expecting. If you are driving an electromagnet with a square wave through a transistor you will need a reverse biased diode across the coil connections to protect the transistor from the back EMF when the current is interrupted. That diode alone will 'slug' the coil and make it slow to respond. No, I'm not going to explain further, build the circuit and see what happens.

When you discover this doesn't do what you expect do some searching for LC resonant circuits.

And a more useful definition of the project might assist more practical suggestions. :cold_sweat:

nirmalp:
I would like to generate an oscillating magnetic field by toggling an electromagnet on and off. These electromagnets require higher voltages (12V - 24V) and currents so I cannot connect it directly to an Arduino. Hence I was looking into relays or transistors which could toggle the electromagnet circuit at high frequencies.

To generate an "oscillating" magnetic field, you must REVERSE the polarity of the magnetic field, not just turn it on and off.

Paul

nirmalp:
I would like to generate an oscillating magnetic field by toggling an electromagnet on and off. These electromagnets require higher voltages (12V - 24V) and currents so I cannot connect it directly to an Arduino. Hence I was looking into relays or transistors which could toggle the electromagnet circuit at high frequencies.

Can you provide more detail please - what electromagnets? Datasheets? How strong a magnetic field do
you want? What are you actually trying to do?

The inductance and eddy-current losses will be crucial to the viability of this. Normally this is a job for an H-bridge, but if the electromagnets are too inductive you're going to fail before the first hurdle.

nirmalp:
I was planning on starting with this electromagnet once I receive it, which also contains its datasheet:

Round Electromagnets With 24 Volts- Shop The Highest Quality Electromagnet Manufacturer Now | APW Company

No, that's entirely inappropriate - this has a soft iron core for maximum magnetic force and hence will have massive eddy current losses at ac and a high inductance. You'd be lucky to reverse that more than once a second, the "not a quick release" and "DC" in the description ought to be a clue there.

For now, I want to stick with the above electromagnet and be able to create the oscillations by controlling them with the arduino. So the H bridge idea should be good.

Can you be explicit about what you are trying to do please, it really will make a difference to whether we can offer any advice, currently all we have are "400Hz" and "oscillating magnetic field".

Perhaps that's not the way to achieve your goal, which you've not told us yet.

nirmalp:
My end goal is to apply an oscillating magnetic field to some magnetic beads and make them vibrate back and forth. I do not know how strong of an electromagnet I would need yet, so I would like to first get them to vibrate as a start.

That seems to require a "horse shoe" shaped magnet. so the particles can move between the magnetic poles. The magnet you ordered has the poles on opposite sides of the magnet. I doubt you will ever be able to get particles to move that way and that far.

Paul

nirmalp:
My end goal is to apply an oscillating magnetic field to some tiny magnetic beads and make them vibrate back and forth. I do not know how strong of an electromagnet I would need yet, so I would like to first get them to vibrate as a start.

Magnetic beads as in pre-magnetized, or magnetic as in ferromagnetic? Please provide links to decent descriptions of every piece of hardware you mention, or this will take all week.

You know there are no magnetic monopoles? Put a magnet in a reversing magnetic field and it might spin round,
but its not going to "vibrate back and forth"

Unmagnetized magnetic materials in a non-uniform field are attracted towards the strongest part of the field (irrespective of polarity).

Normally if you want to achieve vibratory motion using a magnetic field you use a fixed magnetic field
and an alternating current through a wire or coil.

Mark is quite right. An eloctromagnet is not what you need. A coil, generating an alternating magnetic field IS.

AJLElectronics:
Mark is quite right.

He makes a point of it. :grinning: