Croduino automatic shutdown with MOSFET for battery saving

Customer:

I want to build a circuit where Croduino performs some actions and then shuts itself off to save battery. The actions happen rarely, once a day or weekly, like watering. My idea is to turn it on with a button, and when it wakes up, a digital output goes HIGH and holds a MOSFET or relay that powers the board itself. When the output goes LOW, everything shuts down. I prefer using a MOSFET over a relay.

Version with button T1:

  • The branch with button T2 does not exist
  • I apply 5V to the gate, MOSFET conducts and I assume Croduino will turn on
  • The button only needs to be held long enough for the digital output to go HIGH

What concerns me is the period when the digital output is directly connected to +5V via the button. Can this short the digital output? Should I add a resistor between the button and the digital output, like 10k?

Version with button T2:

  • The branch with button T1 does not exist
  • Same idea but I connect Croduino directly to the battery via the button and it should turn on and set the digital output HIGH

Here I’m concerned that there is a time when the Drain and Source pins of the MOSFET are shorted together and also connected to GND. Can this damage the MOSFET and the digital output?

One more question about the IRF540N. The datasheet says VGS (gate to source voltage) is ±20V and VGSth (gate threshold voltage) is 2 to 4V. Which should I actually follow? Can I apply 20V to the gate or is the max 4V? If the max is 4V, then I shouldn’t connect the digital output directly since it’s 5V. Maybe I should use a 330Ω resistor like for LEDs. In MOSFET switch examples for LED strips the gate is connected directly to the digital output. I’ve used Nova board with MOSFET before and there it was 3.3V so that wasn’t a problem.

Original message (Croatian)

[name removed] bok!

Prije svega, želim tebi i tvojoj obitelji sve najbolje za Božić i Novu Godinu i da vrijeme koje slijedi bude bolje i uspješnije od dosadašnjeg.

A sad pitanje. Imam sklop koji bi htio napraviti a nisam siguran jesam li ga dobro zamislio. Prvo ću riječima opisati namjeru a onda shemom pokazati.

Htio bi da Croduino izvede neke radnje i da se nakon toga sam ugasi, čisto radi štednje baterije. Radnja se odvija rijetko, jednom dnevno ili tjedno, npr. navodnjavanje. Ideja mi je da ga preko tipkala uključim, a kada se probudi, jedan dig. izlaz postavi u high i tako mosfet ili relej preko kojeg ide napajanje njega samog, drži uključenim. Kada izlaz ode u low, sve se gasi. Kod releja nemam dvojbi ali radije bi to riješio mosfetom. U nastavku slijedi shema na kojoj su prikazane dvije verzije, tipkalo T1 ili tipkalo T2.

Verzija s T1 tipkalom:

  • grana s T2 tipkalom kao da ne postoji na shemi

  • dovedem 5V na gate, mosfet provede i pretpostavljam da će se Croduino uključiti

  • tipkalo samo treba dovoljno dugo držati da dig. izlaz stigne otići u high

Ono što me muči je neki period vremena kada je dig. izlaz preko tipkala direktno spojen na +5V. Mogu li takvim spajanjem skuriti dig. izlaz? Možda otpornik između tipkala i dig. izlaza, npr. 10k?

Verzija s T2 tipkalom:

  • grana s T1 tipkalom kao da ne postoji na shemi

  • ista zamisao jedino što preko tipkala Croduino direktno spajam na bateriju i on bi se trebao uključiti i dig. izlaz pstaviti u high

Ovdje me muči što postoji vrijeme kada su DS pinovi mosfeta kratko spojeni i još k tome odvedeni na GND. Mogu li takvim spajanjem skuriti mosfet a onda preko njega i dig. izlaz?

I još jedno pitanje vezano uz IRF540N. U datasheetu piše da je VGS (gate to source voltage) ±20V, VGStg (gate treshold voltage) 2 do 4 V. Čega se zapravo treba držati? Smijem li na gate dovesti 20V ili je max ipak 4V? Ako je max 4V, onda ne bi smio direktno spojiti dig. izlaz jer je 5V. Možda da stavim otpornik 330R kao za diodu. U primjeru mosfeta kao prekidača za LED traku gate je spojen direktno na dig. izlaz. Ja sam spajao Novu i mosfet a tamo sam imao 3,3V pa to nije bio problem.

Attachment omitted in migration: WP_20171223_14_33_22_Pro.jpg

Originally submitted via email support on 23 December 2017. Migrated to the forum for community visibility.

Soldered Support:

There is a much simpler solution for power management of Croduino powered by batteries. It’s called sleep mode. This article might interest you: Soldered: Open-Source Electronics, Boards, Sensors & Modules – Soldered Electronics

The idea is that Arduino in sleep mode consumes minimally because it shuts down most of its hardware. Only the parts needed to wake the Arduino from sleep mode work, and these are in 99% of cases:
a) RTC - waking after a certain time
b) interrupt hardware - waking on external signal (this is what you need): https://www.arduino.cc/reference/en/language/functions/interrupts/interrupts/

You won’t damage a digital input with 5V because when you set it as input, it is in high-Z state, which means its resistance is very high == very small current == no damage.

The Drain and Source pins of a MOSFET are internally connected when you apply voltage to the Gate (for N-MOSFET), so that won’t be a problem.

For MOSFETs, VGS designates the maximum possible voltage difference between G and S. VGth (gate threshold) designates the voltage at which the gate begins to open (figuratively speaking), that is the voltage at which drain current (Id, the current between S and D) begins to flow. So it is not the maximum voltage, but rather the voltage at which something begins to happen.

Since we’re talking about N-MOSFET, you will have GND (0V) at the Source, so you can apply a maximum of 20V to the Gate without damaging the MOSFET.

Customer:

Regarding the question about connecting to +5V, I meant the digital output. If the output is HIGH (so it’s at 5V) and I connect it to +5V via the button, will I damage it? Actually I’m also wondering what happens if the output is LOW and I manually connect it to +5V? It turns out I’ve connected the button in parallel with the digital output, one end of the button on +5V and the other on the digital output.

Original message (Croatian)

[name removed] bok!

Želim ti da se što prije oporaviš, a ovo vrijeme u biti nije normalno. Čas je kao proljeće, čas kao zima, danas vidim neke muhe lete po stanu, tako da su i boleštine sve čudnije.

Hvala za info, naravno da ne zamjeram. Evo mi nove lektire J Nego, kod onog pitanja za spajanje na +5V mislio sam na dig. izlaz. Hoću li ga skuriti ako je izlaz u high (dakle na njemu je 5V) i onda ga još preko tipkala spojim na 5V? U stvari zanima me i ako je izlaz u low pa ga ručno spojim na 5V? Ispada da sam paralelno s dig. izlazom spojio tipkalo čiji je jedan kraj na 5V a drugi na dig. izlazu.

Soldered Support:

You won’t damage the digital output if it is HIGH and you connect 5V to it. You’re actually connecting two points that have the same potential = nothing will happen.

If the digital output is set to LOW and you connect 5V to it, you will create a short circuit.

You can always use resistors. If you must have a combination where the digital output will be LOW and the button with 5V will be on it, put a large resistor so the current flowing through it, from +5V to ground, will be very small.