My first kicad project, Small Irrigation system

Hello guys.

Just made my first schematic on kicad and i need some input.
This thing is gonna be a small irrigationsystem for the backyard.
I have a 12V, 3.6W pump to be powered by a 12V battery that is being charged by a 35W solarpanel with a regulator.
I want to control this with a ESP32-C3 on a devkit board and a relay for the pump.
At first i was thinking i need to put the ESP32 to sleep between readings and controls but after doing a test setup with an older ESP32 devkit V1 and the solar panel i realised it will have no problems keeping the ESP32-C3 awake at all times since the solarpanel will even charge the battery on overcast days, and those days the pump won’t run anyway.
The schematics is quite messy up at the screw terminal but looks better on the PCB.
Not sure if a current limiter is needed by the relay, i just felt like i should put one there. And i am not sure at all how i should connect with the relay, it feels wrong when i look at it but i can’t see any other way.
I am also thinking i wanna move the two 1x2 screw terminals to the lower left, but not sure they’'ll fit there.
Anyway, this is a first draft.

Limit on only one media per post.

Your relay’s coil (pins 1 & 10) should have one side connected to GND.
The other side is pulled low by the ESP32 through an NPN transistor (like a 2N2222) or N-MOSFET, not directly from the ESP.
Also missing a flyback diode across the relay coil. Add a 1N4007 with cathode to the positive side to protect from voltage spikes when switching.

Thank you for your reply Bidrohini.
I made some changes so lets see if i understood you correctly, been quite some years since my school days.
Ground to 1 or 10 (1 i think in my case having a normally open relay).
A NPN transistor between relay coil and ESP, and here i clearly remember something about a current limiting resistor on the base.
And a flyback diode over the relay coil.
I have read something about a flyback diode over a motor as well.

FYI - I’ve made many Hydroponic Water and Air pump controllers using Arduino’s (Nano’s, Uno and Atmel-Chips)…

I never bothered with Flyback or other precautionary circuit enhancements for this very simple, low-loading ‘Dumb’ circuit stuff. And, never had a problem.

All the stuff is still running after more than 10yrs of service. 12V for the Pump’s and all circuits use Relay switches…

That doesn’t mean you should ignore other recommendations…

1 Like

A few rules of thumb when doing schematics. This will make it easier to read.

GND and (Negative symbols) point down and positive rails point up.
Dont run wires through components (J2 and J3)

On the PCB side make your power supply tracks thicker, especially around the relay to terminal for the pump.

You should mirror J3 and J5 (press X). That would remove most of the mess.
Mirror U1 (press Y) to get the GND downwards pointing.
Rotate J4 and J1 (press R) to get the power connections according to other’s suggestions.

Just my two cents - not KiCAD related, but good practice with place D1 directly across the relay coil. And the switching transistor may be the wrong polarity - an emitter follower is not what you want.

Alright, thanks guys for all the suggestions. I now have a V1.1 of the schematics.
I rotated, mirrored and flipped a few things around, moved the transistor to behind the coil, which is also something that is stuck in the back of my head from other things i used to do.
Perhaps this makes it easier to follow.

Edit: Wrong picture.

Edit2. Ah crap i see an error

Much better! It is good to give feedback and showing that you understood and accepted the suggestions. Unlike others that disapear after the first critique.

Nitpicking:
Move C1 and C2 a tick to the left / right.
Get rid of the dogbone between relais pin 1 and GND. Just place a new GND, they cost nothing. Plus the dogbone relais pin 10 J1 pin 1.
I personally would mirror U1 and J4 and connect J4 and U1 with wires (at least +12V). Input to the left, output to the right.
And rotate Q1 as it was in your first edit. This orientation confuses me (I’m a digiot).

I initially commented to the first edit. In between came a second one.

J2 pin 7?

padding characters

There was a wire between relay pin 9 and 2. I had it in a different rotation before and it got stuck in there.

Ok, i think followed most suggestions i was given on the schematics, thank you.
Now the question is, does it look like it would work?

A great improvement. It’s a lot easier to read now

What nickmBY said.

Also another small nit pick. Rotate D1 and it’s value.

Of course. I see that one too. It was correct earlier, but i rotated and mirrored back and forth :slight_smile:

It looks upside down, how about this?

Looks better. Now you can see there is something not right with the relay pin 1 and 5. Why connect GND to GND.

I dont think pin 1 needs to be connected. Guess it won’t do any harm but I would leave it unconnected.

Rotate the label of Q1.

Grounding either pin 1 or 10 was suggested in the first response by bidrohini.
Since i want a normally open relay i grounded pin 1 since that is not the one i am using.
Atleast that is how i interpret it.

I’m having issues with the Q1 footprint, it doesn’t seem to work in the pcbeditor. I am trying to use the SOT-23 SMD version.

No need to ground pin 1.
Pin 5 is the common pin. When there is no power on the relay it will be open so pin 1 connected to pin 5

When powered pin 5 and pin 10 will be connected so GND will then be connected to power the pump.

What component are you using for Q1?

Better. But the base should point left or right (right in your case) and the arrow (NPN/PNP) downwards. I know, others don’t care. But this way, it follows the top to buttom rule. That is just a suggestion, not a hard rule. The current flows from top to buttom, signals go from left to right. In your case I wouldn’t change anything more WRT “left to right”. Your schematic is simple enough.
Connecting relais pin 1 to ground really makes no gain. But it doesn’t hurt.

But again, nitpicking level and just suggestions!

I don’t mind nitpicking, i’m kinda like that myself sometimes.

Current flows from top to bottom, signals letf to right, i’ll try keep that in mind.

1 Like