SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By viviantern
#197350
I have a fairly simple circuit that works perfectly on the breadboard, but I am having a lot of trouble transferring it to a PCB. I am seeing very strange behavior which lies outside of my current experience, so I hope to get some advice.

The circuit implements a wifi motion sensor, although the problem I am having happens waaay before I get to the RF part, or even the uC part of the diagram:
Image
I have circled the part that is having trouble.

R3 is a pull-down resistor, which is required b/c AMN42121 drives the output HIGH when motion is detected, but leaves it hanging for no motion, so pull-down is needed.

I used C1 to smooth out the transition between motion and no motion. C1 makes the output level go to LOW slowly and smoothly, so "no motion" state is achieved after a few seconds of no motion.

Inverter is there b/c attiny's external interrupts are triggered by LOW level, so I need to invert the logic. It is unfortunate that I had to use such a large DIP package for one inverter, but I couldn't find anything else.

I have made a double-sided PCB for this circuit, which looks like this:
Image

Again, I have only assembled the circled area so far.

After soldering S1, R3 and C1, I get the following signal from sensor output:
Image

This is exactly what I want to see, so everything is fine up until this point.

Next I soldered in a socket for IC2 and plugged in the inverter. This is where mysteries begin. At first everything was fine, but after a while of messing with the board the circuit suddenly stopped working. When I place a probe on the sensor output, instead of the nice signal we saw above, I see variations on the following two examples:

Example 1:
Image

Example 2:
Image

Note that unlike the first example, the signal in the second example is not generated by motion - that saw tooth shape just emerges on it's own w/o any action from me.

After a lot of testing, I was able to establish the following:

Unplugging the inverter from the socket makes the sensor work properly again.
Cutting power to the inverter while leaving it plugged in makes the sensor work.
Using a different inverter has no effect.
Dousing the board with flux remover or acetone and scrubbing with a brush sometimes makes the sensor work again, but very briefly. At one point I was able to make the signal look like this by aggressively scrubbing with a toothbrush:
Image
Note that even in this last picture the signal is not returning to LOW level all the way. The effect went away almost as soon as I stopped brushing.

So far this points to some soldering defect, except that I really can't see the problem. I have gone over the board carefully with powerful magnification and tested all spots I could think of for continuity - everything checks out. Here is a closeup of the solder job on the IC socket and the sensor:
Image

I am now out of ideas, so any advice would be greatly appreciated. Thank you.

I have just discovered something interesting. A closer examination of example #2 (the saw-tooth shape signal) reveals that the downward slope is a segment of the expected C1 discharge curve. When voltage level gets close to the threshold of the inverter and spends too much time there, the inverter seems to be getting confused! It's generating that little burst of noise and then does something to kick the input back to HIGH, or simply hangs out in that "indeterminate" noisy state indefinitely until sensor output goes HIGH again b/c of motion (Example #1).

To test this theory I replaced C1 with a cap that is 10 times smaller, thus making the discharge curve much steeper and "voila!" - the inverter is no longer getting confused and the circuit works!

Of course, this defeats the purpose of C1, since it is now not providing as much delay as I want. I am not sure why I did not have this problem with the inverter on the breadboard, but it does suggest that there could be a very easy fix that can address this problem. I read that breadboards have a large "stray" capacitance, so perhaps I just need to strategically add some more capacitors somewhere? Any ideas?

Providing a top view for it:
Image

If you are interested in my electronics project, you can get more useful information in Kynix Semiconductor Electronic Blog: http://www.apogeeweb.net/
By paulvha
#197742
you are into the low uA for discharge. When the capacitor is full the 10M resistor will try to unload as well. starting with 6v / 10M = 0.6uA. The input leak on the inverter is 1uA (small...... but nearly 2 x higher). Next to that a capacitor has an internal resistance as well. When the inverter cuts off, I would expect the capacitor output voltage to increase, as the resistance divider changes (higher inverter resistance as the input transistor is cut off, less current flowing) and have a lesser voltage drop over the internal resistance. Why it worked on the breadboard and not on the circuit. ? not sure, but the smallest change in the resistor or capacitor values. Maybe the breadboard already has a different capacitor/ resistance as you mentioned or maybe because it was just heated up for soldering can already have a big impact. You could try to increase the capacitor and reduce the pull-down to act as the real discharger (instead of the inverter mainly doing that and get confused half way between off and on). You could also decide to bring an RC circuit after the inverter. A more radical approach is to replace the 7404 and build the inverter logic with a single transistor and some resistors.
By jremington
#197743
The photo showing the inverter pinout region of the board appears to be very poorly soldered. You probably have several bad or open connections.

Nearly every connection needs to be touched up with fresh rosin core solder and a solder pencil, until all copper is covered and all connections are smooth and shiny, domed up from the copper to smoothly attach to the IC pins.

I would use a single NPN transistor instead of an inverter package. Unused inverter sections with open inputs tend to oscillate.
By jremington
#197756
The unused inputs are grounded
Not if the solder connection is bad.

Exactly such a high impedance or open input, leading to inverter oscillation, readily explains the unintended oscillations described and pictured (5th image from top) in the OP.