arduino and electromagnets

hey all,

i need to setup a variable electromagnetic voltage that can be controlled via Arduino, or in other words-- i need to connect an electromagnet to my Arduino board and be able to control its voltage via sensor input or manual messages sent to the board. can anyone please give me a hint for achieving such setup?

your advise will be much appreciated!

A pwm output to a mosfet transistor that drives the electromagnet coil, maybe?

there is a solenoid schematic in the "Playground"- check that out. It is essentially what you need. As Madeleine says, a MOSFET will work too. The first thing to find out is what kind of current/voltage you need to switch, and that means getting the electrical specs for the electromagnet.

D