Solar controlled water pump project review - Page 1
Forum section: electronics / beginners

author: juantxorena
author_rank: Newbie
timestamp: January 19, 2025, 05:14:36 pm
content: 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:- TheTRS3221chip is for communicating with the solar controller (via a RJ-12 cable and modbus protocol). I have only tested it with aMAX3232, which is similar, but it has 2 channels, and no FORCEON orFORCEOFFpins, 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. Thedocs of the espsays 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 theDS3232, 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 theschematics 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 theWebench 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 thisLM5177chip. 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 thisLM61460chip. This time I set the output to 3.8V, and then I put anLDOwith high PSRR to remove the noise. Also, I will need an USB to program the chip for the first time, so I put anORingthing 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. Thedatasheet of the esp32recommends 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 thisLTC3290chip. 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.

author: SmallCog
author_rank: Frequent Contributor
timestamp: January 21, 2025, 11:08:14 pm
content: I'm not an electronics engineer, but I work with 4-20mA sensors and pumps for a living.If you have a nominal 12V battery, and a nominal 12V pump, why are you trying to use a DCDC to run the pump? Just control power to the pump by switching battery voltage to it via a relay (or Fet or whatever).Also, if your 4-20mA sensor is happy with 12V then just run it off the battery voltage too, no need to bump it up to 24V.Finally, most pumps won't like cycling on and off at 1 second intervals, you may have a shortened pump lifespan allowing it to do this. If it's doing this when water isn't being used then you may have a leak (potentially internal within the pump from the output to input if no water is dripping) or if it's doing it when you're using small amounts of water then the pump is potentially too large. The addition of a pressure accumulator will cut down on the cycling in this case.

author: Salome2
author_rank: Regular Contributor
timestamp: January 22, 2025, 02:06:10 am
content: The whole idea is to water some plants and this could be accomplished with so very very much fewer components, IMHO possible to get a circuit that works very well with perhaps a BOM or less than 30 total components.Why you would over-complicate such a simple task when this is completely unnecessary and the result is you have succeeded in creating something of a monster, a design that you deserve to have to deal with alone.You use some added ic's just for blinking a LED and also for debouncing switches while these tasls can be easily accomplished with a few lines of mcu code.I would strongly encourage you to reboot your design from the start with a goal of using the least possible number of least-complicated components and only embellish your design as needed once that design is working perfectly. You are not using mcu code to eliminate most of your added IC's to accomplish your goal. More thinking--->fewer components--->successful design.

author: juantxorena
author_rank: Newbie
timestamp: January 22, 2025, 03:46:47 am
content: Quote from: SmallCog on January 21, 2025, 11:08:14 pmBattery is nominal 12.8V, but as I said it can go up to 15V. Actually, for most of the day when the sun beats down it will be 14.4V. The pump tolerates 12V±10%, so I need a DCDC. I cannot power it from the solar controller directly.Quote from: SmallCog on January 21, 2025, 11:08:14 pmThe sensor is nominal 24V (like most.4-20mA sensors). It accepts 12V, but it's on the lower end. And when the battery is at 11V?Quote from: SmallCog on January 21, 2025, 11:08:14 pmIt's a small membrane pump (like 15cm long), there are no smaller pumps. It has a screw to adjust the water pressure and cycle on and off, as it's expected. It pumps into a pressure reducer to bring the pressure down to 2 bar, which is what the watering system needs. There are no leaks, and I'm not going to add an accumulator. A quick search shows that they are huge an expensive, I rather change the pump if it breaks.Quote from: Salome2 on January 22, 2025, 02:06:10 amLet me quote myself:Quote from: juantxorena on January 19, 2025, 05:14:36 pmQuote from: Salome2 on January 22, 2025, 02:06:10 amI added a simple Schmitt trigger for debouncing, the blinking led is an extra to use the other channel of the chip. I did a debounce in software in the previous version, but it's much easier to use a simple schmitt trigger for it.Quote from: Salome2 on January 22, 2025, 02:06:10 amMost of the components are power related, which I need anyway. About the rest, what would you change then?- TRS3221: I need it to talk with the controller.- ADS1114: I used the integrated a/d in the previous version and it sucked.- RTC: I added this for scheduling the watering periods. Inside the MCU is more complicated to do, and less precise because the clock drifts quickly.As I said:Quote from: Salome2 on January 22, 2025, 02:06:10 amThis is what I'm doing.

author: juantxorena
author_rank: Newbie
timestamp: January 22, 2025, 11:42:17 am
content: Quote from: SmallCog on January 21, 2025, 11:08:14 pmI've looking a bit more about this, and I might add a small water accumulator in the future, I didn't know there were small ones (like 0.5-1 l). However I would need to add a solenoid valve too, because I don't want to keep watering when I turn the pump off. However, i'm not super concern about this, I think the pump can handle some cycling 20 minutes per day.