Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

nice idea to create analog signal from a microcontroller

Status
Not open for further replies.

elrayes

Full Member level 5
Joined
Jun 3, 2008
Messages
244
Helped
20
Reputation
40
Reaction score
7
Trophy points
1,298
Location
Egypt/Canada
Activity points
2,777
Hi all

I have one of posts someone was asking about creating a variable analog signal inside a digital system, where i got couple of ideas about "how to create analog signal for your digital system":
- if your microcontroller has a PWM output then you can use to create an analog signal by connecting a smoothing capacitor between the PWM output and ground, try a 100uF capacitor I think will be good, then you will get a nice analog signal, maybe some ripples will appear but you can just handle this issue by using an RC low pass filter circuit or just increasing the value of the smoothing capacitor but take care from the capacitive reactance effect vs the PWM frequency.
- if your microcontroller doesn't support a PWM, then create a soft PWM using one of the GPIO with delay functions or the timers inside the microcontrollers to create a delay, where you will define your period and, for sure, define the duty cycle and connect the output to the same peripherals previously mentioned.
hope those couple of tips are useful.

--
El-Rayes
 

Connecting a 100uF capacitor from any digital output to ground is a very bad idea!

You should at least use a series resistor to limit the current to safe level. Not only would the charging current be an excessive load on the output, it would discharge back into the pin as well !

Brian.
 

Without a series resistor, the DAC output would show a strong non-linearity. To reduce the PWM ripple effectively without inacceptable response time, a 2nd or 3rd order butterworth low-pass (using one buffer OP) is preferable. The buffer also allows to reduce the filter capacitor size to < 1 uF and use high quality capacitors.
 
thats why I suggested the idea of an RC low pass filter, the resistor will act as a current limiter, thats in case the microcontroller hasn't any current limit element connected to the PWM output, regarding the idea of 2nd or 3rd order LPF with a buffer, its good one but will add more complexity (circuit wise) to the system which I don't prefer, specially if you are an embedded systems specialist (which most of them don't like circuits that much) or still beginner in electronic circuits.
About the 100uf, it depends on the frequency, thus i don't think will be bad idea unless we know the PWM output frequency to calculate the Xc and then we can decide, actually such ideas aren't mine, they are commonly in many other designs, but thanks for clearing the image so anyone going to implement such idea and faced the overload issue he will be able to recognize and address the issue and move to the next solution.
 

What I was telling you is
"between the PWM output and ground, try a 100uF capacitor"
is a bad idea. A series resistor should always be used between the PWM pin and the capacitor to limit the current. If we assume the PWM output is capable of say 20mA sink/source current, the lowest impedance it could continuously drive at a 5V supply would be 250 Ohms which even at a low PWM rate of 100Hz limits the capacitor value to 6.4uF and of course that drops if higher frequencies are used. Using the limited drive capability of a digital output as part of an LPF is not a reliable solution!

The technique is far from new, PWM has been used extensively for many years to create analog voltages. I use it for applications ranging from dynamic braking systems on trains through to speech synthesizers.

Brian.
 

is a bad idea. A series resistor should always be used between the PWM pin and the capacitor to limit the current.
elrayes clarified, that he intends to place a resistor. It hasn't been clear in the first post, I think.
The technique is far from new, PWM has been used extensively for many years to create analog voltages.
Yes. But new designer generations have to discover it a new. As an additional comment, from the switching speed to response time respectively low-pass filter cut-off relation, first order sigma-delta modulation is more effective than PWM for a one-bit DA.
 

But PWM is lot easier and now a days its present in almost all MCU's

however is there any soft code avlaible for sigma-delta modulation specially for speech synthesizers..
 

Thats was my point from using a resistor, which I cleared in my second post, however some of the MCU are already designed with internal elements to prevent this as I mentioned before, which already worked out with some people, frankly I like easy designs and minimizing the number of components and circuits used sometimes its first thing i focus on.
as FvM mentioned, from my teaching experience the past few years and supervising many other projects, discovered that most of the new generations and young engineers aren't aware with all PWM usages and applications you play with, so I thought to write them something as a tip, actually i was inspired by another post someone was asking something similar.
about the one bit delta-Sigma D/A for sure its much better but PWM is more available on MCU and even you can create it by coding if the MCU doesn't support PWM, which make it cheaper and easier (from implementation point of view) alternative.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top