based on the feedback I got yesterday on my relay issue (thread here, I decided to change my original plan and to use a N-Channel MOSFET as a switch and an H-Bridge to drive my latching water valve.
Here is the diagram:
and here is what I want to accomplish:
The soil moisture sensor needs to be powered on for a short period of time (90ns) prior to me taking a reading, so my idea there is to turn
HIGHto power it on and then do a
analogRead(A0)to get the value from the sensor. The sensor needs a minimum of 3.5V hence why it is connected to the 5.5V rail.
Once I have read the sensor value and sent it to my server, it will tell me whether I need to open the vale or not. If I need to open it, I will set
HIGHto enable the H-Bridge and then set
LOWto open the valve. If I need to close it, I will set
HIGH. The pink and purple wires will be connected to the valve and it will be powered through its own 6V battery.
Is my wiring somewhat correct? I thought it would be good to put a diode in parallel with the valve, but I am not sure I have put it the right way.
Thoughts on how I could improve this project?
Thanks a lot in advance,