Arduino Board to drive a series of Electromagnets

Discussion in 'Embedded Systems and Microcontrollers' started by mikeysela, Nov 6, 2010.

  1. mikeysela

    Thread Starter Member

    Jul 24, 2010
    87
    1
    Hello people,

    I would like to use an Arduino micrcontroller and its 6 PWM digital output pins to deliver current to a series of electromagnets. From the Arudino specs, I can only output max 50mA current from the pins (obviously not much more than that). How can I amplify the current coming out of each of these pins to provide enough rated current to my electromagnets?

    Thank you kindly,

    M
     
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    This is a job for Transistors.

    What you need is a "driver".

    Depending on the current you are looking at using, there are a myriad of selections.

    One good option for this type of driver is a Logic Level MOSFET.

    The arduino speaks "Logic Levels". The MOSFET can be switched on and off with a arduino PWM pin to use current from the power supply instead of the arduino.

    This way you are only limited by the MOSFETs current specs, not the arduinos.

    However it all comes down to how much current each magnet draws. How much current DOES each magnet draw?
     
  3. mikeysela

    Thread Starter Member

    Jul 24, 2010
    87
    1
    Thanks for the reply retched.

    I will find out the current ratings of the magnets soon. In the mean time, just to clarify something, How would I use the PWM outputs for this? Do i just program the duty cycle of the outputs to the desired voltage ratings of these
    magnets? From what I understand about what you said, I would just use the PWM outputs to ensure I have a logic level 1 for the mosfet, and then it can use the current form the power supply. How do I control the exact amount of current to my magnet then? Would not the PWM outputs themselves give me that control over the current levels?

    Thanks very much again.

    M
     
  4. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    The arduino's maximum output current limits the maximum switching frequency if the MOSFET is driven directly by the arduino's output.

    fmax=Iomax/Qg

    fmax=maximum switching frequency (Hz)
    Iomax=maximum output current of arduino's (A)
    Qg=MOSFET total gate charge (C)
     
  5. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    mikey, I think you may be confused.

    Do you know what PWM is used for?

    What is the reason you want to use it for your magnets?

    There may be better ways to do what you want. What EXACTLY are you trying to do?
     
  6. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    If the magnets are only on/off, then all that is necessary is a driver that can supply the necessary current at whatever voltage the magnets use. Some inexpensive FET may be all you require.
     
  7. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    True. I should have went more in depth.

    A MOSFET driver in addition to the arduino would be needed to maximize the potential of the MOSFET.

    Without knowing the requirements of the project, and the magnets specs, we cant design a driver circuit for them.
     
  8. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    If you want a current, which is always constant, through the magnet use a resistor in series with the magnet coil. However, this is not very efficient. If you want to vary the current while the magnet is operating then use PWM.
     
  9. mikeysela

    Thread Starter Member

    Jul 24, 2010
    87
    1
    OK, let me be more clear , my apologies guys. I want to explore 2 options:
    1. Supplying CONSTANT current to a series of magnets at the rated current and voltages of these magnets from the output pins of an Arduino board. This action and the time it takes place will occur depending on a program written in the arudino software.
    2. Supplying a VARYING Current at specific time instants which I will control through software as well.

    Questions about this:
    1. Is it possible to deliver varying levels of current to a magnet in order to control the intensity of the magnetic field it is producing?

    Basically, the idea of the project is that I would like to place a series of magnets on a surface, and depending on the amount of current and which magnets will receive that current at any instant of time, will determine the force exerted by the pad onto a device sitting on top of it.
     
  10. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Then use MOSFETs to control the magnets and PWM from the Arduino to control the current through the magnet's coil. You will need a means of current feedback as to control the current accurately.
     
  11. mikeysela

    Thread Starter Member

    Jul 24, 2010
    87
    1
    Can you be a little more specific about that? Maybe a diagram ? thanks very much
     
  12. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
  13. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
    You will need a reverse bias Schottky Diode across the coil - aka a snubber.

    PWM with an inductor works to allow an average current to flow.

    During the on phase the current builds a magnetic field.

    During the off phase, the magnetic field collapses while the inductor conducts through the snubber.

    Without the snubber the coil would raise up a high voltage of CEMF.

    If you understood all of this already then that is fine, but I thought I might as well make certain that you were aware.
     
  14. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
  15. mikeysela

    Thread Starter Member

    Jul 24, 2010
    87
    1
    Not quite i do not think. What I am trying to do is place a series of electromagnets on a mouse pad, and be able to use force feedback onto a users hand as he is using the mouse using the magnetic fields produced when i drive the magnets with currents. Any suggestions on the best method of doing this?
     
  16. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    What are you planning to mount inside the mouse that will react to the magnetic fields?

    hgmjr
     
  17. mikeysela

    Thread Starter Member

    Jul 24, 2010
    87
    1
    just an iron core.
     
  18. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Then you don't really need a current feedback since accuracy is not very important. It is important to be able to change the vibration power, thus you need to use PWM to do this. You will need to generate a high frequency PWM signal which will be modulated by a lower frequency square wave (vibration frequency).
     
  19. mikeysela

    Thread Starter Member

    Jul 24, 2010
    87
    1

    Can I achieve this with the outputs from the Arduino board? I am not sure how what you mean, since I know I can just change the frequency of the PWM signal to change the average voltage of if it.

    Thank you.
     
  20. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    There should be no problem using the 6 PWM outputs to drive your electromagnets. You will need however to put a MOSFET or BJT between the output of the Arduino and the electromagnet to achieve the drive level needed.

    hgmjr
     
Loading...