5v solenoid and arduino // Tip120 system

I did some research to drive a 5v solenoid with the tip120 the n4001 diode and an arduino to do something simple as the blink sensor.

It 'arms' itself but that's it. It doesn't 'unarm' itself.

I would like to give it a fast on/off sequence based on milliseconds or other possible way.

Pictures : http://www.dewildequinten.be/11.JPG
http://www.dewildequinten.be/12.JPG
http://www.dewildequinten.be/13.JPG

Code:

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(8000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(8000); // wait for a second
}

Picture? Schematic? Code?
Solenoid example:

CrossRoads:
Picture? Schematic? Code?
Solenoid example:
Solenoid - 5V (Small) - ROB-11015 - SparkFun Electronics

Update!

Nobody an Idea?

I'm not sure what your question is, tbh.

Forget the Arduino logic and the transistor and the diode... when you put 5V across the solenoid and take it off again, does it shoot in and out?

If that's not working then that's one question; if that is working, but doesn't do that with your Arduino based way, that's a different question.

You can't really expect anyone to unravel your circuit from the photos. But on the face of it, if your transistor base is simply connected to pin 13 then yeah I guess the solenoid should "blink".

Ooo hang on, I think you might have the diode the wrong way round... looks like you have cathode to collector and anode to positive. That makes sense on the face of it, but this diode is supposed to be back to front, cathode to the positive supply. EDIT- Look carefully at the pic Crossroads posted a bit above.

JimboZA:
I'm not sure what your question is, tbh.

Forget the Arduino logic and the transistor and the diode... when you put 5V across the solenoid and take it off again, does it shoot in and out?

If that's not working then that's one question; if that is working, but doesn't do that with your Arduino based way, that's a different question.

You can't really expect anyone to unravel your circuit from the photos. But on the face of it, if your transistor base is simply connected to pin 13 then yeah I guess the solenoid should "blink".

Ooo hang on, I think you might have the diode the wrong way round... looks like you have cathode to collector and anode to positive. That makes sense on the face of it, but this diode is supposed to be back to front, cathode to the positive supply. EDIT- Look carefully at the pic Crossroads posted a bit above.

The solenoid works.

I switch the diode two ways, with the ring to the transistor it gives me nothing, other way around also nothing.

Post a schematic of how you connected: those photos are about impossible to follow.

Where's the solenoid getting the 5V from btw?- not from Arduino I hope.

If I connect my resistor to my arduino directly it works, when theirs a wire between it just to lengtify it.
It doesn't work. Common madness????

Now my solenoid works but gets hot, after 20 seconds it gets hot but still touchable?

Now another thing, when I put the same wiring over to my trinket. It just goes on/off superfast.

even when changing the delay on my sketch it doesn't change?

Hi, can you tell us YES or NO, are you getting the 5V for the solenoid from the 5V on the arduino?
If yes, then stop, you need a separate 5V supply for the solenoid.
Also, a schematic is a circuit diagram, even a picture of a hand drawn circuit would help.

Tom.... :slight_smile:

Why can't you feed it from the 5v of the arduino? I mean, if there's a transistor in the middle.

I'm pretty new to all this, just asking

Hi, yes you can control the current to the solenoid with the arduino and a transistor, however the current supply that runs through the solenoid and the transistor must not be from the arduino but a separate supply with enough current to actuate the solenoid.

Also what is the spec of the solenoid, how much current is it supposed to draw?

Please can you post a picture or CAD drawing of your circuit diagram, the pictures are a great help, just that you look to be powering the solenoid from the arduino.

Trouble shooting is a logical, systematic process to solve problems quickly and EFFICIENTLY, a circuit diagram will save soooo many replies, ours and YOUR tme.

Thank you
Tom.. :slight_smile:

Hi,
I am not opening new thread, as I am playing with the similar circuit, but I use different transistor (I tried also TIP122).
Ihave 12V solenoid which I want to supply from 12V lead acid battery.
Open circuit battery's voltage: 12.86V
When I connect the solenoid to the battery directly, it draws 0.33A, voltage measured on solenoid is 12.52V

But when I switch the solenoid via the transistor BD237 (see schematic attached), then the voltage measured on solenoid is only 10.5V. But when I disconnect the load (solenoid) and keep the transistor active (turned on) - then the voltage is ~12.86V - so the same as on battery without any load. Why there is so much voltage drop via the transistor?

Sorry, I am a newbie and I knows only very basics about the transistors. When I check the specification of BD237, then there is Ib specified as 1A dc. Does it mean it needs 1A current for "fully turn on"?
Before I tried this BD237 I used also TIP122, but I also had large voltage drop.
Can anybody help me what I am doing wrong? Is it enough when I put 1K resistor before the base of the BD237 / TIP122 and use 5V from the arduino's pin? Ib of the TIP 122 is specified as 120mA. Arduino's pin can supply 5V and via 1k resistor the current will be 5mA --> is this enough? Is this the source of my problem?

i started my design using this simple Tip120, then i thought i could be more sophisticated so i went for the L298N so i can use the enable pin. but it seems the it is not clear to me how to connect the solenoid, is the output of L298n similar to the collector of the TIP120? and i connect the other terminal of the solenoid o the power supply ? ::slight_smile: ::slight_smile:

The L298 puts out a voltage across two pins (or two pairs of pins actually, since it can drive 2 motors). A motor (or I suppose, a solenoid) is connected across pins 2 and 3 or 13 and 14.

The output on those pins is at the voltage supplied on pin 4 (+) and 8 (gnd) (less at least 2v drop, maybe even 5v drop), in response to and of the same polarity as the signal on pins 5 and 7 or 10 and 12, which respectively need enabling on pins 6 or 11.

The attached pic shows 2 motors on a 298.

2 motors L298 small.png

thank you JimboZA for you swift response, will try do implement that, and what about the protection diode ? i assume it is required since it is an inductive load. so will it be connected between the outputs pins too?

Iirc, the 298D has flyback diodes built in, so if yours isn't a "D" then yep I guess you'll need them externally. I've only ever used a 298 on a shield where all the extra stuff was taken care of anyway.