Tuesday 30 April 2019

voltage - Is a square wave still considered DC?


Say I have a logic-level square wave, where 0V is "low" and 5V is "high". I'm pulsing this at a constant 60Hz, 50% duty cycle. My intuition says that since the voltage never goes negative, it's a DC signal, regardless of how fast I'm pulsing it. Is that correct?


Furthermore, when considering op-amps to amplify signals from sensors that again produce 60 Hz square waves between 0 and 100mV, can I also consider this a DC signal, and not worry too much about my gain-bandwidth product?



Answer



Brief answer to both questions:

No, that's not correct.
No, you do need to worry about that.


Let's start from the beginning. There is no way you will ever deal with a literally 'DC' signal. Let's say you have a bench power supply, you use it to power your circuits, that's maybe some 5V DC, right? And what about when you turn it off? What about power outages? What about when that particular bench supply didn't even exist?
My point is: a real (existing) signal can never literally be DC. At some point in time it didn't, and it won't, exist.


But there's hope: we can give a somewhat less strict definition of DC signal, and we're calling in our old friend Fourier. I am assuming you know what the Fourier Transform is, you can read it up or just believe me: there is this particular mathematical transform that takes in a signal that is a function of time and spits out a signal that is a function of frequency. And that works in both way, so your nice signal can be either represented in its time domain form or in its frequency domain form.
But what do we need this frequency thing for? Well that's easy, let's say you have: $$x(t)\rightleftharpoons X(f)$$ where \$x(t)\$ is your signal in the time domain, while \$X(f)\$ it's the same signal in the frequency domain. Now, if you compute \$x(t_0)\$ you get the value your signal has in the instant \$t_0\$, so what about \$X(f_0)\$? Well, you get the value your signal has at the frequency \$f_0\$, plain and simple. Let's say that you record a bass drum and a violin, you have the time domain signals, you transform them then plot them: the bass drum will be very high for low frequencies, while the violin will be very high for high frequencies. That's because the bass drum has plenty of low frequency components, while the violin has plenty of high frequency ones.


So let's go back to DC definition. We could say that a signal is DC if "most of its components are at very low frequencies". That's better than "it never changes", having low frequencies components can actually happen. That's not a precise definition but let's take it as is now.


What about your square wave? Let's have a look at the plot of a square wave frequency components (also called spectrum):
enter image description here
(source: wikipedia)

That's a 1kHz square wave: as you can see the function plotted is very high at 1kHz, but also at 3, 5 and so on... And (trust me) the height of the peaks goes down as 1/f, that's slow. And please note I did not made any assumption on whether the wave is going or not below zero.


So your square wave is far, far away from being DC.


Now to your second question: that's a completely different one. If and only if your square wave amplitude is very very small compared to other signals you have around you can say "well let's just pretend it's not there". But that's not your case, your square wave is the signal you want to amplify. And as you just learned that's not DC at all... You better look carefully at the specs of the op amp you are going to choose then.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...