# What should be the value for the resistor for this circuit

ledresistorstransistors

Sorry for this silly question but I am not from an electronics background. I am trying to build a very basic circuit with npn transistor to detect a certain water level. I am assuming the resistance of water to be 200k ohm thats why I have connected a 200k ohm resistor between base of transistor and positive terminal of battery. The transistor will be acting like a switch to allow a bigger current to light up the led. I will be using a 15 v power adapter (it says its a 15V ~ 533mA source) and I can't use another and a 3V led. Transistor is a NPN BR N5551 bg49.

My question is what should be the value of resistor X so that I don't burn out the LED. First off, your transistor is backwards. Emitter should connect to ground.

Switching to an N-channel MOSFET instead of a BJT would make it simpler, since it is a voltage driven device, not current,

You will need to bias the transistor so it can switch on when the voltage across the water sensor rises past a certain point. Using a simple resistive divider with the right values should do the trick. Something like: simulate this circuit – Schematic created using CircuitLab

Assuming ~200KΩ resistance for the water probe, that resistance along with R2 will form a voltage divider with the voltage either 0V when the water tank is empty, or ~12V when it has water (you can reduce R2 to reduce the sensitivity). That then switches on Q1 into saturation mode, where it allows current to flow, thus illuminating D1. Note the gate threshold voltage should be no more than half the gate's on voltage, so around 5V would be fine - or even lower.

The value for R1 is calculated assuming a 2.2V forward voltage (Vf) and 20mA current (If) for D1, and is:

\$R = \frac{V_{IN} - V_F}{I_F} = 640Ω\$

To allow the power supply to vary (especially if it's not a regulated one) a higher resistor should be selected - I have gone for 1KΩ. There would be little or no visible difference in the light. You could even go higher, say 2.2KΩ, and it'll still be plenty bright enough, and use less current.