Arduino PWM Pk-Pk voltage

Thread Starter

Track99

Joined Jun 30, 2022
15
Hello my friends.
I have written this sketch to my Arduino. It is a very simple PWM signal generator. It works properly.
My scope is telling me that the Pk-Pk voltage is 8.32V ( Pink trace ). You can see the Pk-Pk numbers on the top right corner of the picture below.

How is this possible? It is supposed to be 5 Volts max. Where is the extra 3.32V potential coming from?

SDS00004.jpg


void setup() {
}
void loop() {
analogWrite(9, 127);
delay(500);
analogWrite(9, 127);
delay(500);
analogWrite(9, 127);
delay(500);
analogWrite(9, 127);
delay(500);
analogWrite(9, 127);
delay(500);
}
 

Papabravo

Joined Feb 24, 2006
18,767
I'm guessing that your reference voltage is not what you think it is. Your signal is 5.12 volts above to 1.6 volts below ground. So pk-Pk = 6.72 - (-1.6) = 8.32 V P-P. Seems reasonable to me.
 

Thread Starter

Track99

Joined Jun 30, 2022
15
I'm guessing that your reference voltage is not what you think it is. Your signal is 5.12 volts above to 1.6 volts below ground. So pk-Pk = 6.72 - (-1.6) = 8.32 V P-P. Seems reasonable to me.
Thank you my friend.What is the minus symbol in front of Duty in the picture? Is it negative Duty cycle?
Does it mean the real Duty cycle is 49.80% ( 100 % - 50.20 %)?
 
Last edited:

Papabravo

Joined Feb 24, 2006
18,767
Thank you my friend.What is the minus symbol in front of Duty in the picture?
Does it mean the real Duty cycle is 49.80% ?
There are two Duty cycle values and they sum to 100%. I interpret the -Duty to be the low time of the signal and +Duty to be the high time of the signal. What does your scope manual say?
 

Danko

Joined Nov 22, 2017
1,356
What is the minus symbol in front of Duty in the picture? Is it negative Duty cycle?
Does it mean the real Duty cycle is 49.80% ( 100 % - 50.20 %)?
Real signal is not rectangular, but always is trapezoidal,
so it must be difference between duties, measured on top and on base of signal.
 
Last edited:

Thread Starter

Track99

Joined Jun 30, 2022
15
There are two Duty cycle values and they sum to 100%. I interpret the -Duty to be the low time of the signal and +Duty to be the high time of the signal. What does your scope manual say?
Thank you my friend. The manual says:
+ Duty: Ratio of positive width to period
- Duty: Ratio of negative width to period .
I got the answer.
 
Top