PWM / AD0 question

Thread Starter

Klipeti

Joined Nov 25, 2012
18
Hello!
I am using Ecio40p microcontroller to control voltage with PWM / AD ports.
I attached a picture of how I connected the ports.

My question is, that where/how I use the controlled voltage? Voltage is measured over C1, controlling voltage works like charm.
Do I connect the led or something right after C1, but before ground?
 

Attachments

tubeguy

Joined Nov 3, 2012
1,157
You could connect an LED with a series current limiting resistor directly between the AD0 output and ground provided the MCU output can provide enough current and voltage. But your circuit uses a 4.7k resistor which will not provide enough current to turn on an LED. You could modify your circuit with a proper size (smaller value resistor) to drive the LED.

What is the MCU power supply voltage?
How much current can the MCU port supply?
Do you know how to calculate LED current limiting resistors?

A better way is to use a buffer circuit like this op-amp voltage follower. The voltage follower can provide additional current and isolates the voltage input from the load (LED for example). With a buffer, the voltage range of your existing circuit can be maintained.

 
Last edited:

MikeML

Joined Oct 2, 2009
5,444
The problem with such a simple RC low-pass filter is that it can only drive a very high resistance load. If the load is a high impedance compared to 10k (the R in the RC), then the voltage out is proportional to the duty-cycle of the pwm waveform. The ADC input resistance is high enough for it to work.

However, if you shunt the C (to ground) with a low impedance (like a LED and current limiting resistor), then that will interfere with the proportionality described above.

As pointed out, an Op-Amp connected as a voltage-follower (look it up) will drive the LED without the input of the voltage follower loading the RC network.
 

Thread Starter

Klipeti

Joined Nov 25, 2012
18
This is just simple test of voltage controlling with PWM and RC filter.
I thought about making something which is controlled by voltage reference.
Connecting LED was just an example :p

MCU uses +5V, but I'm not sure about the current, I didn't check it out.
I know how to calculate LED resistors, I just wanted to ask that how do I put the voltage to use.
 
Top