how to send different voltages from analog or digital pin

Hi,

I'm working on a fun/self teaching project to learn arduino, what i'm trying to do is send different voltages from any digital or analog port.

My project is : sending different signals according to infrared remote control data, using this infrared sensor i've managed to read infrared signals from my remote http://www.circuitbasics.com/wp-content/uploads/2017/05/Arduino-IR-Remote-Tutorial-IR-Receiver-Breakout-Board.jpg

What i want to do is :

send 0.08v if ir data is 0X0FC6X (shutdown button of remote) from digital pin 7
send 0.7v if ir data is 0XG428 (volume up button of remote) from digital pin 7

and so on. As far as i understand from some schematics i need to use different resistors to produce different voltages or maybe with IRF520,is that right ?

Let's assume that you are using a 328P based Arduino. The output from a digital pin is, by definition, HIGH (about 5 volts) or LOW(0 volts) You can take that value and produce a different value using an external circuit or maybe even a voltage divider network of resistors

The output from an analogue pin is also 5 volts or 0 volts but it is turned on/off quickly with a duty cycle that depends on the value written to the chip. So, its average voltage can range from 0 volts to 5 volts and can be smoothed using external electrical circuits which could be as simple as a capacitor

Depending on the exact requirements of the device using the signal on its input then either method may work.

In the case of your example it may be good enough to simply send a digital (HIGH/LOW) signal to the remote.

sheshman:
As far as i understand from some schematics i need to use different resistors to produce different voltages

That is one option: a number of voltage dividers, but you would need one output pin for each output voltage. Also the load on the output is critical, this can only be supplied to high impedance inputs. If you need any significant current, you need a buffer (e.g. a unity gain OpAmp circuit).

or maybe with IRF520,is that right ?

That's to drive significant power. It won't help you to produce a voltage out of a PWM signal or otherwise.

An alternative is to use PWM and a low pass filter (RC filter) to turn it into a voltage. As above you can only supply this voltage to a high impedance input, so again you may need to buffer it.

Now what are you actually trying to accomplish with those voltages?

As UKHeliBob says, the regular Arduino doesn't have a true-analog output. analogWrite() uses [u]PWM[/u] which can be used to control the speed of a DC motor to make an LED appear dim.

PWM can be low-pass filtered to get analog, but that's usually not the best way to get analog and it's rarely done in "real world" products.

The Arduino Due has a built-in digital-to-analog converter so it DOES have a true-analog-output.

(The regular Arduinos do have analog-to-digital converters for true-analog input.)

thank you guys for your answers now it's much more clear in my head.

i've an old(one of the very first designs) android car stereo in my garage and i'm using the listen music while i'm working on somethings.

unfortunatelly that stereo doesn't have ir remote support but it does support steering wheel button support (it does have KEY1 & KEY2 cables) steering wheel buttons sends different low voltages (like 0,8v for sound down, 0,6v for volume up and so on)

i thought that if i can prepare an ir setup with arduino and if i can send different voltages from one of the output according to remote commands then i can volume up or down without going to other side of the garage :slight_smile: and it would be good lesson for me to advance my arduino skills (as a rookie).

Now, as far as i understand from you guys it's possible but complicated to produce different voltages from digital/analog ports for a rookie like me.

As a workaround what if i control an external power source's voltage with arduino to make it happen?

I don't know if there is a module for this kind of applications, that's why i'll sample with IRF520, as far as i know you are feeding IRF 520 with external power and it's reading potans value on the circuit and sending desired voltage(with help of it's mosfet) to the motor according to potans's position.

Can i program IRF520 (or correct component, i don't know which one, i'm open the suggestions) like :

lower voltage 0.8v if ir data is 0X0FC6X (shutdown button of remote)
lower voltage 0.7v if ir data is 0XG428 (volume up button of remote)

or maybe if i can control LM2596 with arduino ?

one of my friend said it's possible with x9c103s digital potentiometer,i'm doing my research how to use it, are you guys agree?

Mimicking a push button is often best done with an optocoupler.