Page 1 of 1

Garden automation electronics schematic

Posted: Tue Apr 02, 2019 2:28 pm
by Gerymake
Hello guys,

I am looking forward to setting up an automated garden with many different functions. I have already planned everything but I was wondering if someone may help me verify the electronics schematics and say whether there is something to be improved or not. Moreover, I would like to ask a few questions:

Is it okay to use an N channel mosfet instead of a 120 TIP in this case? (I have read they work slightly differently)
Is it better to control the 5V or GND with the transistor/mosfet? Why?

Would you implement any modifications to the circuit?
Captura.PNG (161.56 KiB) Viewed 909 times
Thanks in advance,

Re: Garden automation electronics schematic

Posted: Tue Apr 02, 2019 4:43 pm
by PhatFil
Im not sure about the switching device but afaik powering a motor/pump? from the 5v pin on a pi-0 isnt a good idea. a second psu devoted to the pump switched by the pi would be a better approach.

also imho dont bother with the soil sensor, this i am more confident about) even if you modified your circuit to switch its power off between readings, the terminals will still rapidly corrode and vary greatly in accuracy. you could attempt to braize larger mass stainless steel to its terminals to mitigate corrosion as much as possible but it will still need regular cleaning. look at capacitive moisture sensors there is the chirp on tindie and another option which i prefer is the mqtt 'hack' for the xiaomi miflora ble sensors..

Re: Garden automation electronics schematic

Posted: Tue Apr 02, 2019 6:53 pm
by Gerymake
@PhatFil The 5V pin would exactly power a solenoid valve ( I had read something about you just said, may it be a better option to opt for a relay and and external power source?

I was already planning on buying a capacitve soil moisture sensor ( ... -resistant) but I am probably gonna investigate about the Xiaomi model since it looks really nice.

Re: Garden automation electronics schematic

Posted: Wed Apr 03, 2019 6:30 pm
by ptimlin
Do you have an actual schematic you can share (the photo you posted is a wiring diagram)? Hard to comment when you can not see which components are being used in the design.

Re: Garden automation wiring diagram

Posted: Wed Apr 03, 2019 7:35 pm
by Gerymake
Unfortunately, I'm not a dab hand at electronics so I still can't get by doing a decent schematic. Therefore, I'm just gonna provide written information, complemented by the wiring diagram. Apart from that, I'd like to point out that I have read several threads regarding the main differences between mosfets/transistors and relays. I have come down to the conclusion that I'd may well be suitable to use a mosfet rather than a relay in this case (on my opinion). Am I right?
Captura.PNG (189.1 KiB) Viewed 814 times
Solenoid valve: "we tried this solenoid at various DC voltages and found we could actuate it down at 6VDC (although it was a little slower to open). Here is the current draw table for various voltages" - (more at

Current draw table for various voltages
6V - 1.6 A
7V - 1.86 A
8V - 2.0 A
9V - 2.3 A
10V - 2.5 A
11V - 2.7 A
12V - 3 A

Capacitive soil moisture sensor: "SPECIFICATION
Operating Voltage: 3.3 ~ 5.5 VDC
Output Voltage: 0 ~ 3.0VDC
Interface: PH2.0-3P" - Pihut (further info at

I'd be using this diode and mosfet:
- N-channel mosfet: ... et-30v-60a
- 1N4001 Diode: ... de-10-pack

Thanks in advance,

PD: Sorry if my English is not perfect, I am not a native speaker.

Re: Garden automation electronics schematic

Posted: Wed Apr 03, 2019 9:12 pm
by ptimlin
Hi again,

So a quick look and I don't see anything too concerning.

To answer your original questions.

1) yes I would go with the MOSFET over the TIP120 in this application. Even at lower currents the TIP120 (a BJT (bipolar junction transistor) would likely require a heatsink where as the MOSFET is probably OK. The drawback to a MOSFET is they are sensitive to ESD discharge, so you have to take proper ESD precautions when working with them, especially in dry climates or seasons where static discharge is more likely.

2) It doesn't really matter which side you put the MOSFET on, although traditionally with electronics you usually put it on the low side and pull it low to activate, and with low voltages like this there are no safety concerns about which side you switch. But you can do it which ever way makes more sense to you.

Re: Garden automation electronics schematic

Posted: Thu Apr 04, 2019 8:36 am
by Burngate
To enlarge on ptimlin's post, regarding whether to control the positive or negative side of the valve ...

If you want to control the positive leg using an N-channel FET, the GPIO would have to provide a voltage higher than the 12v feeding the valve to switch it on - not impossible but over-complicated.
Using a P-channel FET, the GPIO would have to provide a voltage close to 12v to switch it off - again, over-complicated.

Controlling the negative leg is very much easier, because both the GPIO and the negative of the valve are near zero all the time.

House wiring is different - when you switch off your light to change the bulb, you want the fitting to be disconnected from the mains for safety reasons.

Regarding FET (IRLB8271 for the PiHut ADA355) or TIP120 ...

When it's on, you want the drain-source or collector-emitter voltage to be as low as possible, so that all the 12v appears across the valve, as well as reducing the heat loss from the transistor.

The TIP120 can have about 1.5v across its collector-emitter when it's carrying 3A - that's 4.5W it'll have to get rid of. The poor little transistor couldn't manage that without a heatsink.

A FET works differently.
IRL I-V.png
IRL I-V.png (20.21 KiB) Viewed 779 times
With 3v on the gate, and 3A passing through, there could be as much as 7 or 8v across it, but driving it higher can reduce that drasticly, according to that diagram.

Fortunately the GPIO can provide 3v3, which means there's less voltage across the transistor so less heat, but I'd still give it a heat sink.