Noise on top of square wave - Page 1
Forum section: electronics / projects

author: nerdyrcdriver
author_rank: Contributor
timestamp: February 14, 2018, 10:40:31 pm
content: Hi everyone,I am working on a project that utilizes a cheap underground dog fence (aka invisible fence) to set a boundary for a robot. The collar has an LED that flashes at a varying rate depending on how close the collar is to the buried wire. We hope to borrow the DC pulses going to the LED as the digital input to an arduino. When stealing that signal, the peak of the wave is 1.94v. Since we hope to trigger a digital HIGH, we need around 3v minimum for a reliable TTL trigger. The first circuit we tested was a simple non inverting amplifier utilizing an LM324 to operate on a single supply rail. It worked great, but I would rather have something more like a comparator. So we built a non inverting comparator using the same LM324 (advantage of having 4 op amps in 1 IC). It DOES work, however, we get a lot of noise on top of the pulse (see attached). The amplitude before the noise is sitting right at 5v. We will likely change this to be slightly less just to be safe, but that is easy. What I don't know how to do is remove just the noise from the top of the wave. Something that may have some affect is that we were short on time in the lab and just used ground as Vref for the comparator. The noise may go away or decrease if we use Vref = 1v or something. It is worth noting that this was built fast and as the most basic non inverting comparator as possible. Something like a comparator with hysteresis or a Schottky trigger may help be a more useful circuit.Unfortunately, I won't be able to get back in the lab and test this again until Feb 20th due to being out of town.I know that towards the end I may have been answering my own question, but I figured it was worth asking for input during the time that I am unable to utilize the lab. Any ideas?

author: Benta
author_rank: Super Contributor
timestamp: February 14, 2018, 11:07:11 pm
content: I don't see noise, but I see bad scope triggering. The signal seems to be complex, time-wise?

author: bloguetronica
author_rank: Frequent Contributor
timestamp: February 14, 2018, 11:15:13 pm
content: Hi,Where is the noise? Seems good to me.Personally, I've seen much worse in digital circuits, and I'm talking high-frequency stuff. Digital is quite immune to that. I wouldn't worry, even if the square wave was indeed noisy, which it isn't.Kind regards, Samuel Lourenço

author: nerdyrcdriver
author_rank: Contributor
timestamp: February 14, 2018, 11:20:30 pm
content: So the extra pulses (faint in the picture) are no problem?

author: bloguetronica
author_rank: Frequent Contributor
timestamp: February 14, 2018, 11:29:56 pm
content: Quote from: nerdyrcdriver on February 14, 2018, 11:20:30 pmSorry! Now I notice the faint pulses. They shouldn't be a problem nevertheless, but they are indicative of a noisy supply rail. Do you happen to have a DC-DC converter located somewhere in the circuit? If so, see if it is overloaded, or out of spec somehow.Kind regards, Samuel Lourenço

author: nerdyrcdriver
author_rank: Contributor
timestamp: February 15, 2018, 12:06:57 am
content: Quote from: bloguetronica on February 14, 2018, 11:29:56 pmActually, yeah. We have an LM317 configured to output 6v with a 12v input. We were concerned with heat issues since it is cutting the voltage in half, but it has no temperature difference than the one next to it that isn't hooked up to anything. The dog collar draws about 18mA total when outputting a HIGH pulse. I can't imagine the op amp circuit drawing much either. In the image in the first post the collar and the op amp are both operating on the output from the LM317. However, in the first image attached to this post, the collar is operating on the LM317 and the op amp is operating off of a bench power supply. The op amp is configured as a non inverting amp in that picture. It is the same supply and the same rail on that supply that powers the LM317 though. The second image is the source signal (output of the collar). This is actually around 3.5v output once we removed a bad LED from the circuit, which might mean that it can act as our digital input to the arduino without any circuit between it and the arduino. The bumps at the top of the source image are just the dotted lines from the Y2 cursor on the scope. In the picture with the op amp configured as a non inverting amplifier, the "noise" is both above and below the peak of the wave.

author: Audioguru
author_rank: Super Contributor
timestamp: February 15, 2018, 02:49:41 am
content: Your 'scope photos show 3 waveforms but the horizontal timebase is set too fast (its frequency is too high) so that the dim waveforms (that occur occasionally) are mixed up with the other waveforms.When the timebase is slowed then you will probably see the 3 waveforms separately.

author: bloguetronica
author_rank: Frequent Contributor
timestamp: February 15, 2018, 03:14:54 pm
content: Quote from: nerdyrcdriver on February 15, 2018, 12:06:57 amI see that the ripple rejection of the LM317 is not that great, but like any other regulator, if does get worse for the high frequencies (see figure 8, page 7 on the TI datasheet). Switching supplies can be quite nasty, and are especially problematic for analog or mixed signal circuits, even if the power to the affected IC passes through a linear regulator. Had that experience due to a charge pump before an LDO, that caused some noise in the order of the mV, and I had to take special care to filter current spikes to ground.So, consider additional filtering if you wish to supply your circuit with a switching supply of any kind. However, this shouldn't be much of a problem in your case, since the circuit is purely digital and relatively low frequency.Kind regards, Samuel Lourenço