1
\$\begingroup\$

I have a microcontroller (uC1) which outputs a TTL signal that simultaneously closes a switch on another microcontroller (uC2) AND controls a power MOSFET that cuts power to the entire system. I need to delay the MOSFET signal (via IC1) by about 20 seconds so that uC2 can save its files and go to sleep. Here's my basic schematic:

enter image description here

Closing SW1 changes the TTL level. Ideally the delay on IC1 would only happen on the falling edge (turning the system off, when uC2 requires time to enter sleep mode). Here's a basic timing diagram illustrating the relationship between the shifting TTL level and IC1's output to the MOSFET:

enter image description here

I've found some similar questions on here, particularly this one, and also this one, and it seems like a simple microcontroller is the easiest solution (I've got a few ATTiny's laying around). HOWEVER, current consumption is a real issue with this project, so if anyone has something even smaller, like a single 555 circuit, I'd love to know.

EDIT: My uCs require some explanation. Both are units which have been purchased and so I don't have access to their firmware. uC1 is an "intelligent battery system" which outputs power from 16V battery. uC2 is a device which records analog data to an SSD.

\$\endgroup\$
  • 1
    \$\begingroup\$ connect SW1 to uC2 instead .. replace the SW1 on uC1 with a signal line from uC2 .... pressing the switch causes uC2 to save its data and then send shutdown command to uC1 \$\endgroup\$ – jsotola Jan 9 at 18:24
  • \$\begingroup\$ what are the three ICs in your design? \$\endgroup\$ – jsotola Jan 9 at 18:30
  • 1
    \$\begingroup\$ If you stick with your original line of reasoning, you should just use two separate pins from uC1 and program them to fire separately. But there are better ways. As @jstola suggested, you should have u2 control the switch. That way you can shutdown as soon as u2 is done saving its files rather than blindly waiting some amount of time (20 seconds is a really long time). And the switch doesn't have to disconnect power to u2, just everything else. Instead, u2 can put itself to sleep. \$\endgroup\$ – DKNguyen Jan 9 at 18:31
  • \$\begingroup\$ Also, why is the MOSFET disconnecting those lines if it's supposed to disconnect power? It doesn't make sense. It is not clear exactly which wires are power rails in your schematic and you have more than one - wire which makes things even less clear. As wired, your MOSFET can't be switched and if it could it would not disconnect power from anything. It would only disconnect MCU GNDs from each other which is bad (current flows through ESD diodes in the pins), and it is not even doing it properly since MOSFETs only block current in one direction. \$\endgroup\$ – DKNguyen Jan 9 at 18:37
  • 1
    \$\begingroup\$ I should have said this immediatley: neither uCs are programmable. \$\endgroup\$ – Zurn Jan 9 at 19:00
0
\$\begingroup\$

I'll have to get going, but really quickly:

This is a digital control problem and should be solved in software. By far easiest, most reliable and accurate. But:

Just as you can use an RC low-pass as delay for both edges, replacing the R with a diode in parallel with an R will make one edge (where the anode side becomes higher than the cathode side of your diode) charge the capacitor very quickly (because the diode then has low effective resistance) whereas the other edge becomes very slow (because then the capacitor has to be discharged through the parallel resistor).

schematic

simulate this circuit – Schematic created using CircuitLab

Typically, for signal cleanliness reasons:

  1. Buy a diode, a resistor and a capacitor, as well as an IC that integrates two inverters of the desired voltage levels
  2. use first inverter as "buffer"
  3. build "inverse" edge delay circuit as explained above
  4. use second inverter as edge-beautifier
| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Timers with long time constants need extremely high impedance and low leakage parts making them prone to noise and contamination. They also need hysteretic comparators for glitch free transition.

Meanwhile cheap a 14 bit counter with internal clock just needs a cap & R to compute which bit goes high to latch off power by gating a high side Pch FET gate and shut down power. This requires an understanding of avoiding rapid power down glitches and consequences of supply voltage to show details.

You can find a 74HC4060 and logic level PFET to do this and some examples on this site.

Then pour s'amuser read about 555 and long timers on this site.

Then again, you may want a more comprehensive unified solution with Power Ok Monitors on 3 lines, Sanity timers, programmable delays etc.

https://www.maximintegrated.com/en/products/power/supervisors-voltage-monitors-sequencers/MAX6705.html/tb_tab3

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ OP can also use a PICaxe which is a tiny MCU made to be easily programmable both in the hardware and software aspects. You don't even need to code if you use the GUI block interface. \$\endgroup\$ – DKNguyen Jan 9 at 19:25
  • \$\begingroup\$ I have an ATTiny85 on hand which I'll probably end up using. Programming it shouldn't be a problem. \$\endgroup\$ – Zurn Jan 9 at 19:41
  • \$\begingroup\$ As long as it meets all your requirements for idle power re-innovation.co.uk/docs/sleep-modes-on-attiny85 \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jan 9 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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