I'm clueless when it comes to electronics so bear with me.
I want to control the intensity and polarity of a series of electromagnets (at the same time if possible) on an ATmega328 microcontroller and I cannot figure out the setup. Can anyone help me? Where do I start even? What pins do I use?
Do I need a driver, a darlington transistor array or a mosfet transistor array, or a H-brigde? I don't know the difference...starting at the beginning.
Each electromagnet is powered with a 12V DC power supply, consumes 3 watts, and has two connecting leads.
I'm clueless when it comes to electronics so bear with me.
I want to control the intensity and polarity of a series of electromagnets (at the same time if possible) on an ATmega328 microcontroller and I cannot figure out the setup. Can anyone help me? Where do I start even? What pins do I use?
Do I need a driver, a darlington transistor array or a mosfet transistor array, or a H-brigde? I don't know the difference...starting at the beginning.
Each electromagnet is powered with a 12V DC power supply, consumes 3 watts, and has two connecting leads.
Any help is greatly appreciated.
To do what you want you would have to treat the electromagnets as simple DC motors and drive them with a H-drive motor shield or module. Then there would be a 'direction' arduino output pin to determine the polarity of the magnet and a arduino PWM output pin to determine the intensity 0 to 100%. What pins you use depends on the motor driver you use and of course the motor driver has to be rated for better then the voltage and current rating of your magnet.
3W at 12V implies 0.25A per electromagnet which is well within the capabilities of small H-bridges, a multi channel motor
driver shield would seem to be the best fit if you need polarity reversal.
What is the maximum number of 12V electromagnets do you reckon I can run off this shield? I was hoping for at least 3-4....but I see it says you can control two DC motors with this....is that the same for electromagnets?
Also I was hoping to run an RGB LED strip off the same microcontroller. I've been told it uses two SPI pins and two Power pins. Is this possible? I've attached the pins list - maybe someone can help me figure out if there is enough space for these?
What is the maximum number of 12V electromagnets do you reckon I can run off this shield? I was hoping for at least 3-4....but I see it says you can control two DC motors with this....is that the same for electromagnets?
One H-bridge per DC-motor, one H-bridge per electromagnet, one H-bridge for every bidirectional load.
Dual motor driver boards/shields are quite common, I think there are a few quad driver boards though - you'll
have to look for them. google "quad motor driver" perhaps?
Also I was hoping to run an RGB LED strip off the same microcontroller. I've been told it uses two SPI pins and two Power pins. Is this possible? I've attached the pins list - maybe someone can help me figure out if there is enough space for these?
You have no pins for the electromagnets. That's not your list is it? For LEDs you need clock/data (they will be 12V strips
I suspect), and any pins will do (using SCLK/MOSI happens to be convenient for high-speed use)
Increasing and decreasing the intensity will be of most importance...
What are you actually trying to do with these electromagnets ?
The normal PWM strategies for controlling electric motors are not necessarily going to give you a good
outcome with electromagnets, if you have no understanding of how it all works.
Yes, this is an issue - electromagnets usually have solid iron cores rather than laminated,
so eddy-current losses are large, so PWM drive will heat up the iron core (lower PWM
frequency will help - mains frequencies for instance are often used with solenoids and relays,
but generate a very obvious buzzing).
Are you planning to reverse the magnetic direction of these electromagnets at all ? If not, then you don't need an H-bridge.
You are very keen on varying the intensity. You may be disappointed with the outcome there, because of the way that
electromagnets behave. Are you trying to pick things up ?
If you want to vary the electromagnet current, the best approach would be to find a suitable transistor to implement
linear current control. A big audio transistor would probably be the best place to start looking.
Are you planning to reverse the magnetic direction of these electromagnets at all ? If not, then you don't need an H-bridge.
He did state:
I want to control the intensity and polarity of a series of electromagnets (at the same time if possible)
You are very keen on varying the intensity. You may be disappointed with the outcome there, because of the way that
electromagnets behave. Are you trying to pick things up ?
If you want to vary the electromagnet current, the best approach would be to find a suitable transistor to implement
linear current control. A big audio transistor would probably be the best place to start looking.