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.
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?
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
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?
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.
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