Author Topic: Help with transistor calculations in a circuit  (Read 1388 times)

0 Members and 1 Guest are viewing this topic.

Offline xtvTopic starter

  • Contributor
  • Posts: 47
  • Country: br
Help with transistor calculations in a circuit
« on: October 02, 2020, 10:43:49 pm »
I'm trying to build a circuit to control my old (but high fidelity) car stereo over the remote control port available as a 3.5mm jack in the back of it.

This works by shorting different resistive signals for each functionality, described in the diagram below:


The thing is that the steering wheel of the car uses can bus for these commands, so I'm using an arduino MCU to decode them, and then set the matching resistance into a MCP41100 100k digital potentiometer.
The idea would then to use a transistor to switch the resistive circuit across the pot on and off for a short period of time, to send the command.
The problem is that I'm not really experienced with transistors. I've chosen a 2N7000 fet because as far as I understand, FET's works better as on/off switches for not being so linear.
So the circuit is working for low resistances, but as I try the higher resistance commands, the stereo gets it as if the resistance was much higher than it should.
Is there anyone out there experienced with transistor that could help?
As I'm an enthusiast willing to learn more about electronics, I'd appreciate if someone could give a solution for this, instead of suggesting to use a digital pot with a disable / shutdown feature.
Here's how my diagram looks like.
Many thanks!

 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3848
  • Country: nl
Re: Help with transistor calculations in a circuit
« Reply #1 on: October 04, 2020, 02:25:59 pm »
There are a few possibilities where trouble sneaks in.

Firstly, your FET is not really fit for the job.
It has a very wide range in "Gate threshold voltage"

https://www.onsemi.com/pub/Collateral/2N7000-D.PDF

This means that the gate has to be half a volt to 3V higher then the source for the FET to switch properly.
For the higher resistance value's, the voltage on the source pin rises significantly above GND, and there is not enough voltage left to switch the FET fully open.
Using a P channel MOSfet would probably work a lot better here, but no guarantee becase the circuit in the radio is unknown to me.

The second problem is that you do not know what circuit is in your radio.

There are a few possibilities:
It may be a simple resistor, connected to +5V, which forms a resistor divider with the external voltage, and then it measures the resulting voltage.
If this is the case, then the voltage on the output varies a lot, depending on which resistor you connect externally.

It may be some kind of current mirror.
In this case the voltage on the output will always be between approx 4V and 5V, independent of which external resistor you connect.

One way of solving your problem is with an analog MUX such as the 4051 and 8 resistors.
A similar way is to use 8 resistors and directly connect them to the pins of your uC, and then you can switch pins between "Input" (open) and "Output Low" (closed).

If you want to fix it with your MCP41100 there are also a few possibilities.
First, Remove the FET, and replace it with a series resistor. 1kOhm or so would suffice. The main reason for adding this resistor is for ESD protection, and to make your circuit more robust.

Then, if you're lucky and if you program the MCP to the highest resistance, your radio does not see it, and considers it "open".
If this works then you're done. You just have to figure out some new settings for the MCP to figure out where the switching thresholds are for your radio and finally program your uC to get near the middle of the tolerances.

Another way is to switch the MCP as a regular DAC. So put 1 side of the pot to "GND", the other to "5V" and again, use a 1k resistor in series with the wiper,and connect the other end to your radio. In this case, when the MCP is set to the highest output, both sides of the 1k resistors have the same 5V, and no current flows, so from the viewpoint of your radio it is open. For this way, you will also have to calibrate your settings that work for you.
 
The following users thanked this post: xtv

Offline JuanGg

  • Regular Contributor
  • *
  • Posts: 193
  • Country: es
    • My personal blog
Re: Help with transistor calculations in a circuit
« Reply #2 on: October 05, 2020, 08:22:01 am »
Maybe you could try connecting the FET's source directly to ground, and have the potentiometer between the drain and your car stereo. That way you ensure that Vgs is enough to turn on the MOSFET, independently of the potentiometer's resistance.
When the MOSFET is on, it will connect one end of the pot to ground, else it will let it float.

    Juan
 
