Does this sort of device exist?

I was wondering if you could buy a sort of "timer" that switches the direction of an electrical current at certain time increments. My intended setup is the following: I have a coil of wire with both ends hooked up to some sort of power source (a set of batteries, an adapter plugged into a wall... show more I was wondering if you could buy a sort of "timer" that switches the direction of an electrical current at certain time increments.

My intended setup is the following:
I have a coil of wire with both ends hooked up to some sort of power source (a set of batteries, an adapter plugged into a wall socket). When applying a current through the wire, the solenoid should create a magnetic field. However at a certain time, the current should switch directions, creating a magnetic field in the opposite direction.


For a duration of time, I need a current travelling through one direction of a conductive wire, and after the time increment (which can be adjusted via the device im inquiring about) is over, the current should switch directions. Essentially, all the device should do is switch the leads of the wire to connect it to the opposite ends of the power source, except do so at certain times.

Also, the device should switch the current direction within a very small time period, perhaps even several milliseconds. I am not sure if such a thing exists, but if it does, could any of you send me a link of where to find one? thanks.
2 answers 2