Schematic&PCB design: Watering system (motor+relay, SD card, RTC...). Feedback?

Hello everyone!

This project has been sitting on my desk, waiting to be finished for a while now, and I'd like to wrap things up by finally ordering the PCBs.

As I'm a beginner with little experience when it comes to circuit and PCB design, I'd appreciate your feedback on both the schematic and the board layout before placing the order.

A couple of things that I'm specifically unsure about:

  • Which capacitance value between GND and V+ is a good choice? The board generally consumes about 140mA peak current and is powered with 5-6V at it's input. This then gets regulated to a continous 5V by the LDR. I have no real idea on how to estimate a ballpark number for a suitable capacitance.

  • Should I add a small capacitor in parallel to motor to compensate noise created by the brushes?

  • Since I aimed to reduce the board's footprint by strategically placing the components, some copper traces are quite long (especially those of the SD card). I chose a 0.45mm trace width for the most part to reduce the resistance, but reduced the width to 0.254mm when passing in between the pins of the Arduino nano (for clearance). Since there are no particularly high currents flowing in the system, I would assume that's fine, but I'd like to hear other opinions on that.

  • Can/should I add any kind of transient absorption for the relay and/or the motor? The two flyback diodes should take care of dissipating the kickback current, but I have been measuring voltage spikes of about 9V at the relay's output pins in my prototype circuit regardless. I'm using this standalone relay unit. Would it make sense to add another diode in parallel to the output of the relay...? I tried adding various capacitors (electrolyt and ceramic, various values) parallel to the relay output, but that didn't change anything.

Unfortunately, I don't have access to an oscilloscope, so I have no accurate data on the spike's shape or duration. The transient might also be higher than the measured 10V, as I don't know how quickly my multimeter can pick it up. I just measured across the terminals with my multimeter during switching, both with and without a load attached to the output of the relay. In both cases I read a spike (10V with no load attached and about 8V with the motor being turned on/off).

As the whole unit is powered by a 18650 battery, I don't have the option of separating the motor and controller circuit. The concept is to make the entire system run autonomously on one battery and a solar charger.

I appreciate any feedback, thank you in advance!

Tom

Solar_Watering_System_V2.0.pdf (15.1 KB)

Do not drive K2 from a i/o pin.

Use a driver ! Maybe add a LED to show if the relay is picked.

Add Vcc reservoir capacitors (47uF) to all peripherals, may as well to add decoupling too (100nF).

A power LED is nice to have.

Your traces can be wider, power ones can be 50-70 mil. Use a GND plain too.

Your Vias are quite small.

Might want to make Q2 a MOSFET.

Have the option having a 100nF capacitor to GND on Soil and Water sensor inputs.

Have you breadboarded and tested the circuit, the questions you ask suggest not ?

Thanks for the reply!

larryd:
Do not drive K2 from a i/o pin.

Use a driver ! Maybe add a LED to show if the relay is picked.

Why would you suggest against using an I/O pin to trigger the relay? Just because of the current draw or is there another reason for that?

If using a driver, I would opt for a simple bipolar NPN low side driver circuit to keep things simple. Would that be fine?

Maybe I'll add the LED to visualize the triggering, good point.

larryd:
Add Vcc reservoir capacitors (47uF) to all peripherals, may as well to add decoupling too (100nF).

A power LED is nice to have.

Alright, I will put both the suggested capacitors to the peripherals. Any reasons why 47uF specifically? Or is it just a standard size for this application? The decoupling capacitors then go in parallel to the reservoir ones and should be physically close to the Vcc/GND terminals, correct?

While looking up decoupling capacitors, I also saw that ~100nF capacitors are often added to input and output of LDRs, so I'll put them there as well.

I intentionally left out the power LED, since the whole circuit needs to be as power efficient as possible. I use the RTC to wake up the controller from deep sleep only twice a day. I use the "service" LED to indicate the wake up.

larryd:
Your traces can be wider, power ones can be 50-70 mil. Use GND plain too.

