I'm a French student and today I have to control some magnetic things with an Arduino. It seems to be electromagnets, but I'm not sure, since I'm a complete novice to electronics.

I saw some StackExchange answers that helped me a bit, but I can't really figure what to do exactly without frying my Arduino.

The datasheet of the magnetic thing is here.

Wired to a AA battery, it worked, and I don't need much more power, so I think that the Arduino could power it, nope?

Do I have to make a montage like this, or can I make a more simple one? If you do need precisions.


Here's the detail of the solenoid you linked: -

enter image description here

It appears to need 6V and with a resistance of 32.7 ohms will take a current of 183 mA.

Wired to a AA battery, it worked, and I don't need much more power, so I think that the Arduino could power it, nope ?

You were lucky to make it work from what I believe you are saying is a 1.5 volt AA battery. You need to provide it with 6 volts and to do this I'd use a logic-level n channel MOSFET. Off-hand I can't remember what GPIO pins produce on an arduino but assuming it is 5V, connect the GPIO pin to the gate of the MOSFET, the source connects to 0V and the drain connects to the solenoid and the other side of the solenoid connects to a 6 volt supply. You'll also need a protection diode across the solenoid to prevent back-emfs frying the MOSFET and potentially frying the arduino's output pin to the MOSFET's gate.

enter image description here

Maybe try a BSS138BKW MOSFET it can supply over 300 mA, is rated at 60V and has an on-resistance of typically 1 ohm.

| improve this answer | |
  • \$\begingroup\$ Thank you for your fast answer. About the MOSFET, I have this : C1815. That should do it. About the supply and the GND, I wire this to Arduino's pins ? \$\endgroup\$ – Uinelj May 28 '14 at 9:32
  • \$\begingroup\$ The "supply" should be 6V - if you haven't got a 6 volt supply then maybe it might work at 5 volts but the extra current "stolen" from the arduino's power supply may cause problems to the arduino as will possibly the glitching on the 5 volt supply when the solenoid is turned on and off. The C1815 is unsuitable for use - it is a BJT with maximum current capability 150mA - don't use it, don't even think about using it. \$\endgroup\$ – Andy aka May 28 '14 at 10:13
  • \$\begingroup\$ I would recommend to use a separate power supply for the solenoid and use something like an analog switch IC to switch the solenoid using your arduino. \$\endgroup\$ – Handoko May 28 '14 at 10:58
  • \$\begingroup\$ @Handoko I appreciate you chipping in but maybe you can give your reasons for recommending a separate supply (if they are different to the ones I list) and because analogue switches are normally not suitable for this type of application, it would be useful to state which ones are suitable - most would fry and the OP may not appreciate that (but a few would be OK). \$\endgroup\$ – Andy aka May 28 '14 at 11:02
  • \$\begingroup\$ Do I really need an external power supply for a thing a 1,5V AA battery can supply ? :( I asked other transistors and I now have 2N222A in my hands. Does this work ? Sorry for these newbie questions, but I don't even understand what a transistor is. \$\endgroup\$ – Uinelj May 28 '14 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.