Multimeter problem?!

So I recetly bought a Uni-T UT139C multimeter.I connected it's COM to an arduino nano's ground and the frequency measurement pin to the A0.I'm outputing an analog signal,with variable duty cycle on pin 9.
The meter shows nothing on the freq./duty counting,but it shows different voltages on the voltage measurement.When I press tje HZ/DUTY button a correct frequency and a correct duty cycle is shown but it appears for a second and then goes to 0.000.
Is this a problem with my multimeter?

This sounds confusing to me:
"and the frequency measurement pin to the A0. I'm outputting an analog signal,with variable duty cycle on pin 9."

Why A0?

.

Sorry I wanted to say that I connected to the multimeter's plug to the arduino's pin 9(not A0).

Let’s see your sketch.

The frequency is about ~480Hz.

.

Try 50%DC

.

void setup() {
pinMode(9,OUTPUT);
Serial.begin(9600);
}

void loop() {
int val=analogRead(A0);
val=map(val,0,1023,0,255);
analogWrite(9,val);
delay(1000);
Serial.println(val);

}

I doubt it's supposed to read PWM. I assume it's supposed to read a continuous-constant sine or square wave.

Try the tone() function.

Or, use a program like Audacity on your computer to make a sine wave file and play/measure it from your soundcard.

I connected the meter to my pc with a jack,but it shows 50Hz at any frequency and volume.

Try
analogWrite(9, 127);
Your meter may not read frequencies as high as 480Hz

.

I connected the meter to my pc with a jack,but it shows 50Hz at any frequency and volume.

Did you have speakers or headphones connected to make sure you've got a signal? Did you connect the ground ("COM" from the meter)?

Were you playing a pure, constant, continuous tone? Normal audio (voice or music) won't work because it contains multiple simultaneous and ever-changing frequencies.

And, I assume the power line frequency where you live is 50Hz so you're reading 50Hz hum?

And check your meter's specs. Maybe it takes a certain voltage if you want to read the frequency?

Just a thought: Could it be that this only works for signals that cross zero? (i.e. frequency is measured by counting when the signal goes from below GND to above GND.) The PWM from the Arduino is above (or at?) GND all the time.

It will only read AC frequency not PWM??

Try adding a capacitor in series with the meter, a few uF will be enough I think.

Thank you for the replies!
Putting a capacitor in series to the meter solved the problem.Thank you very much,MarkT!

Evening.

This may be really dumb but what effect does the capacitor have on the circuit as I have had the same issue today at work where my meter won’t read pwm, add a cap and it’s perfect thanks

This may be really dumb but what effect does the capacitor have on the circuit as I have had the same issue today at work where my meter won't read pwm, add a cap and it's perfect thanks

The Arduino's output goes from zero to +5V. It can't go negative like a normal AC signal.

A series capacitor "blocks" the "DC component" so the signal going-into the meter is a normal AC signal going both positive and negative. i.e. A square wave out of the Arduino goes from 0 to +5V, but you get -2.5 to +2.5V out of the capacitor.

You do need a resistor between the meter's input and ground (maybe built-into the meter) to "hold" the ground reference.

[u]This is a high-pass filter[/u]. Since DC is zero-Hz, DC can't pass-through.

You'll see an output capacitor on audio amplifier circuits that are powered by a single power supply for the same reason. It keeps DC current from flowing into the speaker and it allows the voltage to the speaker to swing positive and negative. (Amplifiers with positive & negative power supplies can be built without the capacitor, and a bridge amplifier doesn't need one either.)

Much of this depends on the meter being used. Placing a capacitor inline blocks any DC component level and passes the AC. There is a difference between just measuring Frequency expressed as Hertz or measuring duty cycle expressed as a percentage. The user manual for your specific meter should cover all of this.

Ron

Cheap meters just count zero-crossings. PWM signals don't cross zero.

Brilliant thanks all