2N7000 mosfet?

Thread Starter

rougie

Joined Dec 11, 2006
410
Hello Ron_H,

Thanks for replying... I appreciate your help.

>Your schematic has a +5V supply. Is that the only one you have available?

No, there is another separate power supply powering the DAC and the MCU which is 3.3 VDC. These two power supplies don't interfere with each other. The 5VDC is for the IR circuit/Mosfet and the 3.3VDC is strictly used for powering the MCU.

You may look at the new attachment below. Here's what's happening, The MCU supplies 8 bit data to the DAC. It supplies it starting from 0 to 256. Therefore the DAC counts from 0 to 256 and supplies 0 to 5.0VDC to the gate of the mosfet.

When an object is introduced in the infra red's field of vision, lets say for the sake of this example... 8". The output of the MCU is constantly counting from 0 to 256. At binary 0, the DAC obviously outputs 0VDC at VGS. And at this instance there is obviously not current through the mosfet and therefore there isn't enough IR light to bounce off the object and back to the reciever. Therefore at this time the MCU does not see any signal form the TSOP.

As the MCU increments its output to 1, well, still, there is not current through the mosfet and therefore there isn't enough IR light to bounce off the object. The MCU needs to increment its output to approximately 100 where the mosfet's gate sees 2.1VDC which very little current starts to run though the IR led. However, even at this point there is not enough IR to bounce back to the TSOP sensor. Therefore, again, at this time the MCU does not see any signal form the TSOP.

From this point on, every increment the MCU output makes will increase the VGS hence increasing the current through the mosfet. It will come to a point where the MCU count may be at 150 which would provide a high enough VGS (approx 2.5VDC) to the gate of the mosfet. This will cause the mosfet to conduct enough current allowing the IR led to radiate enough IR light to bounce off the object and provide the signal to the TSOP reciever thus warning the MCU that a detection is made.

At this very instance, the mcu logs down the MCU's output count (150) that the DAC received. At this point here is my error:

I have a polynomial formula that takes that 150 and converts it to inches. The formula has been modeled from tests done by placing the object at various inches and logging down the respective amounts of counts to the DAC. This obviously works fine with the mosfet used during the modeling of the formula. But as soon as I change the mosfet, it is obvious that my formula won't work anymore due to the subtle differences from one mosfet part to another.

My IR led draws approximately 0 to 100ma starting from a VGS of 2.0 to 5.0VDC respectfully.

I just thought about something, that might just work. I could read into the MCU the current through my IR led. Which means I would need a current to voltage converter. I can then perhaps re-model my formula in accordance to the distance vs IR led current relation. Then I would know that at a certain current, I must be at a certain distance.

What do you think?
Thanks for your help.

r
 

Attachments

Last edited:

Thread Starter

rougie

Joined Dec 11, 2006
410
No sorry I stand corrected, this particular dac
has its reference pin connected to 5vdc so it can output
0-5Vdc.

So if I use an opamp to convert the current
to a voltage .... i suppose this is possible right?

thanks
r
 

LDC3

Joined Apr 27, 2013
924
So if I use an opamp to convert the current
to a voltage .... i suppose this is possible right?
The DAC output from the MCU is a voltage (with very little current).
What you want to do is control the current through the LED using this voltage. If all things were equal you could use an unity gain op-amp to supply the current to the LED.

Unfortunately, the forward voltage drop of the LEDs vary and the resistors also vary.

What you need is a very precise 10Ω resistor (so you can get an accurate measurement of the voltage for the feedback) connected to the LED and current limiting resistor. For a 10mA current, you will have 100mV across the feedback resistor.

You will need to see what range of current you need to determine the feedback to the op-amp.
 

Ron H

Joined Apr 14, 2005
7,063
Here is a circuit you can use. With a 5V supply, the Darlington is a better choice than the 2N7000.
I used a quad op amp, so you can make multiple LED drivers.

The current through the Darlington transistor (and the LED) is sensed by R1. This voltage is fed back to the op amp. The feedback forces the + and - inputs of the op amp to be equal. Therefore, as the DAC output ramps from 0 to 5V, the current through the LED ramps from 0 to 100mA.

What is the part number of your DAC?

EDIT: Corrected schematic.
 

Attachments

Last edited:

LDC3

Joined Apr 27, 2013
924
Here is a circuit you can use. With a 5V supply, the Darlington is a better choice than the 2N7000.
I used a quad op amp, so you can make multiple LED drivers.

The current through the Darlington transistor (and the LED) is sensed by R1. This voltage is fed back to the op amp. The feedback forces the + and - inputs of the op amp to be equal. Therefore, as the DAC output ramps from 0 to 5V, the current through the LED ramps from 0 to 100mA.
I think the DAC should be connect to the +in of the op-amp. Otherwise you need to set up a voltage divider for the +in, not just a resistor to ground.
 

Thread Starter

rougie

Joined Dec 11, 2006
410
Hello Ron_H,

Wow!, that's a nice circuit... I still haven't had much time to review op amps... but I am sure this circuit will do just fine.
:cool:

I have a few questions though before I try and build the circuit. I really would like to rationalize it a little so that I know a bit of what's going on if I may.

For starters, after your post with the circuit, I have began to try to understand the basics of an op amp. Here is my first question:

If you go to (min. 4:45) of this utube video, he claims that the output of the
opamp will be 7V. Please view it here:

http://www.youtube.com/watch?v=K03Rom3Cs28

Then if you look at the attached document, we see a formula used to calculate Vout for an inverting opamp... like the one in the video:

Vout = -Rf/Rin(Vin)

My question is, why is it that when I use this formula for the example in the video, I get -8VDC as Vout instead of 7V???

Vout = (-20K/10K)4V
Vout = -8VDC ???

The only difference I see between the two circuits is that in the document the non-inverting input is tied to ground and in the video it has +5VDC potential.

Having said that, a beginner may wonder why the formula wouldn't work for both circuits since the formula itself doesn't take the voltage at the non-inverting input into account???

Anyways, any feedback/help is appreciated!

Thanks all
r
 

Attachments

Last edited:

Ron H

Joined Apr 14, 2005
7,063
Hello Ron_H,

Wow!, that's a nice circuit... I still haven't had much time to review op amps... but I am sure this circuit will do just fine. I wish I could come up with circuits like this myself! :cool:

I have a few questions though before I try and build the circuit. I really would like to rationalize it a little so that I know a bit of what's going on if I may.

For starters, after your post with the circuit, I have began to try to understand the basics of an op amp. Here is my first question:

If you go to (min. 4:45) of this utube video, he claims that the output of the
opamp will be 7V. Please view it here:

http://www.youtube.com/watch?v=K03Rom3Cs28

Then if you look at the attached document, we see a formula used to calculate Vout for an inverting opamp... like the one in the video:

Vout = -Rf/Rin(Vin)

My question is, why is it that when I use this formula for the example in the video, I get -8VDC as Vout instead of 7V???

Vout = (-20K/10K)4V
Vout = -8VDC ???

The only difference I see between the two circuits is that in the document the non-inverting input is tied to ground and in the video it has +5VDC potential.

Having said that, a beginner may wonder why the formula wouldn't work for both circuits since the formula itself doesn't take the voltage at the non-inverting input into account???

Anyways, any feedback/help is appreciated!

Thanks all
r
You did not understand the video. You also used a textbook equation that has zero volts on the +input, which is not wrong, but is not general.

Watch the video again. The part in the beginning about the op amp having VERY high gain, causing the + and -inputs to be approximately equal when feedback is applied, is CRUCIAL to understanding op amp feedback circuits.

See the attachment.
 

Attachments

BobTPH

Joined Jun 5, 2013
11,677
If you want to control the current through and LED with a voltage, use a voltage controlled constant current source. This is as simple as a BJT with the LED in the collector circuit and a resistor from emitter to ground. The current will then be controlled approximate to (Vb - 0.7) / Re.

Bob
 

Ron H

Joined Apr 14, 2005
7,063
If you want to control the current through and LED with a voltage, use a voltage controlled constant current source. This is as simple as a BJT with the LED in the collector circuit and a resistor from emitter to ground. The current will then be controlled approximate to (Vb - 0.7) / Re.

Bob
This is true.
The feedback VCCS removes the Vbe offset and nonlinearity by putting them inside the feedback loop.
 

Thread Starter

rougie

Joined Dec 11, 2006
410
If you want to control the current through and LED with a voltage, use a voltage controlled constant current source. This is as simple as a BJT with the LED in the collector circuit and a resistor from emitter to ground. The current will then be controlled approximate to (Vb - 0.7) / Re
so you mean from R4 wiper go straight to Q2 and remove U1, R5
and Q1?
 

Thread Starter

rougie

Joined Dec 11, 2006
410
You did not understand the video. You also used a textbook equation that has zero volts on the +input, which is not wrong, but is not general.

Watch the video again. The part in the beginning about the op amp having VERY high gain, causing the + and -inputs to be approximately equal when feedback is applied, is CRUCIAL to understanding op amp feedback circuits.
okay Ron_H... I see now...

thanks
r
 
Top