# Varying Current from 0-270 mA

Hello everyone,

I have a question on how to use the arduino properly. I have a lenses that its focal point can be controlled by giving current varying from 0-270 mA.

Since I'm new to Arduino, I'd like to ask how to do this properly.

I searched before and found that each pin can only produce ~40 mA, which is not enough. Using Op-amp connected to the PIN directly can only produce up to 100 mA (CMIIW) Digital Potentiometer? (Is this the most possible solution, if it is, then any advice on how to use it)

Thank you very much for the advice, appreciate it.

http://www.arduino.cc/en/Tutorial/SPIDigitalPot could be of help if you are going to use a digital potentiometer

I've read that.. but PWM is definitely not the answer, since it's modulating the voltage, then the lenses can't stop on and off because of the 0~5 V modulation.

I'd like to know more about digital potentiometer, where does it take the source current from? thanks for the reply!

can be controlled by giving current varying from 0-270 mA with Voltage 5 V.

I think you have that wrong. You can't vary the current something gives without varying the voltage, it's ohms law. Unless you have some magic fluence that can somehow change the impedance of what you are driving into it. (which is a joke)

Argh,

How stupid I am! you're right... because I=V/R ! yes, until now I have only tested it with supply voltage which is set to 5V, and I vary the current flow through it.. and I didn't notice the change of voltage...

but anyway, do you have any suggestion, varying current from 0-270 mA from arduino?

Do you know what voltage you need to get the maximum current? The only way on an arduino is to use PWM with a filter, see:- http://www.thebox.myzen.co.uk/Tutorial/PWM.html for a discussion on the filter. If 5V is not enough then you can feed the PWM signal through a transistor who's collector resistor is wired to a higher voltage like 12V. However 270mA is a fair amount of current, this will lower the impedance and cause you to use very large capacitors. So maybe you are better off applying the output of the filter to the gate of an FET in a source follower mode to deliver the final current.