Continue to Site

### Welcome to our site!

#### Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Status
Not open for further replies.

#### m2j8

##### New Member
Hello,
I am using an ATmega8 to open and close a solenoid valve.

The transistor I am using is a TIP120(https://www.electro-tech-online.com/custompdfs/2009/07/tip120.pdf), this is the most appropriate one I could find in the lab that I'm in.

The solenoid needs 12V and draws 500mA.
The ATmega8 port specs are IOH = -20 mA, VCC = 5V

1. Ive heard that I need a protection diode in parralell with the coil, however
I have never done anything like this before and have no idea what kind of diode will suite the job. Could anyone please assist?

2. What kind of base resistance do I need? And are any other resistors needed in the circuit?

3. I will be using a 12V supply. Will the transistor have a voltage drop?? If so, will the solenoid not function correctly? Hope thats not too much of a dumb question.

Thank you

The transistor I am using is a TIP120(www.learn-c.com/tip120.pdf), this is the most appropriate one I could find in the lab that I'm in.
That'll work OK.

I have never done anything like this before and have no idea what kind of diode will suite the job. Could anyone please assist?
A 1N4001, 1N4002, 1N4003, etc in parallel with the coil will work. Point the cathode at the +12V supply rail.

2. What kind of base resistance do I need? And are any other resistors needed in the circuit?
Even though the TIP120 is spec'd for a minimum Beta of 1000, I would assume 250 so you'd need 2ma of base current. Find out what the VOH of the ATmega8 port is with -2ma of draw or more. Then apply this formula:
R = (VOH - Vbe) / 2ma. Where Vbe is the TIP120's base emitter voltage drop which you can assume to be 1.4V. So if VOH = 4V then R=(4-1.4)/2ma = 1300Ω so choose the next lowest std value of 1200Ω or even 1KΩ.

I will be using a 12V supply. Will the transistor have a voltage drop?? If so, will the solenoid not function correctly?
The transistor will drop a bit of voltage. Apx 0.75V according to the chart in the datasheet you posted. That'll leave plenty for the solenoid.

Last edited:
Thanks for your help, it's working

I have one more problem.
I will be using a 12V car battery in this setup. The first soilenoid that I tried worked with no problems (despite the voltage drop across the transistor). However the second solenoid that I used does not work usless it is supplied with over 11.5V.

Is there a way using electronics to compensate for the voltage drop across the transistor and give the solenoid 12V?
Thanks

Last edited:
You'll probably find the car battery supplies more than 13V (whilst the car is idling). So unless you're using a Voltage Regulator for the solenoid, it should be enough. What's the solenoid used for?

-Tom

However the second solenoid that I used does not work usless it is supplied with over 11.5V.
It sounds like that solenoid would be unreliable even if you supplied it with 12V. You need something with more headroom for wiring losses, circuit aging, temperature changes, etc. I would expect the solenoid to work down to 10V or so to be reliable on 12V.

...However the second solenoid that I used does not work usless it is supplied with over 11.5V...
That is not a "12V solenoid". I'm guessing that it is actually a 24V solenoid.
Most relay/solenoid type devices pull-in at a voltage about 1/2 to 2/3 of what they are rated for.

To lower the saturation voltage across the transistor, replace it with an NFET. There are lots of NFETs that can be driven with a 5V gate signal, and have an ON resistance of a few tens of mΩ. At 500mA Drain current, the Drain-to-Source voltage would be ≤ 10mV.

The resting voltage of a lead-acid car battery is ~12.5V. With engine running, the battery voltage will be 14 to 14.8V

Last edited:
Status
Not open for further replies.

Replies
6
Views
756
Replies
8
Views
3K
Replies
10
Views
1K
Replies
6
Views
2K
Replies
20
Views
7K