Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

timed delay circuit ON/OFF

Status
Not open for further replies.
Well, it's not completely irrelevant. Depending on your device setup and the C startup code it could take a LONG time for that sequence to run.

You may consider it irrelevant, and that's fine.

Incidentally, the C snippet above runs at 4MHz clock
Actually, since there's no clock setup it runs at whatever speed the device powers up at.

For MrDeb's setup using an 18F43K22, that's 1MHz.
 
The circuit in #12 can be further simplified.

1. What is the power source for the overall circuit?

2. What is the operating voltage of the uC?

ak
 
ALL very interesting reading.
ANALOGKID the battery power is 6volts with a 1n4148 in series to prevent polarity concerns.
the pic runs at 5v
now am looking for replacement for the NDP6020P. Using SMD
 
read the comments about using this circuit and it mentioned using a 200uf cap across the 220k resistor.
Hi Mike.
The circuit works great as it is presented.
When use this circuit with the Arduino you have to press for some time and wait for it to initialize.
When using the ESP32 or ESP8266 it works great with a simple press, it instantly initializes when you press the pushbutton.
Regards,
Sara
1f642.svg
1f642.svg
 
This is not the circuit I thought it was going to be ...

Everyone thinks of switching power to a circuit by switching the power. However, in a battery-powered system there is no law against switching the GND. Here is a first pass at this technique.

When the power loop is completed by SW1, the first thing the uC does is assert the GPIO pin high to keep it's power connected through Q1. Driving the GPIO pin low turns off the circuit. When the circuit is off, R1 bypasses any leakage current from the GPIO pin to keep Q1 off.

NOTE: This circuit is critically dependent on the GPIO pins being "well-behaved" at power-on and power-off. If they bounce around, modifications will be needed.

ak

Power-On-Switch-1-c.gif
 
Last edited:
Well, it's not completely irrelevant. Depending on your device setup and the C startup code it could take a LONG time for that sequence to run.

You may consider it irrelevant, and that's fine.


If we're writing code that badly, perhaps we shouldn't be writing code for micro-controllers in the first place?.

Is a C or BASIC compiler really going to generate code that will take a second of so before it starts running?.

Probably the only real circumstance that might approach that is when using a bootloader?, where before the program starts running it waits for a possible bootloader sequence for a while first - other ways avoid this by using other methods (such as extra pins).

Actually, since there's no clock setup it runs at whatever speed the device powers up at.

For MrDeb's setup using an 18F43K22, that's 1MHz.

Does he run it at that anyway (which is still only 4uS per instruction), and when in the C/BASIC setup is the clock set to how you wanted it?.
 
When the power loop is completed by SW1, the first thing the uC does is assert the GPIO pin high to keep it's power connected through Q1. Driving the GPIO pin low turns off the circuit. When the circuit is off, R1 bypasses any leakage current from the GPIO pin to keep Q1 off.
I don't get that idea?
Any normal GPIO pin will be restricted from going outside the MCU power supply rails - above positive or below ground.

How can the MCU switch off - so both supply pins at or near V+, without the GPIO pin also going positive to ground and switching on the FET?

I think it would need a P channel FET within the "box" to allow the power switch to turn off.
 
well I think I can order boards? here is a screen shot of board
the red errors have been corrected.
need to order boards from JLPCB TODAY
 

Attachments

  • Screenshot (60).png
    Screenshot (60).png
    248.8 KB · Views: 218
Seem like the latch circuit is post #12 could be reduced. See below.
FDG6332C is a dual complimentary mosfet.

1628106023205.png
 
Seem like the latch circuit is post #12 could be reduced. See below.
FDG6332C is a dual complimentary mosfet.

View attachment 132889

I use them (dual FET's) a lot, for switching main power to SIM800's etc. - it still has the same drawback as the previous FET example, that there's no connection from switch to micro, so no way to use the switch for anything else (such as turning it OFF), so again it really needs the parts to do that adding.
 
I use them (dual FET's) a lot, for switching main power to SIM800's etc. - it still has the same drawback as the previous FET example, that there's no connection from switch to micro, so no way to use the switch for anything else (such as turning it OFF), so again it really needs the parts to do that adding.

The OP requested:

"instead of a simple ON/OFF switch am looking for a method to press a button and game stays ON until there is no activity of playing. "

Didn't request "anything else".

Why can't the GPIO turn it off with an internal software "inactivity timer"?
 
Last edited:
The OP requested:

"instead of a simple ON/OFF switch am looking for a method to press a button and game stays ON until there is no activity of playing. "

Didn't request "anything else".

Why can't the GPIO turn it off with an internal software "inactivity timer"?

It can, and it does - that's the point of it.

BUT - it makes a lot more sense if you can turn it off manually as well - and it makes even more sense to use the same push button to do so.

As for 'not requesting it' it's the sort of thing he's probably going to request a few more pages down!. The original bi-polar version can easily be stripped back to make it simpler as well, with the same failings.
 
It can, and it does - that's the point of it.

BUT - it makes a lot more sense if you can turn it off manually as well - and it makes even more sense to use the same push button to do so.

As for 'not requesting it' it's the sort of thing he's probably going to request a few more pages down!. The original bi-polar version can easily be stripped back to make it simpler as well, with the same failings.

Well....its not a "failing". It simple, it works and does exactly what the OP wants.

I guess we'll wait a few more pages down. :)
 
Last edited:
If you transfer your design to EasyEDA and select SMD components and the speaker as GSPK2307P-8R1W then JLCPCB will assemble everything except the LCD.

Mike.
 
If you transfer your design to EasyEDA and select SMD components and the speaker as GSPK2307P-8R1W then JLCPCB will assemble everything except the LCD.

Mike.

We tried that once before, with exactly the expected amount of success.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top