Electrical – Controlling 12V water pump with NodeMCU – circuit design review

#nodemcucircuit-designreview

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.

Questions:

  • 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

Best Answer

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.