1
\$\begingroup\$

I'm reading a pulse from a camera back to a raspberry pi and the noisy signal is causing the gpio pin to read too many inputs.

My signal is 3.3v. I'm currently using a 1uf Cap to try to clean up the signal but is that enough? I have the cap soldered to ground and then soldered in the middle of the 3.3v line which leads from the camera to my raspberry pi's gpio pin.

I'm more of a software guy rather than an electrical engineer. I appreciate any help/guidance!

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • 1
    \$\begingroup\$ Please post a schematic, you can draw one with the tool \$\endgroup\$ – Voltage Spike Feb 16 '17 at 23:41
  • \$\begingroup\$ It depends what the pulse is used for and where it comes from. Contact closure? with Pull up R ? narrow pulse? data? using twisted pair wires? A large cap acts like a short circuit to a narrow pulse. Define pulse please! \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Feb 16 '17 at 23:50
  • \$\begingroup\$ or at least define camera + port with www.links \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Feb 16 '17 at 23:58
  • \$\begingroup\$ Make sure the signal is stable. You may have to provide a pull-up resistor if the signal output is e.g. an open drain type. Check the spec/datasheet of the signal source. \$\endgroup\$ – JimmyB Feb 17 '17 at 12:50
2
\$\begingroup\$

If you're a software guy, then you can filter the noise in software, that's the cheapest option :)

But considering you do want to make a low-pass filter, you need a capacitor and a resistor.

schematic

simulate this circuit – Schematic created using CircuitLab

You can compute the RC constant as R*C, in the example that would be 100 * 0.000001 (because C is measured in Farads), or in this case 100 µs. Very crudely speaking (google around for more), fast signal changes that are quicker than the RC constant will get attenuated, slower ones will be passed through. You should decide whether those 100 µs are still too quick and increase the resistance (for example), should you require more filtering.

\$\endgroup\$
  • 1
    \$\begingroup\$ I could but I prefer to take care of things at the source :). My software for it was working but this is how it should be done in my opinion. Thanks! I'll try that! \$\endgroup\$ – Mathew Wright Feb 16 '17 at 23:50
  • \$\begingroup\$ why not increasing the capacitance instead of the resistance? \$\endgroup\$ – m4l490n Aug 23 '19 at 2:21
  • \$\begingroup\$ @m4l490n, you could increase either one \$\endgroup\$ – anrieff Aug 23 '19 at 9:15
1
\$\begingroup\$

Big capacitors demand enough charge to endanger the tiny on-chip transistors that attempt to instantaneously raise the cap voltage to 3.3volts. Hence some current-restricting resistance is needed, and perhaps a smaller capacitor.

If the GPIO is CMOS input (the datasheet will say "zero current" nominally, or much less than 1uA), you can use Rvalues of 100Kohm (brown-black-yellow) and let the ESD structures provide the capacitance.

However, what is the "noise" source? cellphones? battery chargers? electric mixers in the kitchen? You may find some twisted-pair between camera and raspberry [ use 2 colors, so your signal wire remains obvious ] is all you need.

I note you do not show a GND connection from Camera to Raspberry.

\$\endgroup\$
  • \$\begingroup\$ This is all part of a much larger system. The ground from the camera is actually connected it's just far away so to speak. I pulled a ground from the camera and attached it to a ground on the pi and checked the signal on an oscilloscope and it's much cleaner. Testing today to see if it's good enough \$\endgroup\$ – Mathew Wright Feb 17 '17 at 13:53
1
\$\begingroup\$

This sounds like a problem that can be solved with an RC low pass filter but, also consider that a schmitt trigger input can provide decent protection against multiple counts because it works using two analogue thesholds. See the diagram below, left is simple threshold and right is schmitt double threshold: -

http://howtomechatronics.com/wp-content/uploads/2015/08/Input-Signals.png?x57244

There are plenty of logic devices featuring schmitt trigger inputs so I'm not suggesting anything overly esoteric here.

\$\endgroup\$
0
\$\begingroup\$

You're looking for a debouncing circuit. The simplest hardware form for it is in the form of a low-pass RC filter, even though you may encounter some problems due to slow switching (remaining too much time in the "neither ON nor OFF" region of the input).

Here's the simplest circuit:

However, there are many other types of debouncers, both hardware and software ones, even some "what the hell is that?" ones.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.