Choosing / wiring transistors/resistors to output 5V for homemade sensors

Hellos!

I'm building a system that controls moisture levels

The sensors are exposer endings of copperwire spread brushlike

one sensor consists of two wires / brushes somewhat apart of each other

currently the board outputs 5v to all sensors all the time but gives reasonable results

I would like to output power individually per sensor and only when the measurement is taken.

The measurement is simply read with analog input frim the other wire.

I can do it with relays, but i think it is overkill

Transistors would be sufficient, but I have no idea which ones to choose

Board outputs 5V 500mA, right?

These are the transistors that i currently have:

What kind of transistors should i use?

Do I need a pullup/down resistor for each digital output?

What kind of resistor? 1KOhm? 10KOhm?

Any hints on making the wiring as simple as possible?

Can I skip the whole transistor thing and use DIGITAL OUTPUTs to produce the 5V?

Are they different from the 5Vcc pin current- / voltage-vise?

current protosetup:

Greets,
Wictro

Use a digital output as long as resistance to ground > 1k

Thanks for your answer!

Would 1k be sufficient, or do you mean that it should be 5k or 10k?

If You want to switch positive polarity then you should use a pnp transistor.The first PNP(2N3906 i believe) one from the list should do the job.You can simply connect it's base to a digital pin via a 1k resistor instead of like in the picture and wire your sensor in place of LED.Also you don't need external power like on the picture,but you can use the 5v pin of the arduino.Just make sure if you're powering it from PC over USB that you don't draw too much power or the usb protection fuse will engage and disable power over usb.

Cheers,
Leon :slight_smile:

iron-man-led-eyes-arduino-external-power-source-ci.jpg

Would 1k be sufficient, or do you mean that it should be 5k or 10k?

Yes.

Avoid more than 5 mA per pin (then you are on the very safe side) => 1k is a good start.
Choosing the suitable resistor is a trial/error. Choose a value taht gives you a suitable reading (close to middle range) when the soil conditionsa are 'just perfect'. The it is easy to determine 'status'..

Thanks again for the replys!

Can I use (Voltage (V) / Resistance (Ohm) = Current (I)

So 5V / 1000ohm = 0,005A = 5mA?

How much is too much? I have found estimates of max current for digital pins to be around 20-40mA

Basically it's only a short pulse max 2 seconds once an hour, so that helps a bit.

I hope that it's enough to get a reading, if not then it's time to use transistors, I guess.

I could use 2 outputs to halve the stress, right?

1)Your calculation is correct :smiley:

2)It depends on your total current consumption.You can read more here:
ArduinoPinCurrentLimitations

Pay attention to the pin SOURCE current limitations section right under the first image

3)Considering all of this,just to be on the safe side, I wouldn't hesitate to use the transistors.After all,it's cheaper to put them than to risk a 3$ clone or an original board whose price can be more than 20$

I'm hoping it helped :smiley:

That's useful info!

I made the wiring with 10Kohm resistor, and I get a decent reading (450'ish) when pressing the wires against my tongue :smiley:

Now I have to make some different sensors and see witch kind would give decent results on different surfaces and are easy to make so that they are all identical.

I have now four pairs of wire as sensors. Each positive lead gets power from digital output. The other wire goes to ground trough a 10Kohm resistor.

They are powered up one by one in a sequence.

I measured the current flowing trough each, and all showed 0,33 on multimeter when the meter was dialed to 20m setting.

I understand that it means i have 0,33 mA of current flowing, and the arduino max is about 20mA

Using the formula 5V / 10000ohm = 0,0005A id presume there is a Voltage drop of 5V --> 3,3V

as 3,3V / 10000ohm = 0,00033A

Is this normal?

I'm powering the arduino from pc USB socket

The highest maximum is around 40mA and I concluded that you have a multimeter,so you can measure the voltage drop.Just turn the pin high without anything connected,and measure the voltage,then you do the same with the sensor connected.:wink: