Transistor turning off instead of on through op amp

Thread Starter

Trike007

Joined Jan 26, 2012
10
Hi, I'll try to explain this the best I can. I'm a newbie, so bear with me.

Scenario: I have a Force Sensitive Resitor that will run through a LM358 that will trigger a pn2222a NPN transistor, which will activate a relay.

I have laid out the circuit according to this data sheet on page 22, http://resenv.media.mit.edu/classes/MAS836/Readings/fsrguide.pdf


Goal: When I press on the pressure sensitive strip, I want it to activate a relay based on the set threshold.

Problem: Right now, for some reason the transistor is being kicked on by the op amp without pressing the strip, But when I press the strip, it turns off the transistor. I'm using the inverted input as a comparator to set the trigger point.

Setup: Operating Voltage is 24v.

I'm running a voltage divider to feed 5v into the strip which goes the non inverted input. Someone said they burned a strip from running 24v into it. That's the reason i'm running a voltage divider for it.

I have a 10k pot that gets 5v from the voltage divider that goes into the inverted input. This is used to adjust the threshold. I will be replacing this with a fixed voltage divider once I figure out the threshold value.

I'm feeding 24v into the LM358, the output goes to a pn222a transistor, which triggers a 24v relay. I can trigger the transistor manually by feeding power into the base.

Following the circuit above this is the values I'm using for the components.
RM: 10k
R1: 10k Pot
R2: 10+20k
R3: I had a 4.7k, but had to remove this, as it wouldn't trigger the transistor for some reason.
q1: pn2222a running 24v
Relay 24v NC
D1: I don't have this in place.

This seems like a fairly simple circuit, but i'm not sure what i'm doing wrong here. Maybe the resistor values are off because of the 24v.

Any help or comments is highly appreciated. Please let me know if I can clarify anything.

Thanks
 

wayneh

Joined Sep 9, 2010
17,498
I can trigger the transistor manually by feeding power into the base.
Disconnect the base of the transistor and verify with your DMM that your op-amp comparator is giving you the logic you expect. Apparently it's not. My guess is you have ± the pins reversed.

R2 seems small.
 

ScottWang

Joined Aug 23, 2012
7,400
1. Remove the R2.
2. R3 change to 20K, if the current of relay is less then 100mA.
3. How much mA does it needs for 24V relay?
 

Thread Starter

Trike007

Joined Jan 26, 2012
10
Thanks guys for the suggestions.

Wayneh,
I'll double check again when I get home tonight, But I disconnected the base and measured the output pin on the op amp, and it would go to 24v once I pressed on the strip. But I'll double check that and the polarity again.

ScottWang,
I'll give your suggestion a try too. I just looked at the datasheet for the panasonic DSP relay i'm using. At 24v, the current used is 12.5mA. If I remove R2, how will that affect the debounce filtering?

Actually I typo'ed R2. it's supposed to be 10k+20k. I was aiming for what the data sheet recommended. 47k total for RM+R2

Thanks!
 

ScottWang

Joined Aug 23, 2012
7,400
ScottWang,
I'll give your suggestion a try too. I just looked at the datasheet for the panasonic DSP relay i'm using. At 24v, the current used is 12.5mA. If I remove R2, how will that affect the debounce filtering?

Actually I typo'ed R2. it's supposed to be 10k+20k. I was aiming for what the data sheet recommended. 47k total for RM+R2

Thanks!
If you want an op amp to be a comparator, R2 is unnecessary, when you add R2, it just make an op amp reduce it's sensetive, because R2 will limited the GAIN of Op Amp.

Your relay's current only need 12.5mA, it's very less, so you may increasing the R3 value more, you can try it from 22K~47K.
 

Ron H

Joined Apr 14, 2005
7,063
If you want an op amp to be a comparator, R2 is unnecessary, when you add R2, it just make an op amp reduce it's sensetive, because R2 will limited the GAIN of Op Amp.

Your relay's current only need 12.5mA, it's very less, so you may increasing the R3 value more, you can try it from 22K~47K.
R2 provides POSITIVE feedback for hysteresis. It does not reduce the gain.
 

wayneh

Joined Sep 9, 2010
17,498
Right, and I don't think it should be removed, just taken up to over 100K or even over 1M. Basically, you use the largest value you can that still allows for clean switching without chatter.

Oh, now I see why it was at that lower value - there's no resistor on the op-amp input other than the pressure strip itself. That means you need more feedback current to move the voltage.

Still, I think I'd start with a higher value and not go down unless it chatters badly.
 

Thread Starter

Trike007

Joined Jan 26, 2012
10
Thanks Wayneh,

This is all very good info for me. I'll keep it all in mind while I trouble shoot it when I get home.

Maybe it's possible that the R2 value is too low. If I adjust the pot to set the threshold, if I turn it down too much, the relay starts chattering pretty hardcore without even touching the strip.
 

Ron H

Joined Apr 14, 2005
7,063
If you don't install D1, you risk destroying your transistor when it turns off. The voltage across the relay coil can go to several hundred volts.

EDIT: If your relay is normally closed, you should read zero ohms across the contacts until you press on the FSR, at which time the contacts should open. Is that what you are expecting?
 

ScottWang

Joined Aug 23, 2012
7,400
If you won't remove R2, then you should increase it's value more higher as wayneh said.
When you add R2, then the input voltage of non-inverting will appear hysteresis, so when you press the FSR and release it, the voltage of threshold is different, it means that when you press PSR have a position, and when you release FSR also have another position, but two positons are different, if you didn't add R2, then the position are the same.

You can add a resister Rbe(cross on B,E of Q1) to Eliminate the astable state of Relay.
If R3 using 20K or 22K then The Rbe can be 4.7K~10K.
 

Thread Starter

Trike007

Joined Jan 26, 2012
10
Hi Ron,

I was wrong in my description. I labelled it as NC when really, it should be NO. I want the relay to close when I press on the FSR.
 

vk6zgo

Joined Jul 21, 2012
677
Are you sure what sense the FSR operates?
In other words,does it decrease in resistance when force is applied,or does it increase in resistance?
If the latter,the circuit is working correctly.
 

Thread Starter

Trike007

Joined Jan 26, 2012
10
I figured out the problem. It was pretty stupid and user error. The transistor was actually messed up, But in a weird way. I had the Emitter hooked up to ground, the collector to the relay, the other end of relay to ground instead of V+. Somehow this caused it to shut off when I pressed the strip. When I wired up faulty transistor like it should've been with the end of the relay going into V+, it wouldn't work. I tried for an hour and tried a few new transistors as well. It turned out that I was frying the transistor because, I had managed to bypass the current limiting resistor on my bread board. With the original transistor, it would work, but not as expected. Once I fixed that, it started working as expected.

This was a good experience for me. It allowed me to separate and trouble shoot each circuit individually.

Thanks everyone for the suggestions. I definitely kept them in mind while trouble shooting. I changed out R2 for a 210k, and added a 1n4148 to the relay coil.

I'm still getting some trigger bounce, when I press the strip right at the trigger point, the relay is triggering very rapidly. Would changing the R2 value help with trigger bounce? If so, which direction should I go to reduce it?

Thanks!
 

Ron H

Joined Apr 14, 2005
7,063
I figured out the problem. It was pretty stupid and user error. The transistor was actually messed up, But in a weird way. I had the Emitter hooked up to ground, the collector to the relay, the other end of relay to ground instead of V+. Somehow this caused it to shut off when I pressed the strip.
That isn't possible. With no power to the relay, it would always be off, and there would be no indication if the transistor was on or off.
 

Thread Starter

Trike007

Joined Jan 26, 2012
10
I know it sounds odd. But I think it somehow got shorted and it was taking the power from the base. It's wacky, and made me question it.
 
Top