2
\$\begingroup\$

I am bit new to electrical engineering and I was hoping to get a sanity check on my reasoning! I want to design a low-powered (battery-driven) plant watering PCB.

It uses an attiny13 as the switch for an IRF520 MOSFET and it will have three terminal blocks: J1, J2, J3.

  • J1: power (perhaps 4 NiMH size AA) => 4.8v
  • J2: Optional soil moisture sensor
  • J3: Pump, or perhaps a solenoid valve

Below is what I drew in KiCAD, I have wired it up on a breadboard, with 4 AA (1.2v) batteries as power source, and it seems to work.

enter image description here

So, my questions:

  1. Does this make conceptually sense? Or have I made any general dumb mistakes? :)
  2. Does my KiCAD schematic seem ok? Can I move on to try to make a PCB out of this? (Any and all tips and conventions to follow are welcome!)
  3. Am I missing any capacitors or resistors (or other component) to make this circuit proper?

My (naive beginner) thinking for capacitors, diodes and resistors in this circuit:

  • C1: decoupling capacitor for the attiny13 to protect the MCU from spikes in current
  • R1: Pull-up resistor for MCU reset pin to guard against spurious reset
  • R2: Protect the MCU pin from over-current
  • R3: Pull-down on the MOSFET gate to ensure it stays low during MCU boot
  • D1: A flyback diode to protect from voltage spikes at disconnect
  1. Is my thinking flawed in any way? Or am I missing some aspects? I am grateful for all clarifications!

Thanks to all and any who reads or answers this question!

\$\endgroup\$
5
  • \$\begingroup\$ You have made it quite good. Thing from me: 1. parallel to C1 add 0.1uF (100nF) non-electrolytic capacitor (as close to Attiny as possible). This will protect your circuit from short spikes, very likely to occur when motor turns on. 2. Don't forget that pump's motor may be power hungry and you need to provide sufficient current to it, so good battery is needed (or consider using two: one for ATtiny and other for pump) \$\endgroup\$
    – smajli
    Commented Aug 13, 2021 at 10:27
  • \$\begingroup\$ Four AA batteries don't add up to 4.8V, which batteries will you be using, NiMH? How much current does the pump draw, and which diode type is over the pump pins? \$\endgroup\$
    – Justme
    Commented Aug 13, 2021 at 10:33
  • \$\begingroup\$ I have been testing using four of these: conrad.com/p/… \$\endgroup\$ Commented Aug 13, 2021 at 10:36
  • 1
    \$\begingroup\$ Decoupling is a bit lacking... \$\endgroup\$
    – winny
    Commented Aug 13, 2021 at 10:56
  • 2
    \$\begingroup\$ NiMH batteries are only nominally 1.2V. The ATtiny13 can handle up to 5.5V which means max voltage per cell is 1.375V. A fully charged NiMH cell can well exceed that which means the AVR is not guaranteed to work beyond 5.5V, and it can be damaged at 6.0V, which is only 1.5V per cell. During charging cell voltage could reach 1.6V and can be up to 1.8V during trickle charging before safety mechanisms hit in. So it is not OK to connect four NiMH cells directly to AVR. \$\endgroup\$
    – Justme
    Commented Aug 13, 2021 at 10:57

1 Answer 1

3
\$\begingroup\$

Does this make conceptually sense?

Conceptually but practically your MOSFET (IRF520) might need a little more encouragement in the form of a higher gate drive voltage: -

enter image description here

So, if your load current is 1 amp then, due to lack of a decent gate-source drive level voltage, the MOSFET may not conduct very well at all. Of course, if your load current is 100 mA maximum then hitting the gate with 4.5 volt or more should be fine because the MOSFET will drop less than 100 mV when conducting.

Can I move on to try to make a PCB out of this?

On the basis that there are many MOSFETs with the same footprint, yes you can. However, I'd add lower value 100 nF capacitors on power rails as well. Relying on a single 10 uF might be problematic.

Am I missing any capacitors or resistors (or other component) to make this circuit proper?

I'd be highly tempted to connect unused MCU pins go to test points and/or pull down resistors in case you wanted to use them at a later date.

\$\endgroup\$
4
  • \$\begingroup\$ Thank you Andy! Another question, if I want to have the soil moisture sensor optional, should I have a pull-down resistor on PB2? ~1M Ohm or so? \$\endgroup\$ Commented Aug 13, 2021 at 10:47
  • \$\begingroup\$ @JonasDanielsson yes, a pull-down is sensible; just sufficient so that it doesn't take much current from the sensor when the sensor is fitted. \$\endgroup\$
    – Andy aka
    Commented Aug 13, 2021 at 11:04
  • \$\begingroup\$ So would the IRL540 mosfet suite me better? \$\endgroup\$ Commented Aug 14, 2021 at 5:35
  • \$\begingroup\$ @JonasDanielsson look at the equivalent graph in the data sheet. Then add a horizontal line that is your maximum load current. Then, see where the relevant curve (gate voltage dependant) crosses that horizontal line. Then project that intercept down to the x-axis to see how much voltage the MOSFET drops at that maximum load current. When you are satisfied you have chosen an appropriate MOSFET, you can take the 2 minute tour to understand the motivation behind people giving free help. \$\endgroup\$
    – Andy aka
    Commented Aug 14, 2021 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.