Push-button as a switch, PCB schematic check

BukvaB

Aug 10, 2024
3
Joined
Aug 10, 2024
Messages
3
This is main schematic of the digital switch controlled by attiny10. The main idea was to connect button and mosfet to attiny and wake it up only when its needed. And after it woke up and turned on PCB, arduino will take control over mosfet using ONOFFMON . Attiny see it with ONOFFMON pin input and goes to deep sleep. Every time the button will be pressed, attiny immediately see that ONOFFMON and goes to sleep again.

Arduino on this pcb has 3.3v logic, because it connected to Lora, and lora shold be having only 3.3 logic. So that is why I had to do this trick with attiny. I want to make something like short press, than long hold until the PCB will woke up or shuts off like DJI.

1)The main idea is to make, on the first button press, attiny wakes up and immediatly opens mosfet.

2)Arduino powers on and check the button state and how long it was pressed.

3) if all ok, takes the control over mosfet, and sends high signal on pin, that is connected to the same signal line where attiny controls mosfet. (ONOFFMON).

4) ONOFFMON same pin connected to another pin of attiny, so it understands, when arduino is controlling mosfet to enter in to the deep sleep immideatly when it wakes up from the push button (because it connected also to the arduino pin as input)

5) To power off, arduino understands the specific button press and ONOFFMON becomes low.

attiny wakes up, because there was level change, sees that ONOFFMON is low and the button is holding. inside internal memory is written that the board is on, so i need to change level, and it turns off.

This is the idea that i thought that could work. Any suggestions? Maybe you tell me that i'am a total idiot. Or this schematic eventually can exist. Or there are some mistakes?

Any thoughts. I need to make somehow power on and power off from one push-button, that this button could be also used as input for arduino, and won't occupy a lot of space on PCB.



I actually did the same post here on reddit: https://www.reddit.com/r/arduino/comments/1emn33h
It is described probably a bit better. And got the response, that I have to use this schematic (last image).

but i also had some questions about that,
Pulsations should be on specific value? And what you think about if I implement this schematic in some commercial project. Like is it ok, or better to use something more advanced, or I'm safe?

Pwm is used to detect button at some point, right?

Any advises, thank you!
 

Attachments

  • Screenshot 2024-08-07 at 22.22.11.png
    Screenshot 2024-08-07 at 22.22.11.png
    162.4 KB · Views: 7
  • Screenshot 2024-08-07 at 22.09.40.png
    Screenshot 2024-08-07 at 22.09.40.png
    36.2 KB · Views: 5
  • Screenshot 2024-08-07 at 22.09.55.png
    Screenshot 2024-08-07 at 22.09.55.png
    84.9 KB · Views: 4
  • Screenshot 2024-08-07 at 22.11.32.png
    Screenshot 2024-08-07 at 22.11.32.png
    37.5 KB · Views: 7
  • Screenshot 2024-08-08 at 23.25.25.png
    Screenshot 2024-08-08 at 23.25.25.png
    348.8 KB · Views: 7

Harald Kapp

Moderator
Moderator
Nov 17, 2011
14,273
Joined
Nov 17, 2011
Messages
14,273
Do you expect us to cobble together the circuit from teh snippets you present? I will not.

Your scheme sounds overly complicated to me anyway. Why use an arduino plus an Attiny? The Arduino has a deepsleep mode, too. Simply connect tthe pushbutton to an interrupt capable pin of the Arduino and have the Arduino watch this interrupt. When it awakes from deepsleep, the Arduino can check the duration of the button press and act accordingly. No need for an additional Attiny.
 

BukvaB

Aug 10, 2024
3
Joined
Aug 10, 2024
Messages
3
Unfortunately I can't do it in the way as you considering, because I power an Arduino through an 3.3v ldo , that will continuously consume power.

Moreover, placing Arduino to the deep sleep won't disconnect lora from power, that will also consume battery, even if it is not used.

So I'm trying to disconnect the whole powerline from the circuit.

Last image is the circuit that was considered to me, without using an attiny.
Somehow using pwrpump.

That is my idea.
 

danadak

Feb 19, 2021
1,064
Joined
Feb 19, 2021
Messages
1,064
How much power do you have to gate ? Seems like an integrated solution with
onboard power MOSFET must be out there. One of the advantages of integrated
button on/off circuits is glitch free, latching operation, and debounce of mechanical
switch so processor startup is clean, meets ramp rate, its startup specs, etc...


Regards, Dana.
 

BukvaB

Aug 10, 2024
3
Joined
Aug 10, 2024
Messages
3
How much power do you have to gate ? Seems like an integrated solution with
onboard power MOSFET must be out there. One of the advantages of integrated
button on/off circuits is glitch free, latching operation, and debounce of mechanical
switch so processor startup is clean, meets ramp rate, its startup specs, etc...


Regards, Dana.
It should be around 500mA in the highest peak.

I wanted to use my schematic in production, and wanted to place this fancy one button switch, that is also used as an input signal.

The sing is, that lora is powered by 3.3v
To normalise voltage I'm using 3.3v ldo and powering Arduino through 3.3v too. So if I place Arduino to deep sleep, ldo will consume constantly power and lora.
So that's why I'm trying to find any other solution, for turning on and off PCB, outside of ldo.
 

danadak

Feb 19, 2021
1,064
Joined
Feb 19, 2021
Messages
1,064
I would advise you spend some time simulating your circuit. Including adding
power supply noise. Examine specs for Lora and Arduino power startup,
some processors not well design and have issues with the way power is
applied, like ramp rates, completing a ramp (no brownout creation), etc....

If you rely on RC timing to manage noise in simple discrete circuits you can
affect dv/dt of power up depending on how design was done. Goog modern
processors discuss this in their data sheets.

Also you should address brownout, eg. button pushed but supply marginal.
Especially if this affects human safety considerations. Like medical appliances,
machine interfaces, human transports systems.....

Lastly when processor shuts down design make sure enough battery power
exists (and or use super caps) to hold up power loing enough to do an orderly
shutdown.


Regards, Dana.
 
Top