Pages: [1]   Go Down
Author Topic: Micro-solenoid not working?  (Read 320 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have bought a small 5V solenoid, which is supposed to work with the Arduino without requiring an external power source. The problem is that I do not get it to work. This is probably because I made some mistake, so I want to know what my mistake is.

To be honest, I know very little of solenoids, other than that they perform linear motions by means of electromagnetic force. I have tried treating the solenoid as if it were a simple motor, but performing a linear motion instead of a rotational motion. With the use of a NPN transistor, a diode, and a 2.2k ohm resistor, I get the motor to work... But not when I try to put the solenoid in its place.

I did notice something, though: when I connect the solenoid directly to the +5V power source and the ground of the Arduino, the solenoid moves "to the other end" in an instant. Then, when I remove the +5V power source, the solenoid withdraws. I can repeat this, but this is probably due to negative voltage spikes, which can potentially damage my Arduino, so I have tried to avoid repeating it.

This gave me an idea. The NPN transistor circuit, which is used to control a simple mini motor, can perhaps be used to control a solenoid by turning it on and off quickly enough to make it move rapidly. However, even then, the solenoid does nothing.

What am I doing wrong?

P.S. I am more or less new to Arduino and microcontrollers in general, but I am not new to programming.
« Last Edit: June 30, 2014, 02:03:47 pm by ArtificialUser » Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 67
Posts: 3675
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The arduino digital I/O pins can provide 40mA max and to ensure that your arduino has a long life, it's recommended that you not exceed half of that. It sounds as though your solenoid needs more power - you'll need to use your transistor to switch the 5V supply directly rather than trying to run it off one of the pins.

It's possible too that you've already damaged the pin you were trying to use - might be worth testing it with an LED and suitable resistor.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot for your response.

The arduino digital I/O pins can provide 40mA max and to ensure that your arduino has a long life, it's recommended that you not exceed half of that.
I know. I will try to be careful with it.

Quote
It sounds as though your solenoid needs more power - you'll need to use your transistor to switch the 5V supply directly rather than trying to run it off one of the pins.
But this is what I am trying to do by using the transistor circuit. The pin (digital pin 9) simply controls the flow of electricity, since it is connected to the base of the NPN transistor (using a 2.2k ohm resistor).

Quote
It's possible too that you've already damaged the pin you were trying to use - might be worth testing it with an LED and suitable resistor.
I do not think so. It still works when I use the same pin for running a small motor.
« Last Edit: June 30, 2014, 02:03:39 pm by ArtificialUser » Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 67
Posts: 3675
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The playground has a circuit for solenoids: http://playground.arduino.cc/uploads/Learning/solenoid_driver.pdf. Don't forget the diode.

Quote
I did notice something, though: when I connect the solenoid directly to the +5V power source and the ground of the Arduino, the solenoid moves "to the other end" in an instant.

That's expected behavior.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The playground has a circuit for solenoids: http://playground.arduino.cc/uploads/Learning/solenoid_driver.pdf. Don't forget the diode.

Quote
I did notice something, though: when I connect the solenoid directly to the +5V power source and the ground of the Arduino, the solenoid moves "to the other end" in an instant.

That's expected behavior.
Thanks for the link. I have tried to implement it. It seems to "work better" [not sure whether you can really call it that way], since it actually does something in the transistor circuit now. However, it still only does something when turning the power on and off, i.e., plugging in and removing the USB cable; changing the signal to the base from HIGH to LOW, or vice versa, does nothing, though.

What does this mean?
« Last Edit: June 30, 2014, 03:07:24 pm by ArtificialUser » Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2501
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

However, it still only does something when turning the power on and off, i.e., plugging in and removing the USB cable; changing the signal to the base from HIGH to LOW, or vice versa, does nothing, though.

What does this mean?

It means you should post a schematic (or drawing) so we can see how you have things hooked up.

Do you have a link to the solenoid you're using?
Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12048
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Directly connecting a solenoid to an Arduino pin risks destroying the Arduino - never do
this without using a schottky freewheel diode.

Typically a solenoid needs something like 500mA to 2A, so I'd be sceptical you can
drive one from 30mA or so.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 1
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It means you should post a schematic (or drawing) so we can see how you have things hooked up.
I am going to work on that right away.

Quote
Do you have a link to the solenoid you're using?
Yes. This is the one I am using: https://www.sparkfun.com/products/11015

Quote
This smaller solenoid is designed to work directly with 5V which makes it a great match for embedded projects.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a drawing of my breadboard configuration:



Not the best drawing, I know. But I hope it is meaningful enough.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have tried some more variations. I have also tried adding an external power supply with 4 AA 1.5V batteries. I am sure this should be enough for a small solenoid like this. But this did not work either. This is probably because the configuration itself is wrong. I still cannot figure out what is wrong with it, though.

It just does nothing. And I am sure the solenoid is not broken. My configuration must be wrong.
Logged

Pages: [1]   Go Up
Jump to: