Hot tub controller works on the bench, but...

Thread Starter

gregbrainerd

Joined Apr 3, 2009
27
Right. Typing before thinking is worse than speaking before thinking. With typing, there is a permanent record of the stupidity. Here's a more lucid analysis:

When I shorted it, voltage at the - input would be 16V, surely higher than anything possible at the + input, and the heater would run. When I left it open, the - input would be at ground, surely less than the voltage at the + input. The heater should stop, but it's still running. If I pull the LM339 out of it's socket, the heater should stop, but it continues to run. That leads me to believe that the LM339 isn't the problem.

Before the circuit goes into fault mode, I can adjust the temp control pot, and I hear the relays click off and on. When it's in fault mode, the adjustment has no effect. I can still operate the relays by disconnecting the pressure switch, so I'm comfortable with the relays.

If I disconnect the transistor drain at the pressure switch, the fault is cleared and the system operates normally for a while. I don't know how many cycles it will go through before it faults again- I'm going to try to connect a counter to see that.

All this leads me to something having an effect on the MOSFET that prevents it from turning off. I'm just having a hard time thinking of what that could be.
 

hgmjr

Joined Jan 28, 2005
9,027
When I shorted it, voltage at the - input would be 16V, surely higher than anything possible at the + input, and the heater would run. When I left it open, the - input would be at ground, surely less than the voltage at the + input. The heater should stop, but it's still running.
This is a puzzling behavior for sure.
If I pull the LM339 out of it's socket, the heater should stop, but it continues to run. That leads me to believe that the LM339 isn't the problem.
Actually this behavior is what I would expect with the LM339 out of the circuit. Notice that when the LM339 is removed the 10K pullup resistor turns on the MOSFET. That engages the two relays which I assume turns the heater on.

hgmjr
 

Thread Starter

gregbrainerd

Joined Apr 3, 2009
27
Okay- maybe now I should look at the pull up resistor. I still haven't figured out why it's needed- what does it do? I know it is needed, because in the first iteration of this project, it wasn't there and I got nothing. It looked like it would turn on the MOSFET regardless of the state of the comparator. It didn't, so I just went with that. Since I don't know exactly why it's there, it's difficult to reason out what-if any- change is needed
 

hgmjr

Joined Jan 28, 2005
9,027
Okay- maybe now I should look at the pull up resistor. I still haven't figured out why it's needed- what does it do? I know it is needed, because in the first iteration of this project, it wasn't there and I got nothing. It looked like it would turn on the MOSFET regardless of the state of the comparator. It didn't, so I just went with that. Since I don't know exactly why it's there, it's difficult to reason out what-if any- change is needed
It is required by the LM339 because its output transistor has no internal pullup mechanism of its own.

hgmjr
 

Thread Starter

gregbrainerd

Joined Apr 3, 2009
27
I was hoping to figure out what a pullup mechanism needs to do by looking at a schematic of the LM339. It looks like it all comes down to the last transistor. In the LM339 "on" state, that last transistor is "off" and the output voltage is all coming from the pull-up resistor. When the LM339 is "off", the transistor is "on" and all the pull-up resistor is grounded, hence no output.

That being the case, I may need a smaller pull-up resistor when I move from the bench to the tub because I need more power to drive two relays than I did for the single one on the test.

Am I on the right track here?
Thanks!
 

hgmjr

Joined Jan 28, 2005
9,027
The input impedance to the MOSFET is so extremely high that the only consideration in choosing the value of the pullup would be the rise and fall time of the switching signal applied to its gate. Rise and fall time is not that critical in the application so the 10K resistor should be a reasonable value.

hgmjr
 

Thread Starter

gregbrainerd

Joined Apr 3, 2009
27
Am I on the right track at least about what the pullup resistor does?

Now that I think about it, there isn't a problem with the pull up anyway- there's enough power there to activate the relays already.

That brings me back to the transistor. It seems to be staying charged even after the comparator shuts off. I need to either figure out why it's staying charged or I need a way to drain off that charge.
I might be picking up some charge from induction from the wires for the pump- I could reroute them, but I'm skeptical of that as a cause.
If I put a high value resistor between the gate and the ground, it would form a voltage divider with the pullup resistor. With a high value, it wouldn't make a big change it the voltage at the gate, but it would provide a place to drain charges. Does that make any sense?
 

Thread Starter

gregbrainerd

Joined Apr 3, 2009
27
I have one for each leg of the 240V heater circuit. I looked at failure modes for safety. It is unlikely that both relays would fail at the same time. If one fails in the off position, no heat, no scald. An unpleasant surprise on a chilly morning maybe, but no scald. If it fails in the on position, the other will control the top limit just fine. If there were only one and it failed in the on position, there's a potential injury.

Nice thoughts, but I've still got a regular over temperature condition.
 

CDRIVE

Joined Jul 1, 2008
2,219
I see a few things wrong here.

(1) The coils are rated a 12V but the supply is 16V. Good practice would be to replace D1 with a resistor that will drop 4V. That will leave 12V for the coils. I see no purpose for D1 anyway, and (as said earlier) it's backward.

(2) As stated previously, you should have a reversed biased diode across the coils to protect all your semiconductors from back EMF.

(3) I see no purpose for R4.

None of the above is the likely cause of your problem but consider this... The pull in voltage of a relay is higher than it's drop out voltage. This is known as hysteresis. A 12V relay will probably pull in near 9 to 10 volts and will drop out near 8 to 7V. These values are not cast in stone and can vary greatly with the design of the relay. They can be greater and smaller.

You may find that you need a Gnd to Gate resistor. You should be trouble shooting this circuit with a voltmeter to see what these voltages are when in heater on and heater off modes. Check the Drain voltage and the Gate voltages when it's supposed to be on and off.

(4) Personally, I think the benefits of a FET are wasted in this circuit. A general NPN is all that's needed here. What is the resistance of the coils? I would imagine that these are beefy relays since they drive 240V heaters. It would be useful to know the specs on these relays so please post them.
 

Thread Starter

gregbrainerd

Joined Apr 3, 2009
27
Thanks for the reply!R4 and the diode (which is wrong on the diagram, but right in the circuit) were added after the problem appeared. My thinking was that the collapsing field in the relays was recharging the transistor. The diode went in first, then the resistor. The problem wasn't solved, so they are both out of the circuit now.I used the FET because I had one on hand and I knew how it worked- mostly. The relay is an AZ 2150-1A-DE(555) the coil resistance is 155Ω. I have the data sheet, but I'm having trouble attaching it. I'll put it in a separate post.I follow you on the gate to ground resistor and dropping the voltage to the relays, but I need some conceptual guidance on the reverse biased diode across the coils. Wouldn't D1 provide that protection?
 

Attachments

CDRIVE

Joined Jul 1, 2008
2,219
Well according to the data sheet 16V is within the proper operating range of that relay so I wouldn't worry too much about needing the dropping resistor that I mentioned.

As per your schematic: D1 Cathode should be connected to node (6) and the Anode should be connected to node (3).
 

Thread Starter

gregbrainerd

Joined Apr 3, 2009
27
I'll pull the board this afternoon and add a 100k resistor from gate to gnd and move the diode. 100k shouldn't affect the voltage at the transistor too much and it will allow the unwanted charge at the gate to drain. I'll have to think a bit about how the diode protects the semiconductors but that's okay. This whole project started as a mind expanding project for an old guy. So far it's been successful in that respect. Still no tub controller, but I do have some reactivated neurons.
 

CDRIVE

Joined Jul 1, 2008
2,219
I'll pull the board this afternoon and add a 100k resistor from gate to gnd .
Greg, remember that I didn't say that you definitely needed that resistor. The more I think of your problem description the more I lean toward a cold solder joint somewhere. After correcting the D1 problem I would recommend bench testing again and doing some component tapping and wiggling. There is nothing in your circuit that sees a lot of heat except the Thermistor. So it's doubtful that it's a temperature issue.
The Thermistor is remote... isn't it??

You're working with 240VAC and a Hot Tub full of water. I would love to see some pics of the whole system. I wouldn't have a heart attack,.. would I? :eek:
 

Thread Starter

gregbrainerd

Joined Apr 3, 2009
27
I went ahead and put a 100k resistor in- I was thinking about that anyway because the transistor isn't turning off. I thought a place to drain the charge without affecting the voltage at the gate significantly might help. That's what is on the breadboard at the top- I decided to try it before I pulled the board again.