I'll widen the power traces. 70 mil = 0.7mm?
GND plains are present on either side of the PCB, I just set to invisible for clarity sake (should have mentioned that in my original post, sorry).

EDIT:

srnet:
Have you breadboarded and tested the circuit, the questions you ask suggest not ?

Of course I have, and it works perfectly well. But that doesn't mean there's no room for improvement, that's why I'm asking for feedback...

Why would you suggest against using an I/O pin to trigger the relay? Just because of the current draw or is there another reason for that?

Current draw.

If using a driver, I would opt for a simple bipolar NPN low side driver circuit to keep things simple. Would that be fine?

Sure but a SMD MOSFET would be the best way.

Alright, I will put both the suggested capacitors to the peripherals. Any reasons why 47uF specifically? Or is it just a standard size for this application?

47uF is a standard value, 22uF would work too.

The decoupling capacitors then go in parallel to the reservoir ones and should be physically close to the Vcc/GND terminals, correct?

Yes

While looking up decoupling capacitors, I also saw that ~100nF capacitors are often added to input and output of LDRs, so I'll put them there as well.

Sure, note, you can always have pads for them.

I intentionally left out the power LED, since the whole circuit needs to be as power efficient as possible. I use the RTC to wake up the controller from deep sleep only twice a day. I use the "service" LED to indicate the wake up.

If power draw is a problem, don't have them, however, may SMD LEDs will still be visible at 1mA.

I'll widen the power traces. 70 mil = 0.7mm?

70/1000 inch :wink:

A MOSFET for power switching would be best.

Awesome, thank you for your input!

larryd:
Your Vias are quite small.

Might want to make Q2 a MOSFET.

What Via diameter would you recommend? I just went with the default in EasyEDA.

I realize MOSFETs are superior to BJTs, but for my application the BJT is completely in spec and I have a bunch of them at hand, so I think I'll just go with them.

larryd:
Have the option having a 100nF capacitor to GND on Soil and Water sensor inputs.

You mean a 100nF cap in between the signal pin of the sensors and GND, not between the sensors' VCC and GND? Acting as a filter for the signal?

Current draw.

Alright - from what I have measured, the relay draw (~60mA) is completely in spec with what the arduino can handle, although I agree a driver is the cleaner and more professional solution.

47uF is a standard value, 22uF would work too.

Would there be any valid reason to not go above 47? Just curious, but so far I can't see the downside of having a bigger reservoir capacitor, other than it potentially beeing unnecessary.

Sure, note, you can always have pads for them.

Good point. With these many additional caps, I'll scrap the idea of going THT only for the PCB anyways. Thought I'd go convenient, but oh well.

A MOSFET for power switching would be best.

Could you elaborate on that? You mean power switching for the motor using a MOSFET instead of a relay?
If so, which MOSFET would you recommend for the task? I haven't worked much with them so far, cause BJTs usually suffise for what I need.

larryd:
I intentionally left out the power LED, since the whole circuit needs to be as power efficient as possible. I use the RTC to wake up the controller from deep sleep only twice a day. I use the "service" LED to indicate the wake up.

I note the 'as power efficient as possible'

So what is the measured deep sleep current from the battery ?

I cannot work out the power supply arrangements, the schematic appears to connect VCC (from wherever) direct to the 5V pin on the Nano, with no connection to the Nanos Vin ?

You mention;

'As the whole unit is powered by a 18650 battery'

'The board generally consumes about 140mA peak current and is powered with 5-6V at it's input'

An 18650 battery is circa 4.1v fully charged, so where does the '5-6v' come from ?

srnet:
I note the 'as power efficient as possible'
So what is the measured deep sleep current from the battery ?

With the analog sensors disconnected from GND in the sleep state via Q2, the circuit clocks in at about 6mA in the sleep state. I plan to desolder the pwr LED from the Nano to bring it down a bit further.

srnet:
I cannot work out the power supply arrangements, the schematic appears to connect VCC (from wherever) direct to the 5V pin on the Nano, with no connection to the Nanos Vin ?

