Hi everyone,
I’m currently working on an IoT project using an ESP32, and I’ve run into several challenges related to circuit design, power management, and signal interference. I’m fairly new to IoT systems and have limited knowledge of electrical circuits, so I’d greatly appreciate your advice.
Project Overview:
The project involves using an ESP32 to control the following components:
- N20 motor with an encoder
- Hall effect sensor
- Servo motor
- Solenoid valve
- Power management using MOSFETs
The software is written in Arduino, and my goal is to have the ESP32 manage power delivery to all components dynamically. When the circuit starts, only the ESP32 should be powered on, with no voltage supplied to other devices. After receiving a command from an MQTT broker, the ESP32 should deliver 3V, 5V, and 12V power to the components and execute the program logic. Once the process is complete, all components except the ESP32 should power down to await the next command.
I’ve attached a diagram of the circuit and provided a Larksuite link to a detailed IoT device architecture
IOT diagram link
Problems I’m Facing:
- Diode Configuration and Circuit Wiring
I’m unsure if my wiring is correct according to electrical principles, particularly the placement of a 1N4001 diode. The diode is intended to prevent reverse current flow between the ESP32 → MP1584 module → MOSFET (LR7843). Could you please confirm if my wiring is correct or suggest the proper configuration?
- MOSFET Issue: Unexpected Voltage Output
The MOSFET (LR7843) connected to an MP1584 module outputs 3V even when no PWM signal is sent from the ESP32. I measured the voltage between Power + and Load GND using a multimeter.
- My goal is for the MOSFET to remain at 0V initially. When the ESP32 sends a PWM signal, the MOSFET should allow current flow to the MP1584 module, which converts 12V to 3V.
- Is there an alternative to the MP1584 module that would be more suitable for this setup, preferably at a reasonable cost?
- Relay Usage for 12V to 5V Conversion
I am currently using a 2-channel relay to control the 12V to 5V conversion, but this feels like a temporary workaround. Ideally, I’d like to use a MOSFET (similar to the MP1584 issue above) to manage this conversion without using relays. However, I’ve encountered reverse current issues similar to Problem #2. Could you suggest how to address this problem effectively without relying on relays?
- N20 Motor Encoder Issue
The encoder on my N20 motor sends pulse signals to the ESP32 even when the motor is not running. The motor requires 5V power, while the Hall effect sensor for the encoder uses 3V. I noticed the encoder’s LED is always on, and pulse counts keep increasing in the Arduino Serial Monitor.
- To troubleshoot, I simplified the circuit to only include the ESP32, N20 motor, an L9110s motor driver, and a simple power supply (Deek-Robot P-11 module for 3V/5V DC conversion). In this setup, the encoder worked perfectly, and the pulse signals were accurate.Based on this observation, I suspect the problem might relate to my main circuit’s power management design or Problem #2. Could you advise if I need to change any components or reconfigure my wiring?
If anyone in the community could guide me or suggest better components/modules for my setup, I would be very grateful. Thank you in advance for your help and for taking the time to read through my detailed explanation!