The following users thanked this post: xtv

Offline coromonadalix

  • Super Contributor
  • ***
  • Posts: 6599
  • Country: ca
Re: Help with transistor calculations in a circuit
« Reply #3 on: October 05, 2020, 09:15:15 am »
would a mc4066   be better ??
 
The following users thanked this post: xtv

Offline xtvTopic starter

  • Contributor
  • Posts: 47
  • Country: br
Re: Help with transistor calculations in a circuit
« Reply #4 on: October 05, 2020, 02:48:32 pm »
There are a few possibilities where trouble sneaks in.

Firstly, your FET is not really fit for the job.
It has a very wide range in "Gate threshold voltage"

https://www.onsemi.com/pub/Collateral/2N7000-D.PDF

This means that the gate has to be half a volt to 3V higher then the source for the FET to switch properly.
For the higher resistance value's, the voltage on the source pin rises significantly above GND, and there is not enough voltage left to switch the FET fully open.
Using a P channel MOSfet would probably work a lot better here, but no guarantee becase the circuit in the radio is unknown to me.

The second problem is that you do not know what circuit is in your radio.

There are a few possibilities:
It may be a simple resistor, connected to +5V, which forms a resistor divider with the external voltage, and then it measures the resulting voltage.
If this is the case, then the voltage on the output varies a lot, depending on which resistor you connect externally.

It may be some kind of current mirror.
In this case the voltage on the output will always be between approx 4V and 5V, independent of which external resistor you connect.

One way of solving your problem is with an analog MUX such as the 4051 and 8 resistors.
A similar way is to use 8 resistors and directly connect them to the pins of your uC, and then you can switch pins between "Input" (open) and "Output Low" (closed).

If you want to fix it with your MCP41100 there are also a few possibilities.
First, Remove the FET, and replace it with a series resistor. 1kOhm or so would suffice. The main reason for adding this resistor is for ESD protection, and to make your circuit more robust.

Then, if you're lucky and if you program the MCP to the highest resistance, your radio does not see it, and considers it "open".
If this works then you're done. You just have to figure out some new settings for the MCP to figure out where the switching thresholds are for your radio and finally program your uC to get near the middle of the tolerances.

Another way is to switch the MCP as a regular DAC. So put 1 side of the pot to "GND", the other to "5V" and again, use a 1k resistor in series with the wiper,and connect the other end to your radio. In this case, when the MCP is set to the highest output, both sides of the 1k resistors have the same 5V, and no current flows, so from the viewpoint of your radio it is open. For this way, you will also have to calibrate your settings that work for you.
Thanks so much for carefully looking into my thread. For a while I thought I'd be left without assistance :)
I had the same quastions about the radio's inner circuit. For the voltage drop using a 1.2k resistance, I calculated the internal resistance of around 12k. But when I checked the relative drop with a 12k resistance, the voltage didn't dropped proportionally. So I'm assuming there might be some sort of internal switching inside the radio, other than just measuring the voltage in the tip.
Many thanks for all the suggestions.

One question do you think I could also use a second N-ch transistor to drive a higher gate voltage to enable / disable this fet? Assuming this is a car circuit, I could have an up to 12v positive.
I have also ordered a P-channel fet, will see how it works with that. I'm assuming this could be the easiest fix. (I'm wondering if what I need is to just divide the gate voltage and work with somethink like 0-3v, and allow the 5v through the source).

Thanks for the mux suggestion. It might be the cleanest and more robust solution.. I will still give the digital pot a try, I like the idea that this could be software adapted and that the circuit could possibly be used by someone else, with a different radio.