I have not included the power circuit in this thread, as it's an individual unit that I want to discuss in another thread at a later stage. There are some quite specific things I need to clear up first. In short, the adafruit solar charger is placed between the 18650 battery and a MT3608 boost converter. This brings the battery voltage up to 5V. The output of the boost converter and it's GND are then connected to the V+ and GND input pins in the circuit shown above.

srnet:
You mention;

'As the whole unit is powered by a 18650 battery'

'The board generally consumes about 140mA peak current and is powered with 5-6V at it's input'

An 18650 battery is circa 4.1v fully charged, so where does the '5-6v' come from ?

The input can see anywhere between 5-6V because the boost converter brings the 18650 voltage up to 5V and the solar charger directly connects the load to the solar panel, if the generated current of the panel (6V output) is high enough.
Therefore, the output of the solar charger can peak at 6V, which (to my current understanding) is just transferred across the MT3608 and fed into the load circuit. Might be wrong there, I'm not sure how the boost converter handles 6V when set to output 5V. As I said I still have some things to work out in the power ciruit.

Either way, the concept of the load circuit above is to avoid using the Vin pin on the arduino, because the onboard voltage regulator is quite inefficient and has large dropout voltage. Therefore, I plan to use a higher quality LDR between the boost converter and power the unit by applying 5V directly to the +5V pin on the arduino. If the panel wouldn't connect the load directly, I could even ditch that LDR, but I want to play it safe.

What Via diameter would you recommend?
I use 25 mil if there is room.


You mean a 100nF cap in between the signal pin of the sensors and GND, not between the sensors'
Both.


VCC and GND? Acting as a filter for the signal?
Yes


Alright - from what I have measured, the relay draw (~60mA) is completely in spec with what the arduino can handle
No !
20 mA is the safe limit.


Would there be any valid reason to not go above 47? Just curious, but so far I can't see the downside of having a bigger reservoir capacitor, other than it potentially beeing unnecessary.
10-100uF are usually available in a small footprint.


Could you elaborate on that? You mean power switching for the motor using a MOSFET instead of a relay?
Power switching of the SD card, RTC . . .


If so, which MOSFET would you recommend for the task?

AO4484
IRLML2402
IRLML2502

Thank you very much for all your input! It's been really helpful.

I'll rework the circuit and post an updated schematic and PCB soon.

PS: I feel like an idiot because of the wrong current rating. I was referring to the ~200mA max. current that the Arduino can handle (at least according to several sources I found), but neglected the limit per pin. That's what you get for being sloppy on your research...

I don't know if it makes matters better or worse, but the ~60mA given in my previous post were also wrong: It's the total consumption of the circuit while the relay and all sensors are active, but the SD card is idle. So I don't even know how much current the relay draws upon switching, I would imagine somewhere along the lines of 15-20mA or so, probably that's why I haven't fried the Nano using it like this. But yeah, sometimes luck favors the ignorant apparently. :zipper_mouth_face:

Updated schematic and PCB design:

Solar_Watering_System_V2.1.pdf (17.2 KB)

When I need to switch power to peripherals, I switch Vcc with a P-Channel MOSFET.


Google:
High Side Switch

example:


Note the Arduino UNO uses a “Load Switch” P-channel MOSFET.

Thanks for the link, coincidentally also came across this exact one while looking up power switching yesterday. Might go with the P channel high side switch then.

Is there any other real benefit to using a MOSET instead of a BJT other than the absence of leakage current in the given application? I still can't quite see why BJTs are getting this little love when it comes to this kind of task, seeing how they're a fraction of the price of a P-channel MOSFET, easy to use and abundantly available...

Also: Would you recommend switching the motor with a MOSET as well, mabye using a dedicated IC (e.g. an H-bridge while I'm at it) rather than using a relay? I couldn't quite make out whether the recommendation of using a MOSFET was limited to switching the sensors/SD/RTC peripherals.
But I could imagine that a MOSFET motor switch could help eliminate the volage spike that occurs on the relay's terminals.