Output voltage 0-5V

I have to contol aperture in my lens. When i set 5V aperture is full open(HIGH), 0V full close(LOW). I havent find method which allow to set other voltage than LOW or HIGH. Is any method to controll output voltage?

I possess DFRduino Uno v3 .

You need a Digital-to-Analog Converter (DAC) and your UNO does not have one built in.

Either you go for a different arduino board embedding a DAC like the Arduino Zero which has a 10 bit DAC or you need to add an external DAC component like the Conversion Module Tlc5615 or MCP4725 I2C DAC or others

J-M-L:
MCP4725 I2C DAC

I want to make sure, this DAC has output analog voltage 0-5.5V ??(VSS to VDD)

MCP4725.pdf

I'm not sure if there are any Arduinos with a DAC that operate on 5V. The Due, Zero, and most Teensies are 3V3. An opamp could boost the range from 3V3 to 5V5 but the end points may not be correct.

If speed is not a problem then you can use a PWM output and a low pass filter to smooth out the signal. A higher repetition rate and faster response can be achieved with a PCA9685. Adafruit has a breakout board and a nice library for this chip.

This one might be easier to use, being in a 8-pin DIP.

Send it two bytes via SPI.transfer() to create the output level.

If you only need 8-bits (256 levels) of output, then PWM with lowpass filter can be used.
Here is analogWrite of 25, 50,75,100,125,150,175,200,225, 250 thru a 4.7K/10uF low pass filter.

I have to contol aperture in my lens. When i set 5V aperture is full open(HIGH), 0V full close(LOW). I am not sure which module would be the best to generate output voltage from range 0-5V.

  1. SRD-05VDC-SL-C not en www specification pdf

  2. DAC MCP4725 specification pdf

  3. something else...

I need only one output voltage from module.

  1. SRD-05VDC-SL-C not en www specification pdf

That is a mechanical relay, so their is no way it can produce an analogue voltage.

  1. DAC MCP4725

That look like it will do what you want.

Why not try a PWM output thru a low pass filter to start? Can create many levels, see if that is enough granularity.
Here is analogWrite with 0,25,50,75 ... up to 250 as an example.

CrossRoads:
Why not try a PWM output thru a low pass filter to start? Can create many levels, see if that is enough granularity.

I have naver had contact with PWM, is this build-in uno R3?

Yes,

I have naver had contact with PWM, is this build-in uno R3?

See:-

http://www.thebox.myzen.co.uk/Tutorial/PWM.html

Connect your output to one of the pins marked with a tilde (~) - thise are capable of pwm output. Then you can use analogWrite(pin,level) to get the output on the pin. A common filter would be a 4K resistor and a 10uF capacitor to ground. This will give you 0 to 5 volts.

If you read through Mike's linked page, you will understand what's going on.

I wrote simple code and it doesnt work:

  • value 255 - full open, no noise
  • value 10/120/50 - full open and noise form small motor in lens (probably try to set open and close)

I think that lens need constant value of voltage, not square wave.

You need to use that filter to get rid of the square wave.

Look at the picture I posted - nice levels at different voltages, that's what the lowpass filter can do to the output.
I think I used 4.7K and 10uF there.
http://sim.okawa-denshi.jp/en/CRlowkeisan.htm

ok, I try to do low pass fiter tommorow. I hope it works properly.

You can get a nice 0-5volt from PWM...if...you connect a 10Megohm DMM or 1Megohm scope to that.
But when you "load" that voltage with a "lens??", it might collapse.

So what are we driving with that voltage.
You might need some buffering.
Leo..

Low-pass filter did not help.

set 90 - full close and nosie of small motor
set 130 - full open and nosie of small motor
set 255 - full open, no noise

Can I generate constant output voltage from DAC?

That's my lens: spec.

Low-pass filter did not help.

Then you did not implement it correctly did you?

Can I generate constant output voltage from DAC?

What DAC? Normally they do.

That's my lens: spec.

Not a very comprehensive spec because it says nothing about the current the motor draws only the voltage. Did you read and understand the other answers you have had here? If so why are you ignoring them?

Reply #16 said:-

You might need some buffering.

Unless you tell us exactly what you did and what happened all we can do is give you our sympathy.

I have olny male-female connector so I could solely link in that way:

I thnik that is well done.

It was only added to lens info