I'll give a try to work with the 1k resistor in series as well.. I believe I've made this test before, and the radio got the 100k (pot at it's max value) as the same command for the 62,7k. So it got stuck into that.
 

Offline xtvTopic starter

  • Contributor
  • Posts: 47
  • Country: br
Re: Help with transistor calculations in a circuit
« Reply #5 on: October 05, 2020, 02:49:40 pm »
would a mc4066   be better ??
Thanks! Will definitely have a look at MC4066 if going with the mux approach.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3848
  • Country: nl
Re: Help with transistor calculations in a circuit
« Reply #6 on: October 05, 2020, 02:51:33 pm »
I did not look too close at the datasheet of the MCP41100 before, and never used these digital pots before either.

Now I had a closer look and it looks like JuanGg suggestion should also work.
Looks like it really is a programmable potentiometer, with all 3 terminals available to the user, and if you use the FET to switch one end of the potentiometer to GND it will work.

But it can be even simpler:
http://ww1.microchip.com/downloads/en/DeviceDoc/11195c.pdf
Quote
A  software  shut-down  feature  is  provided  that  disconnects  the  “A”terminal from the resistor stack and simultaneously connects the wiper to the “B” terminal.

Instead of adding a FET, you can use this software shutdown feature.

If you go with the MUX approach, there is no need to add an 4066. The 4051 has an "inhibit" pin that opens all switches of the MUX.


But whatever method you use. Also add a series resistor (and preferably also a small capacitor anything between 100pF to 10nF will be just fine ) as ESD protection.
« Last Edit: October 05, 2020, 02:56:20 pm by Doctorandus_P »
 

Offline xtvTopic starter

  • Contributor
  • Posts: 47
  • Country: br
Re: Help with transistor calculations in a circuit
« Reply #7 on: October 07, 2020, 07:17:29 pm »
Maybe you could try connecting the FET's source directly to ground, and have the potentiometer between the drain and your car stereo. That way you ensure that Vgs is enough to turn on the MOSFET, independently of the potentiometer's resistance.
When the MOSFET is on, it will connect one end of the pot to ground, else it will let it float.

    Juan
Hi Juan,
Thanks for the suggestion. I'm not sure if I got this right, but would it be to swap the connections I currently have between source and drain?
If so, it seems to stay shut all the time. I believe the problem I'm facing is that when it gets shut, the 5v rail drops to 1v. And it seems to never get out of this state.
Have tried to replace the 2n7000 by a BS250 (P-Channel complementary), but no success either.

I have though solved the problem with the shutdown feature suggested by Doctorandus_P.
 

Offline xtvTopic starter

  • Contributor
  • Posts: 47
  • Country: br
Re: Help with transistor calculations in a circuit
« Reply #8 on: October 07, 2020, 07:26:05 pm »
I did not look too close at the datasheet of the MCP41100 before, and never used these digital pots before either.

Now I had a closer look and it looks like JuanGg suggestion should also work.
Looks like it really is a programmable potentiometer, with all 3 terminals available to the user, and if you use the FET to switch one end of the potentiometer to GND it will work.

But it can be even simpler:
http://ww1.microchip.com/downloads/en/DeviceDoc/11195c.pdf
Quote
A  software  shut-down  feature  is  provided  that  disconnects  the  “A”terminal from the resistor stack and simultaneously connects the wiper to the “B” terminal.

Instead of adding a FET, you can use this software shutdown feature.

If you go with the MUX approach, there is no need to add an 4066. The 4051 has an "inhibit" pin that opens all switches of the MUX.


But whatever method you use. Also add a series resistor (and preferably also a small capacitor anything between 100pF to 10nF will be just fine ) as ESD protection.

Thanks again! The shutdown feature did the job!
I was a bit skeptical when I read about it in the datasheet. In my mind, once shut down I'd have to power cycle this IC to bring it back to life. But it's just a matter of sending a new command with a valid value.
It worked like a charm.
The only thing though is that the MCP41000 will start up active, with the pot at 50% position. And this will trigger a "demo" mode in the radio. But no big deal.
First time I'm working with digital potentiometers and they proved to be pretty neat.

Will definitely add the caps and resistor to make it ESD safer.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3848
  • Country: nl
Re: Help with transistor calculations in a circuit
« Reply #9 on: October 08, 2020, 02:09:38 pm »
There is a pin on that device with the name "SHDN"
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf