Pages: 1 [2]   Go Down
Author Topic: What does the 500 Hertz pulse-width modulation mean?  (Read 1730 times)
0 Members and 1 Guest are viewing this topic.
Northern California (by San Francisco)
Offline Offline
Sr. Member
****
Karma: 2
Posts: 250
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyway, as retrolefty said, the important thing is that if you pass this pulsing 500 Hz signal through a capacitor, the capacitor effectively "smooths out" the pulses into something you won't hear.

I could use a resistor-capacitor low-pass filter. But with high enough resistance and capacitance to fliter a 500 Hertz signal, I will see a pretty significant voltage drop at the top end. The voltage will never get to 5 Volts even with a 100% duty cycle.

An inductor-capacitor filter would help with that. But that kind of filter has its own problems.
Logged

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 331
Posts: 16501
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyway, as retrolefty said, the important thing is that if you pass this pulsing 500 Hz signal through a capacitor, the capacitor effectively "smooths out" the pulses into something you won't hear.

I could use a resistor-capacitor low-pass filter. But with high enough resistance and capacitance to fliter a 500 Hertz signal, I will see a pretty significant voltage drop at the top end. The voltage will never get to 5 Volts even with a 100% duty cycle.

An inductor-capacitor filter would help with that. But that kind of filter has its own problems.


Not true, as long as the impedence the filter is wired to is high enough you will be able to see 5 volts at the cap. Most wire the low pass to a unity gain opamp which will buffer the low pass to what the now a true analog voltage is wired to.

Lefty
Logged

Northern California (by San Francisco)
Offline Offline
Sr. Member
****
Karma: 2
Posts: 250
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You say you understand now the Arduino Pulse-width modulation? It is actually global thing not just Arduino.

Yes, I know. I was just wondering why the Arduino has a low frequency (500 Hertz) combined with low granularity (0 - 255) in its pulse-width modulation. And why it has "on-off" modulation rather than "distributed" modulation. (See www.datadog.com/pwm_tutorial.pdf)

But I understand that better now. And I'm not complaining. The Arduino has limits. It can't do everything well. I'm just trying to see how I can do my application better. The comments to my post have helped me do that. Thanks.
Logged

Northern California (by San Francisco)
Offline Offline
Sr. Member
****
Karma: 2
Posts: 250
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not true, as long as the impedence the filter is wired to is high enough you will be able to see 5 volts at the cap. Most wire the low pass to a unity gain opamp which will buffer the low pass to what the now a true analog voltage is wired to.

Lefty

You're right. I'm sure I could get to where I want to go. But what I'm thinking now will work best is a digital-to-analog converter, not an Arduino doing pulse-width modulation. Anyone know of any good DACs out there?
Logged

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 331
Posts: 16501
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You say you understand now the Arduino Pulse-width modulation? It is actually global thing not just Arduino.

Yes, I know. I was just wondering why the Arduino has a low frequency (500 Hertz) combined with low granularity (0 - 255) in its pulse-width modulation. And why it has "on-off" modulation rather than "distributed" modulation. (See www.datadog.com/pwm_tutorial.pdf)

But I understand that better now. And I'm not complaining. The Arduino has limits. It can't do everything well. I'm just trying to see how I can do my application better. The comments to my post have helped me do that. Thanks.

analogWrite() is just a function the arduino team added to the standard arduino library and/or core functions. They made various design decision based on what they thought would be useful and easy to use. There is nothing in the Arduino platform that prevents one from writing their own pwm functions that run at whatever frequency and resolution capabilities the AVR chip provides. An example is digitalRead() function. It uses a variable for the pin number which can be useful and the pin mapping lets the arduino pin numbers stay consitance even if the chips I/O ports and pins are different from say a 328 to 1280 chip. But there is nothing to prevent someone from using direct port access I/O to gain I/O speed at the expensive of giving up the 'abstrated pin numbering' and portability that the arduino I/O method allows.

 I guess what I'm saying is anything you don't like about a predefined arduino function in the arduino platform can be 'corrected' to your satisfaction by writing your own function and not utilizing the arduino function in question. Your limits then are only those hardware limitations of the microprocessor.

Logged

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 331
Posts: 16501
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not true, as long as the impedence the filter is wired to is high enough you will be able to see 5 volts at the cap. Most wire the low pass to a unity gain opamp which will buffer the low pass to what the now a true analog voltage is wired to.

Lefty

You're right. I'm sure I could get to where I want to go. But what I'm thinking now will work best is a digital-to-analog converter, not an Arduino doing pulse-width modulation. Anyone know of any good DACs out there?

I've been thinking about buying this one, but haven't yet. Looks quite useful and functional.

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=270632079322&ssPageName=STRK:MEWAX:IT
Logged

Northern California (by San Francisco)
Offline Offline
Sr. Member
****
Karma: 2
Posts: 250
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I've been thinking about buying this one, but haven't yet. Looks quite useful and functional.

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=270632079322&ssPageName=STRK:MEWAX:IT

That does look like a good DAC. I only need 8 bits rather than 12 bits. But if I cannot find an 8-bit DAC that is similar, I'll get one of those. I've found the right chips, but I'd rather have one on a board like you found.
Logged

Northern California (by San Francisco)
Offline Offline
Sr. Member
****
Karma: 2
Posts: 250
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


 I guess what I'm saying is anything you don't like about a predefined arduino function in the arduino platform can be 'corrected' to your satisfaction by writing your own function and not utilizing the arduino function in question. Your limits then are only those hardware limitations of the microprocessor.


Well said!

By chance I just saw another thread here that discusses a bit how to do that. arduino.cc/forum/index.php/topic,54692.msg391921.html#new
« Last Edit: March 08, 2011, 09:47:38 pm by Daanii » Logged

Pages: 1 [2]   Go Up
Jump to: