I'm a programmer who's recently become fascinated by electronics, specifically with microcontrollers and how I could use them for various IoT projects.

For a starting pet project, I'm planning to automate some of the watering in my garden. After a few days of learning, I've come up with the below circuit.

The board I'm using is NodeMCU v3, the image shows an Arduino Uno just because that's what my circuit design software had. I've tried to add notes to explain why I've used a component.


  • Overall, I'd appreciate any feedback. I'd like to know whether I've done anything crazy and/or what I can do to improve/simplify the circuit.

  • I'm powering the moisture sensor via a digital output pin, so that I could only provide power when I want to take a reading, therefore prolonging the lifetime of the sensor. This is the sensor I'm using. Is that a good idea or is it even going to do that?

  • I'm powering the board and the pump with a single power supply. Is it okay if I connect the USB cable, to reprogram the controller, while it is all connected? otherwise, what could I do to safely reprogram it while disconnecting as little as possible?

Circuit design

  • \$\begingroup\$ Welcome to EE.SE! Please provide a schematic. \$\endgroup\$ – winny Sep 10 '19 at 8:15

The application looks like turning on the motor depending on the data of the moister sensor.

  1. what is the point of switching on and off moisture sensor , instead you can power the sensor directly to 3.3v.

  2. Coming to flashing of code into nodemcu , you cannot connect USB to board when there is external power supply. You have to remove external power supply and connect USB to flash the code. There is another way called OTA(over through air) where you can flash code into nodemcu without using USB.The host computer should connect to the nodemcu through WIFI and flashing can be done through air. Explore about OTA on nodemcu.

  • 1
    \$\begingroup\$ Thanks for the tip for OTA flashing Tarun. The point of switching the moisture sensor is to prevent fast corrosion by only driving it when I want to take a reading. I'm not sure if that's going to make a difference though, that's why I'm asking "Is that a good idea or is it even going to do that?" \$\endgroup\$ – Saeb Amini Sep 10 '19 at 4:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.