The thermistor I'm using is remote. There is one on the bottom of the heater tube that senses if the pipes are near freezing then runs the pump. It's a leftover from the previous controller. I'd rather run the pump all the time, so I'm not using it.

There's a picture attached. It probably won't give you a heart attack, but you will probably think some people shouldn't be allowed to own a soldering iron. It's all GFCI protected and the monkey fist visible at the side will go in a J-box before it's done. And a strain relief clamp at the side of the box as well.

The wires across the front are for the pump. I routed them away from the LM339. I didn't know how sensitive it is to E&M fields

I did get a chance to check the voltages while it was failed. The supply was 15.7V, the output was 14V. The plus input would run from 7.5 to 12.9 at the limits of the temp control pot. I also checked resistance from pin 12 to ground and had 0Ω. I thought that if it were a weak ground, it might operate, but the pull up resistor could only deliver current to the transistor, but not to ground. It was weak logic to begin with but easy enough to test.

Here's what looks like a key point- at least to a newbie. To clear the fault condition, all I have to do is break the connection between the drain and the relays. Reconnect, and all is well- for a while. That's where R4 came from.

I'm still trying to work out how the diode across the relays provide protection for the semiconductors. The field in the relays is formed when electrons move from - to +. When it collapses, wouldn't they be forced (against their will) to flow back toward +? That was my thinking in placing it between the drain and the relays.

I sure appreciate your help on this. As you can see, I can use all the help I can get!
 

Attachments

CDRIVE

Joined Jul 1, 2008
2,219
I'm still trying to work out how the diode across the relays provide protection for the semiconductors. The field in the relays is formed when electrons move from - to +. When it collapses, wouldn't they be forced (against their will) to flow back toward +? That was my thinking in placing it between the drain and the relays.
When an inductive circuit is broken the collapsing magnetic field induces a voltage of opposite polarity. This voltage can be many times higher than the supply voltage. It's how a spark coil works (sort of). Since D1 will start to conduct @ ~ 600mV to 700mV. This will prevent this reverse voltage (Back EMF) from exceeding 700mV.

So this is why D1 appears backward to you. It only does its work in terms of milliseconds.
 

tkng211

Joined Jan 4, 2008
65
I noticed that you could clear the fault by breaking the connection between the drain and the relay terminal, then reconnecting them. It shows the MOSFET latches in the 'ON' state because the output of the comparator LM339 can't switch to '0'. You can verify it by shorting the gate of the FET to the ground (without breaking the connection between the drain and the relay) and see if you can get the same result. If it's the case, it means the FET is too sensitive. The induced signal (usually the hum caused by the AC supply) from the long lead wire of the remote temperature sensor may cause the FET to switch on all the time.
Suggest twisting the lead wires of the sensor like what people do on the wires feeding the filament of vaccuum tubes to minimize the electromagnetic noise.
You may further stabilize the circuit by adding a decoupling circuit (100Ω, 100μF) to the supply of the comparator IC.
A capacitor can also be added in parallel with the 22K resistor if needed to eliminate any unwanted switching caused by noises.
In order to protect the output transistor inside the IC, a resistor 10 Ω is added to limit the discharge current from the 'gate' of the FET.
Hope the above can help you solve the problem.
If you wanna share more with me, send me email via tkng211@hotmail.com
Cheers!
 

Attachments

CDRIVE

Joined Jul 1, 2008
2,219
That's a good point but I would go a step further by introducing some capacitance between both inputs of the comparator and gnd and the gate and gnd. After all there is nothing in this circuit that requires high speed response. This is where a scope would be helpful. Switching your VMM to AC and taking some measurments would be an alternative.
 

Thread Starter

gregbrainerd

Joined Apr 3, 2009
27
I'm glad you didn't have a heart atack when you saw the picture!

Back to the diode- it's going to replace R4. I think I'm with you now on that. The inductance in the coil is mechanically analogous to a force pushing a mass through a spring. When the force is applied, the spring compresses before the mass moves. When the force is removed, the mass will continue to move for a while. The current is in the same direction as the original applied current when the field collapses. The transistor is open, so there's no path to ground. The diode effectively shorts the relays and the electrons run harmlessly around in a closed circle. If it were cold enough (and Montana sometimes feels that way) it would continue indefinately.

Am I close?
Thanks Again!
 
Top