noob trying to regulate power of equipment [Solved]

Hi all, I'm trying to regulate the power of an equipment I have here.
Today I do it manually with a regulated DC power supply, but I want to control it with arduino so I can automate the process.
My equipment requirement varies from 3V to 6V and 4A to 6A (it's not a datasheet info, I measured it with a multimeter).
(btw, the "equipment" is a Scania motor semi-electronic diesel injection pump)

I thought a circuit like this would do it:
http://arduino.cc/playground/uploads/Learning/solenoid_driver.pdf
But instead of the transistor in the diagram I bought a TIP140, that can handle 10A.

Before wiring everything to the real power supplies and equipment, I thought I'd make it work first with a led, to avoid burning my brand new arduino 2009 or damage the equipment.
So, in the diagram, instead of a solenoid, I have a led (with a 270ohm resistor). The "SOLENOID Power V+" is 9V.

When I power everything up, the led stays always on, regardless of what I set on the arduino digital out (I'm using digital pin 11). It only varies the brightness, but is always on.
If I set the digital out to HIGH, it gets less bright, if I set it to LOW, it gets more.
I imagined it would switch on and off.

Is this behavior correct? (and maybe I should get another thing to test, maybe a small dc motor)
Or is it wrong? Please advise.

I am a developer and my electronic skills are very limited. So don't be shy to ask to the obvious :slight_smile:

You're sure you've got the pins correct? See the last page of the data sheet.

If so, try putting 2 LEDs in series instead of just 1. There might be just enough leakage thru the Collector/Emitter path to make an LED light up, especially efficient ones. Try putting a current meter between the LED and the collector and see what you get.

Thanks CrossRoads, the pins were wrong indeed. I mixed up everything. I was connecting E-B-C but the correct was like datasheet informed, B-C-E.
It is working fine with the led now.

When I hooked it to the equipment, I think there was some kind of interference and that made the pwm not work as desired.
I'm going to study how to "filter" these so it can work fine. If you have some tips on that, I'll be grateful (again).
But my original problem is solved, thanks.

Do I need to mark this topic as "solved" somehow? How?

Sure, how's that look?
Just go to your original post and select Modify & change the title.

Do you want a PWM signal going to the solenoid, or a DC voltage level?
If DC, you need to put a lowpass filter on the output of the arduino pin to smooth out the 490 Hz PWM signal so it looks like a DC signal going to the transistor.

For example, scroll down to the bottom of this page
http://sim.okawa-denshi.jp/en/CRlowkeisan.htm

About the "solved", it's good, thanks.

About the filter, I don't understand.
Isn't the PWM supposed to go the transistor, so it can't switch and create the PWM to the equipment?
Wouldn't the filter be placed after the transistor, so it looked like a DC voltage to the equipment?

Anyway, I don't think the equipment will bother with it, I hoped the PWM would seem like a mean DC level to it.

I may be totally off, but I thought the problem was noise on the line that interfered with arduino when I started the pump.
And that I had to decouple it, using something like this:

(got from here: http://arduino-info.wikispaces.com/DC-Motors)

I bought some capacitors and inductor and tried to hook it, but it didn't work. That is, some smoke started to came out of the inductor (I think) and I powered off immediately.

I probably wired something wrong, or bought inappropriate components. Fact is, I'm lost again.

I have some doubts about this..
The capacitor that wraps the motor in the diagram (C2), can it be electrolytic or must be non-polar?
What do I look when buying an inductor? Does they have a current (amps) limitation?
Can you suggest one? The guys from the local electronic shop don't help much :-/
Does the values suggested in the page apply to my use case? (C2=0.1uF; C1=47uF; and L1=1mH)

Thanks a lot for the assistance.

If the motor current is causing power supply problems for the arduino, then you want to have that filtering on the supply to the arduino instead.

So take C1/L1 off the motor supply, and put them between whatever the arduino supply is and the arduino power input pin.

What is the voltage/current rating on the inductor?

Take C2 off and see how C1/L1 do by themselves.

You mention your equipment takes 4 to 6A... Is this steady state current through a motor?

If so expect the start-up currents to be a lot higher - 15 to 50A or so. Explains the inductor getting hot.

I think you might do better with a high-performance logic level MOSFET, rather than a Darlington, for this peak current level. Something logic level with an Rds(on) of 0.01 ohms or less ought to do.

Hi guys, I finally got it working.

I think I was having problems with the TIP140 indeed, as MarkT suggested. I replaced it with a IRF540 mosfet.
I did not found a logic level mosfet at the local electronic stores :-/
I had to add a big heatsink to the IRF540, but is doing the job fine despite that.

Afraid of noise, I read on the internet that it's good to add an opto-isolator, I tried the moc3020 but it didn't work (I think it's not suitable for DC). When I replaced it with a 4N25 it worked fine.

Thanks a lot for you help, arduino and its community allowed me to do what would be impossible for me otherwise.