I am generating a square wave using a CMOS chip running at 12 volts, the time period is 10us, I can see the square wave is perfect on the scope.
Now when the square wave is sent to ESP32 using a resistance divider of 33K/12K to translate the 12V to 3.2V so that the ESP32 can do frequency measurement, the square wave shape is lost. Below is the square wave at the resistance divider.
Why is this wave smoothed so much? Is the ESP32 pin having a high capacitance?
The pin is configured as input and I am doing pulse measurement using Arduino pulsein
function. I have verified my board cleanliness and rule out any stray capacitance, after all at the CMOS chip I get a perfect square wave.
-
1\$\begingroup\$ You’re correct about capacitance, but it may not be the ESP32 but rather your oscilloscope probe. \$\endgroup\$Kartman– Kartman2025年09月20日 10:56:14 +00:00Commented Sep 20 at 10:56
-
1\$\begingroup\$ 10 uS (in your question title) is micro-siemens. Try a lowercase 's' for seconds. Capitals matter! \$\endgroup\$Transistor– Transistor2025年09月20日 10:59:23 +00:00Commented Sep 20 at 10:59
-
\$\begingroup\$ @Kartman, the scope measures 12V square wave just fine, so why wouldn't it 3.2V? I also removed the wire connection to the ESP32 and measured again and the smoothed wave is still at the divider but not before 33K at the CMOS chip output. Thats quite puzzling \$\endgroup\$wonderfuliot– wonderfuliot2025年09月20日 11:03:18 +00:00Commented Sep 20 at 11:03
-
1\$\begingroup\$ @GoldyRathore - Hi, You posted a (now-deleted) self-answer. The problem is that the "answer" is really just confirming what other answers had already said i.e. that the issue was the capacitance of the x1 probe. || We don't want OPs to always post a new answer, just to say that another answer was correct. But also editing the question (to add confirmation) after receiving answers to the original version, can be problematic. And while it can sometimes be appropriate, it's usually best avoided as it can make existing answers look wrong / incomplete etc. \$\endgroup\$SamGibson– SamGibson ♦2025年09月20日 14:15:30 +00:00Commented Sep 20 at 14:15
-
1\$\begingroup\$ (continued) Therefore to best fit the Stack Exchange etiquette, I recommend you please follow this advice, upvote answers where appropriate, then "áccept" your choice of best answer (to make it clear that you don't need more answers), and add your confirmation result as a comment on that answer. || To help you, I have put suitable comment syntax for you to use, as a comment on your self-answer. TY \$\endgroup\$SamGibson– SamGibson ♦2025年09月20日 14:16:29 +00:00Commented Sep 20 at 14:16
3 Answers 3
The square wave is terrible .You could quickly confirm capacitance as the cause by benching 3k3 and 1k2 instead of your 33k and 12k .Expect the waveform to improve .If your application is ok on these lower value resistors then you can just go with it .Your probe concerns can be answered by making a crude probe with say 22pf and say 220pf .exact values are not important because it is the shape of the wave that is of interest .Magnitude is fine due to resistive divide ratio. If wave improves on home brew probe then you have probe problem .I have never run a high source impedence into a cmos input due to risk of parasitic oscillations .
Your rise time (about 63%N of full magnitude) is ABOUT 0.8 μS.
By measurement, and as suggested by Andy :
Your resistance is 33k//12k = 8k8
t = RC, so C = t/R = 0.8E-6 / 8k8 =~~ 90 pF.
A typical 10x scope probe would be in the 10-20 pF range. A 1x probe may be typically say 75-150 pF.
You'd need to know what you were using to see if this figure is close to what you'd expect, but 90 pF sounds in the order of right. At say 20 pF you'd expect a faster rise times, but still far from square.
-
\$\begingroup\$ 63% is less than 2 us Russell. I'd say about 0.8 us. OK it still only means maybe 80 pF probe capacitance and far from an expected value of 20 pF. \$\endgroup\$Andy aka– Andy aka2025年09月20日 11:16:45 +00:00Commented Sep 20 at 11:16
-
\$\begingroup\$ @Andyaka It appears to be 1x probe, so expect more than 80pF. \$\endgroup\$Justme– Justme2025年09月20日 11:45:16 +00:00Commented Sep 20 at 11:45
-
1\$\begingroup\$ @Andyaka . Correct. 1500 km from home, dining room table, family bed time, other weak excuses :-). Graph guestimate matches your 0.8 uS figure. Results well inside expectations for a 1x probe. You knew that :-) \$\endgroup\$2025年09月20日 11:59:22 +00:00Commented Sep 20 at 11:59
You have not ruled out stray capacitance, as everything has stray capacitance.
The ESP input pin is said to have 2pF, any wires, cables and PCB traces surely have capacitance, and even your scope probe and scope input has capacitance.
And you seem to be using an 1x scope probe, and 1x scope probes can have exceptionally high capacitive load from the cable and thus they have very low bandwidth of just few MHz which will round down edges.
Granted, a square wave of 50 kHz should look very much like square wave with 500 kHz bandwidth already, so it may be something else.
Also the scope probe compensation may be off so square wave will not look like square wave.
The 12V CMOS output may also have weak output drive ability, i.e. high output impedance.
But after 33 kohm resistor, I would not be surprised to see RC shaped shark-fin waveforms, especially if using uncompensated 1x probes adding a lot of capacitance.
For example one switchable probe I found adds 110 pF of capacitance in 1x mode.
And, if estimated that your scope trace rises to 63% in 1 microsecond, and the impedance is 8.8k from resistor divider, the capacitance is 114 pF - spot on approximation for a 1x probe I just mentioned!
-
\$\begingroup\$ Yes, I remeasured, got much better shape with 10x probe. I learnt something new. BTW,I am using Hantek 20MHZ scope. Do better DSO like 100MHZ perform better even in 1x? \$\endgroup\$wonderfuliot– wonderfuliot2025年09月21日 17:17:13 +00:00Commented Sep 21 at 17:17
-
\$\begingroup\$ @GoldyRathore No they don't. All scopes have rather similar inputs, so changing scopes won't have much effect. It's the probes. I can't think of any beginner scenario where you would want or need to use 1x probes. Just use 10x probes unless you know why you would need a 1x probe. \$\endgroup\$Justme– Justme2025年09月21日 18:52:15 +00:00Commented Sep 21 at 18:52
Explore related questions
See similar questions with these tags.