Hello everybody,
I would like to ask for help on this project I'm doing for controlling a water pump for watering my balcony plants with an esp32. This is actually the second version of the project, my first version was much simpler, with prebuilt DC/DC modules, a devkit, etc. It worked, but some parts weren't very good, and I had fun doing it, so I want to do an improved version with a proper 4 layer PCB with SMD components and some improvements. I studied something related to electronics, but I've always worked in higher level software development, so I would say I'm a noob. For now I'm asking for a review of the schematics. Once everything is ready and I do the PCB, I will ask for help for that, too, but for now the schematics are enough.

The general idea is in the diagram I pasted. A solar controller with a battery gives 12.8V nominally (although it can change from 11 to 15V depending on the state of charge of the battery, the sun, etc.), which powers everything. The esp32-c6 chip has two sensors, a water switch which is closed if the water tank is empty, and a water pressure sensor that I use to know how much water is in the tank (it's a 4-20mA sensor, powered by 24V, although it accepts 12-36V). The water pump works with 12V and a max of 2.5A (much less in reality). Also, it turns itself on an off intermittently depending on the pressure of the watering hoses (maybe 1 second on, 1 off). This might be important. The whole project is completely overengineered, but I want it like this.

The 1st part of the schematic is the esp32-c6 chip and sensors. Most of the things are tested in a breadboard, so I know it works, but I have some questions:
- The
TRS3221 chip is for communicating with the solar controller (via a RJ-12 cable and modbus protocol). I have only tested it with a
MAX3232, which is similar, but it has 2 channels, and no FORCEON or
FORCEOFF pins, so I'm not sure if I connected them correctly. Ideally I would like for the chip to turn off if it's not being used, but I don't know if this would work. I (esp32) am the one always starting the communication with the the controller, so maybe it would never turn on? Or maybe it will be always on if the cable is connected with the controller, or something.
- The DS3232 has a 32kHz clock signal, that I could use although I don't really need it. The datasheet says that the output is between 0-2V. The
docs of the esp says that the amplitude should be less than 1V, so less. I've tried with a voltage divider, capacitors, etc., but the signal is no recognized unless I connect it directly to the pin. I don't know what's happening here.
- Also about the
DS3232, I wanted to use a rechargable battery, like a VL2020, but the circuit for charging seems too complex, and considering that it would be constantly charging while the device is on, the lifespan of the battery would be around 8-10 years, which is less than a normal battery would last, so it doesn't worth it, unless I'm missing something here?
- That schmitt trigger thingy with a led is because I needed one for debouncing the water switch, and the chip had two, so I thought I could have a blinking power led to save some battery (instead of an always on). Maybe it's stupid, I don't know.
- I have 2 push switches there, that I need for programming the chip. I have to push one of them, and then the other, and release both, to set the chip in flashing mode, but it's a bit stupid to have them only for the 1 or 2 times I will need them. I would prefer if I wouldn't need them, but I don't know how to avoid them.
- Maybe the pullup resistors for the I2C bus aren't needed and the internal pullups of the esp32 are enough?
- Other things I've copied from the
schematics of a devkit.

Next part is the 12V power for the pump. I have no idea what I'm doing here, I just went to the
Webench power designer in the ti site, set the parameters I need, and copy pasted one of the designs that look good to me, this one is based on this
LM5177 chip. I modified some things:
- I connect the EN/UVLO pin directly to the GPIO pin that will turn it on and off. I guess it's ok.
- There are some current monitor things that I have no idea if I need them, or how can I control them. I don't understand the datasheet of the chip about this. I think I have disabled the output current limit (via the Rcfg) but I have some related circuit for it (CSA and CSB pins). I also don't know if I need this spread spectrum thing to reduce noise (maybe it affects the wifi of the esp32?), or this hiccup mode, or the fpwm mode vs the auto mode, etc. Maybe these things are affected by the fact that the pump turns on and off?
- What about EMI? DO I need to care about this?
- I'm out of my depth here? Is there any other suggestion instead of building the DCDC my own? I haven't really found any DCDC module which suits this. In my first version I used a traco power which costs 50€, but this design apparently costs only 5-6€.

Next it's the 3.3 power for the esp32 and related things. As before, I have no idea, I just copied another design of the ti tool, this time based on this
LM61460 chip. This time I set the output to 3.8V, and then I put an
LDO with high PSRR to remove the noise. Also, I will need an USB to program the chip for the first time, so I put an
ORing thing so I can power the stuff with either the USB or the power, which goes to the LDO. Some questions:
- Is the ORing thing ok? Is it needed? tbh I did this some time ago and I don't remember why I put those values on the resistors.
- Does this oring thing makes sense? Is it needed? As with the buttons of the esp32 part, it feels a bit stupid to have this circuit only for 1 or 2 times I'm going to use it.
- I have set the frequency of the PWM part to 2.1MHz, because I've seen in the datasheets of the LDO that it has a peak on the PSRR at that frequency, so maybe it's good (and I use a smaller inductor). Maybe I'm understanding this wrong, and it would be better to use just the smallest frequency possible.
- As before, what about EMI?
- I think 1A is enough. The
datasheet of the esp32 recommends a minimum of 0.5A power source, it consumes about 300mA when transmitting wifi, and with all the other chips I'm using, I think 1A is enough. Maybe I should use a 2A LDO just in case?

Finally is the 24V power for the water pressure sensor. Since it will need a max of 20mA only, I'm using this charge pump circuit based on this
LTC3290 chip. I think I've configured it correctly. I'm controlling if it's on or off with the enable pin directly with a GPIO of the esp32, because I will measure this every 10 minutes or so so I don't need it to be always on.
It was a very long post, sorry, maybe I should have separated it in multiple posts.
I welcome every comment or suggestion about my design. Thanks for the help.