Arduino short pulse issue

I'm trying to make a short micro second square wave every second and the issue is there is too much waves before the pulse and after can anyone help on the coding side or maybe be able to add some components to clean up the signal.
-Thanks


pulse.ino (466 Bytes)

Your scope (probe head) deserves calibration.

Try a some resistance in series with the output pin to damp the oscillations

Hi,

ESP32 has a feature called Ledc, which can generate pulses of up to 40 Mhz.
And you can turn it on and off.

#include <esp32-hal-ledc.h> // Lib Ledc
ledcAttachPin (GPIO, channel) // channel select one 0 to 15
ledcAttachPin (4, 7); // pin4 // Use pin4 with channel 7

ledcSetup (ledChannel, freq, resolution);
ledcSetup (7, 5000, 8); // Use channel 7, 5000Hz, resolution 8

ledcWrite (ledChannel, dutyCycle);
ledcWrite (7,128); // Start channel 7 PWM Duty 128

ledcWrite (7.0); // Start channel 7 PWM Duty 0

RV mineirin

First make sure you are not observing a wiring/probe artifact. Use very short leads and the 10X oscilloscope probe.

The output needs a load resistor.

That is a classic image of "ringing" in the circuit. You are pulsing a high impedance circuit and it is attempting to oscillate, but there is no amplification, so the oscillation slowly dies out. Match the impedance of the driving circuit to the circuit receiving the pulse.
Paul

https://www.youtube.com/watch?v=1xicZF9glH0
https://www.youtube.com/watch?v=BcJ6UdDx1vg
https://www.youtube.com/watch?v=d7Y2i2VD-70

Thanks for sharing this important information to us. I am looking for the same content.

Kabosu Official

Hi, @WilliamN
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

What model Arduino are you using?
What load are you driving the square wave into?
As mentioned earlier, if you are using a x10 probe, have you compensated it?
Although that does not necessarily look like an uncompensated probe.

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

Have a look at this Application Note /Lab Brief from Teledyne LeCroy: https://teledynelecroy.com/doc/build-your-own-power-rail-probe-appnote

Although it specifically mentions power rails it should work in your situation.

Yellow trace is a coax lead connected to a 1MΩ oscilloscope input.
Red trace is the coax lead with a 50Ω resistor at the device under test end.