 Transistor not functioning as expected

I am trying to control a valve that takes a 2-10v input, and 24v for power. To simplify my setup, I’ve bought a 24v-12v 2W dc to dc converter, so my 24vdc source can power the valve, the Arduino (12vdc in) and have enough power for the valve input.

To generate my 2-10v input, I have a 2N3904 transistor controlled via the Arduino analogWrite function.

I used circuit lab to test my circuit, and I was able to produce my desired voltages with a 600 ohm resistor on the collector side, a 100 ohm resistor on the emmiter side, and outputting 0.7 to 2.7 volts from the arduino.

However, when I built the circuit in real life, I can’t get below 3.10 volts. What am I missing? Why the 100 Ohm resistor from emitter to ground? Why no base resistor?

By base you mean the inbuilt resistance of the transistor?

If so, it's because that can fluctuate and is not incredibly reliable. Every tutorial/examples I've seen have added an additional resistor to eliminate the errors.

The base-emitter junction looks, to the Arduino output, like a diode. As soon as the diode is forward biased it turns on and will conduct as much current as it can. There is no inbuilt resistance so the base resistor limits the current out of the Arduino output to a safe value (recommended less than 20mA).

You have presented an XY problem. You have a solution to a problem that you want us to help you with, but we don’t fully understand the problem. There may be easier or better ways to accomplish your goal if we have all the details.

If the valve takes 2 to 10V why not control it with an Arduino output?

How much current does the valve require from the 2 to 10V line? Can you post a data sheet for the valve? What else is connected to the Arduino? A schematic that shows all components and power supplies would help us to help you. Which Arduino board are you using?

What Arduino are you using that provides a 1KHz sine wave output?

Steve

The OP's circuit: A bipolar transistor can be thought of as a "current controlled constant current sink [NPN] or source [PNP]". At least, until it nears, or reaches "saturation".

You're circuit, is, essentially, a "voltage controlled current source that is driving a 600 resistor". I sound like I'm contradicting myself, right? First I say an NPN transistor is a "current controlled current sink", then I claim "voltage control" for your circuit. What makes the difference, is that 100Ω resistor, in the Emitter leg.

Let me explain. Because the Emitter-Base junction will maintain a nearly constant 0.7V, when forward biased, any excess voltage, applied across the Base-Emitter junction, will appear across the Emitter resistor [i.e. the 100Ω resistor]. Applying Ohm's Law we see that: IE = IR3 = (VIN - VBE)/R3 = (VIN - 0.7)/100Ω

Thus, for:
VIN = 0.7V IR3 will be: (0.7 - 0.7)/100Ω = 0
VIN = 2.7V IR3 will be: (2.7 - 0.7)/100Ω = 20mA

Notice how the input voltage influences the output current.

The current through R4 will be nearly the same as the current flowing through R3 [as long as the transistor is not at, or near saturation]. Specifically: IC = IE - IB And, IB = IC/hFE And, hFE is a measure of the Current Gain of the transistor -- a value that you can find on most transistor datasheets. This is usually a value between around 20 and a few hundred. So, notice that IB is significantly less than IC. Thus, it barely impacts IE. allowing us, in the case, to call IE equal to IC.

Thus, when VIN is 0.7V, the voltage across R4 is: 0mA * 600Ω = 0!
And, when VIN is 2.7V, the voltage across R4 is: 20mA * 600Ω = 12V -- or would be, if there was enough voltage left for it to go that high. And, the fact that we run out of voltage, on the output, when VIN is at 2.7V, is why the output waveform is flattened at the bottom!

And, this running out of voltage is one reason why this particular circuit is probably not suited to your purpose.

A, perhaps, better choice, would be to remove R3, and add a resistor before the Base [i.e. between the Base, and the Arduino output]. Here's a formula for determining that resistor: RB = (VOUT - VBE)/IB where "VOUT" is the Arduino output voltage when the output is HIGH. And, if we want IB to be 20mA [as previously suggested], then: RB = (5V - 0.7V)/20mA = 220Ω

BUT: XY Problem, as groundFungus suggested, so we really can't make relevant recommendations until you give us more information. Try reading: How To Use This Forum

BTW: for an NPN transistor, like you feature in your circuit, the Emitter-Base junction is forward biased when the Base is sufficiently positive, with respect to the Emitter.

I would use Arduino pin -> RC low pass filter -> opamp x2 non-inverting stage.

Alternatively use 10V regulator to power a transistor level shifter from Arduino pin, then low pass filter the output.

What is the input impedance of the valve?

I have attached the valve specs.

The valve is assuming you will have a 4-20 mA control signal, and expects you to put a 500 ohm resistor in parallel for you to generate the 2-10 volt input.

The sine wave output was mearly a way for me to view a changing output from the arduino, so that I could see what values I needed to output from the arduino to have the required voltage on the collector side.

B214+LRX120-SR.pdf (1.06 MB)

I read that as the valve is assuming 2V to 10V input, there is an optional 500 ohm resistor (ZG-R01) you need for current loop control. Without the 500 ohm resistor the input impedance is 100k.

Hi,

To generate my 2-10v input, I have a 2N3904 transistor controlled via the Arduino analogWrite function.

What makes you think analogWrite outputs an analog signal?
What model Arduino are you using?

analogWrite usually outputs a PWM signal.
What values of analogWrite are you trying?

Can you post your code and a schematic of your project, including the Arduino and power supplies?
Just a picture of a hand drawn circuit in jpg, png will do?

Thanks.. Tom.. Hi,
If you were using DC this would be the case; Here Vout or Vc = 4.4V + 0.95 = 5.35V

But I think you are using PWM so the DMM values will be lower.

This thread give you any info? https://forum.arduino.cc/index.php?topic=634377.msg4294943#msg4294943
You never replied.

Tom...  