Debugging final sensor circuit

Thread Starter

svdsinner

Joined May 17, 2011
39
I'm stumped and frustrated. I made a fairly simple circuit to sense water levels in a chicken waterer. The goal was that it would light Red LEDs when near empty, one Green LED when partially full, and three Green LEDs when full. Here is a simulation of the circuit I am using. (Requires Java and uses a free circuit simulator)
Notes:

  • The transistors are 2N5551
  • The LEDs are from my parts bin, so I had to guess their values, but my multimeter shows the amperages are what my simulation predicts.
  • Two switches in the simulation simulate how the sensors behave when they sense water at various levels.
  • The power source is AC because the sensors pass current through liquid, and the contacts will corrode rapidly with DC and require frequent cleaning. I've read that using AC vs. DC make huge differences in cleaning intervals.
  • The circuit began with this design, and was heavily modified by me to suit my purposes.
    • Added the RED light
    • Changed voltage to suit my power source and my LEDs
    • Moved resitors for limiting current to LEDs to physically next to the LEDs, so I would quit burning up LEDs while testing.

In Simulation, it works.

On the solderless breadboard, it worked.

Soldered together in final? The green LEDs all work as expected, but the Red LEDs stay lit continually.

Debugging steps I've taken: (None of these produced results on identifying what the problem is)

  • All three transistors (2N5551s) work
  • All resistances are correct.
  • Confirmed source voltage
  • Checked Voltage across LEDs
    • Goes up/down appropriately for the green LEDs
    • Stays constant across the Red LEDs (roughly 8.5V, which is right for ON)
  • Increase the base current of the transistor by decreasing the resistor values to try to make the transistor "open wider"
  • Searched the PCB for any solder bridges, and hunted for shorts with a multi-meter, even de-soldered and re-soldered several component to look for issues.
Any ideas on what could be happening here? Any tests I can do to locate the issue?
 

CDRIVE

Joined Jul 1, 2008
2,219
It is posted. If you click on the link I provided, the entire circuit opens in an on-line circuit simulator.

In case you missed it, here is a copy of the link
It needs Java enabled, which I won't do. I will not download, software, plug-ins, dll's or change my browser preferences to view a member's schematic. I suspect that others may not either. You can take a screen shot and attach it here in an image format.
 

Thread Starter

svdsinner

Joined May 17, 2011
39
It needs Java enabled, which I won't do. I will not download, software, plug-ins, dll's or change my browser preferences to view a member's schematic. I suspect that others may not either. You can take a screen shot and attach it here in an image format.
This is your prerogative. Since I'm the guy needing help, I'm happy to oblige. Screenshot of the schematic:
 

Attachments

wayneh

Joined Sep 9, 2010
17,498
What's that diode thingy connected to? Nothing?

You put the current limiting resistors on the emitter side instead of the collector side as they were in the circuit you started with. Not a good idea. In fact that original design would probably work better with both the LED and the resistor on the collector side, so the emitter is directly connected to "ground"
 

Thread Starter

svdsinner

Joined May 17, 2011
39
What's that diode thingy connected to? Nothing?
Nothing. It was a legacy bit from an earlier iteration. The two switches just simulate the water level sensors (Bottom switch open = water below lowest sensor, bottom closed, top open = water above low sensor, but below high sensor, both closed = water above high sensor)

You put the current limiting resistors on the emitter side instead of the collector side as they were in the circuit you started with. Not a good idea. In fact that original design would probably work better with both the LED and the resistor on the collector side, so the emitter is directly connected to "ground"
Interesting. I (out of irritation) moved the resistors physically next to the LEDs (Which are a few feet from the rest of the circuit) because I burned out several LEDs while debugging accidentally sending full power to the LEDS when a debugging probe would make a random short. . .

I think I should be able to rearrange things to put the transistors on the ground side, but I thought that was primarily done to keep the switching voltages low when using really small transistors or microcontroller outputs. Could the higher CE voltage be causing the 2N5551 trouble? (I'm still learning how to spec transistors, so I don't know)
 

CDRIVE

Joined Jul 1, 2008
2,219
The power source is AC because the sensors pass current through liquid, and the contacts will corrode rapidly with DC and require frequent cleaning. I've read that using AC vs. DC make huge differences in cleaning intervals.
Then consider using Triacs because you can't use AC with BJTs in that manner. BTW, that schematic hurts my eyes. We'll have to work on your layout skills. :eek:

EDIT: And what are all those annoying dots that obscure everything. I can't tell if the upper transistor is an NPN, PNP or which node is the emitter and which is the collector.
 
Last edited:

CDRIVE

Joined Jul 1, 2008
2,219
I'm stumped and frustrated. I made a fairly simple circuit to sense water levels in a chicken waterer. The goal was that it would light Red LEDs when near empty, one Green LED when partially full, and three Green LEDs when full.

Why lights? Wouldn't full automation be preferable? Will a human always be present to monitor the lights?
 

Thread Starter

svdsinner

Joined May 17, 2011
39
Then consider using Triacs because you can't use AC with BJTs in that manner.
Why not? (honest question) Others have been successful doing it (which doesn't mean it isn't a hack) and worked fine on the solder-less bread-board. I was under the impression that the Diode function of the LEDs made using BJTs just fine, since they are then only switching half-wave DC, not full AC.
BTW, that schematic hurts my eyes. We'll have to work on your layout skills. :eek:
I started with a prettier schematic, but as I iterated, I moved the three transistors to the general location where they are on the PCB to help be keep things straight. My older, prettier versions never got updated to the final specs.

EDIT: And what are all those annoying dots that obscure everything. I can't tell if the upper transistor is an NPN, PNP or which node is the emitter and which is the collector.
As I mentioned above, all the transistors are identical 2N5551 (NPN) transistors, and the collector is always on top, the emitter on bottom, and the base on the left.

In the circuit simulator that I used, the dots move in the direction of the current in proportion to the amperage. They aren't useful in a static screenshot.

Why lights? Wouldn't full automation be preferable? Will a human always be present to monitor the lights?
This is for our hobby-farm chicken coop, not an industrial operation. The whole idea (beyond an excuse to play with the soldering iron) is to give my wife and I an easy double-check to confirm that when our kids claim to do their chores (including filling the chicken's water) that they actually did what they said they did. We can easily see the lights from inside the house. Humorously, when the kids know Mom and Dad can very, very easily confirm what they say, they tend to be a lot more honest.
 
Last edited:

wayneh

Joined Sep 9, 2010
17,498
The exact argument for "trust, but verify".

Get the kids involved in helping develop a truly automated system. A learning opportunity, one where they will have motivation to make it work.
 

CDRIVE

Joined Jul 1, 2008
2,219
Nothing. It was a legacy bit from an earlier iteration. The two switches just simulate the water level sensors (Bottom switch open = water below lowest sensor, bottom closed, top open = water above low sensor, but below high sensor, both closed = water above high sensor)
Are your water level sensors merely two open ended conductors submerged in water?
 

CDRIVE

Joined Jul 1, 2008
2,219
Then consider using Triacs because you can't use AC with BJTs in that manner.
Why not? (honest question) Others have been successful doing it (which doesn't mean it isn't a hack) and worked fine on the solder-less bread-board. I was under the impression that the Diode function of the LEDs made using BJTs just fine, since they are then only switching half-wave DC, not full AC.
First off, it's not a good idea to use LEDs as rectifiers. Admittedly, I've done it in the past with no failure but I may have just been lucky. Secondly, when you rectify the electrode current you've defeated your AC requirement to reduce electrode electrolysis.
 

CDRIVE

Joined Jul 1, 2008
2,219
svdsinner, are you still with us? I worked something up for you but if you've left the room posting it would be rather pointless.
 

Thread Starter

svdsinner

Joined May 17, 2011
39
svdsinner, are you still with us? I worked something up for you but if you've left the room posting it would be rather pointless.
I'm here. I'm interested.


Just realized I missed answering your question: Yes, the sensors are just open ended conductors suspended in the tank that are either submerged (closes the switch) or not-submerged (opens the switch)
 

CDRIVE

Joined Jul 1, 2008
2,219

Thread Starter

svdsinner

Joined May 17, 2011
39
What you posted there seems to imply that you have an expertise on the topic. Are you sure you need help?
I do have experience on what he is asking about. The part he is working on is not what I'm having trouble with. Is it bad form to help others with their problems until I solve every single problem I'm currently having?

My issue is that after this circuit worked as expected both on the simulator and the solderless breadboad, it isn't working in final (soldered) form, and I've run out of debugging ideas to figure out what went wrong in the soldered version.

After all, I posted some plots for you ...
http://forum.allaboutcircuits.com/showpost.php?p=474640&postcount=14
but you never responded to them. :confused:
I'm not really sure what you want me to respond about. I don't need to totally redesign the circuit, since as I mentioned, it worked fine on the solder-less breadboard. I'd be happy to improve it if you have suggestions, and I'm guessing I'm going to have to strip the final circuit down and start over anyway, since I've got no idea what else I can do to locate the fault in the final circuit.

As fate would have it, this was supposed to be a quick-easy one day project, but due to assembly problems on the final soldered version, I've been stuck in debugging for weeks now.
 

CDRIVE

Joined Jul 1, 2008
2,219
Sorry to say I could not retain your original circuit. I posted those plots to show you that maximum reverse voltage of the LEDs were being exceeded. I didn't even include the transistors in your circuit that would experience the same excessive reverse voltages.

Instead I worked up a completely new circuit with the following guidlines...
(1) The submerged sensor currents would be AC and be as symmetrical as possible.
(2) The LEDs and Transistors would not see any AC at their terminals. Therefore, not exceed any reverse voltage parameters of the LEDs or transistors.

The downside is it's more complex than your circuit, so I don't think you'd be interested. I simply don't see a simple mod for your circuit that provides for 1 & 2.
 

Thread Starter

svdsinner

Joined May 17, 2011
39
The downside is it's more complex than your circuit, so I don't think you'd be interested.
Regardless of whether I use it or not, I'm always interested. Half the fun of this hobby is learning new stuff.

And being slightly more complex isn't a disqualifier, especially if it might produce lower maintenance (by using true AC for the sensors). If I've got the parts in my bin, and it isn't ridiculously complex, I'll probably try it.
 
Top