I am working on a project where I need to control four different electromagnets at the same time. I also need to be able to vary the amount of current to each magnet to vary the forces from them. I already found some magnets that will work for my project, but I am still fairly new to this process. What other hardware do I need other than a microcontroller? Also, what would be the best microcontroller to use? I am currently planning on using the Arduino Leonardo. It seems like I may need to use MOSFET's also, but I am not entirely sure. Any help would be greatly appreciated.
I am working on a project where I need to control four different electromagnets at the same time. I also need to be able to vary the amount of current to each magnet to vary the forces from them. I already found some magnets that will work for my project, but I am still fairly new to this process. What other hardware do I need other than a microcontroller? Also, what would be the best microcontroller to use? I am currently planning on using the Arduino Leonardo. It seems like I may need to use MOSFET's also, but I am not entirely sure. Any help would be greatly appreciated.
Thanks!
No help available with the limited information. How much current does each magnet require? How much do you need to vary the current? How often? What voltage will the magnets be operating with? How big is your power supply?
I need max 3W of power and the power supply is a large external battery that's not an issue as this is just an embedded system. I need to be able to vary the current from completely on to completely off and then a full range in between those two. I will need to vary it fairly often with a response time of under 125 ms which also shouldn't be an issue. Also, each of the magnets is 12V.
Correct! The Arduino I/O pins are rated for 40 mA (0.04 Amps) absolute maximum. They are "signal" pins and they can't really "power" anything other than a regular-small LED.
Of course your power supply also has to supply the required voltage & current.
What's the voltage & current rating on the magnets? 3 Watts at 12V is 250mA (12/3) so a MOSFET rated at 1A or more would be fine and you might not need a heatsink. If you're powering all 4 at once you'll need a 12V power supply rated at more than 1A to power the 4 magnets plus the Arduino, plus some safety margin.
The MOSFET has to be rated for the required current (Amps). Voltage isn't usually a problem, but if the magnets require more than 24V it would be a good idea to check.
Even with a high-enough current rating you'll probably need heatsinks on the MOSFETs.
The MOSFET should be "logic level", which means you can turn it fully-on with 5V from the Arduino. Standard MOSFETs require more. (On the MOSFET datasheet this is VGS.)
The Leonardo has 7 PWM pins which can be used to vary the average voltage and control the strength of the magnets. Typically, PWM is used to control motor speed or the (apparent) brightness of an LED. PWM will work through the MOSFET driver. [u]analogWrite()[/u] is NOT true analog. It's PWM which is MUCH BETTER in this application.
I need max 3W of power and the power supply is a large external battery that's not an issue as this is just an embedded system. I need to be able to vary the current from completely on to completely off and then a full range in between those two. I will need to vary it fairly often with a response time of under 125 ms which also shouldn't be an issue. Also, each of the magnets is 12V.
The real issue is: did you get electromagnets with a core that will allow switching at the speed?
I am working on a project where I need to control four different electromagnets at the same time. I also need to be able to vary the amount of current to each magnet to vary the forces from them. I already found some magnets that will work for my project, but I am still fairly new to this process. What other hardware do I need other than a microcontroller? Also, what would be the best microcontroller to use? I am currently planning on using the Arduino Leonardo. It seems like I may need to use MOSFET's also, but I am not entirely sure. Any help would be greatly appreciated.
Thanks!
Please provide links/datasheets for all the hardware involved - which electromagnets? Are they suitable
for PWM drive (not all are). If they need analog drive that's a whole different game.
"What's the best microcontroller to use?" - no way to begin to answer that without knowing all the hardware
and functionality involved in the project.