Push On/2sec Push Off/triggered 5 min delayed Auto Off Switch

Thread Starter

Luky Skywalka

Joined Mar 22, 2017
10
Hi,

I am new to this forum and new to the whole world of circuits.

I am building bluetooth portable speaker. Everything is finished and working, except for this switch that I don't know how to make.

I need a circuit that could turn system on/off with pressing single button and also has an auto off function so that if no song is playing timer starts and after 5 mins shuts down everything to save batteries.

Voltage is 14.8V.

I have seen some interesting circuits around but none of them had all of the functions I need. And I am too inexperienced to design my own + too impatient to learn heaps of stuff because everything else is finished. Just that one little switch...

Ideas much appreciated.
 

Deleted member 115935

Joined Dec 31, 1969
0
Assuming you have processor in the device,

Use that to monitor the switch ,
when off most things like this are not really off, they are in very low power mode.
 

Thread Starter

Luky Skywalka

Joined Mar 22, 2017
10
Assuming you have processor in the device,

Use that to monitor the switch ,
when off most things like this are not really off, they are in very low power mode.

Thanks for your answer. Yes, I would like to use Low Power mode from bluetooth module to provide that monitor signal. I stumbled upon K Mosfet's design of something similar: https://forum.allaboutcircuits.com/threads/auto-off-switch.27626/ The problem is his voltage is 3.3V, while mine is 14.8 I do not know how to adjust that circuit to work with 14.8V. Also I have no idea how to program that Picaxe chip. Electronics is really a bit alien to me so I don't see a solution although it might be right in front of my nose :)
 

Thread Starter

Luky Skywalka

Joined Mar 22, 2017
10
P.s.: Also, the trigger signal will have to be an audio signal from amplifier. Like >music stops playing -> no audio signal coming to speakers -> timer starts. Monitor bluetooth for signal is not unfortunately possible.
 

Deleted member 115935

Joined Dec 31, 1969
0
P.s.: Also, the trigger signal will have to be an audio signal from amplifier. Like >music stops playing -> no audio signal coming to speakers -> timer starts. Monitor bluetooth for signal is not unfortunately possible.
sorry, sounds like your to far away from an answer for much help on the forum.
 

AnalogKid

Joined Aug 1, 2013
12,045
Assembling modules into a system and assembling components into a circuit are two different things. What is your skill set/experience level with chips, individual resistors and capacitors, etc?

The CD4060 makes an excellent long-period resetable timer. If you design it with a clock period of 27.3 Hz, the rising edge of Q14 will happen 5 minutes after tits last reset. AC couple the audio into the Reset pin to keep Q14 low while music is playing.

What you need to do with the Q14 signal depends on the details of the power system and all other modules.

ak
 

Thread Starter

Luky Skywalka

Joined Mar 22, 2017
10
Assembling modules into a system and assembling components into a circuit are two different things. What is your skill set/experience level with chips, individual resistors and capacitors, etc?

The CD4060 makes an excellent long-period resetable timer. If you design it with a clock period of 27.3 Hz, the rising edge of Q14 will happen 5 minutes after tits last reset. AC couple the audio into the Reset pin to keep Q14 low while music is playing.

What you need to do with the Q14 signal depends on the details of the power system and all other modules.

ak
My experience is below zero :) I am trying to educate myself as fast as I can now. Never needed to know. But now it would come in handy. I asked one guy who does circuit designs for living and he asked for 4k+gst :) Timer is a great idea, but I was poking for some time into Picaxe chip and I would like to try that way. So, I took K moffet's idea and tweaked it a little bit. Here it is. The two switches are actually one DPST momentary switch. uC listens for high (7) and turns off pin (4) that goes to two transistors q3 and q1. I am really not sure about the area marked red. If components chosen and resistor value are right. Also if transistor is q3 is good thing to have there. Hopefully getting closer.
New-Schematic-2.jpg
 

crutschow

Joined Mar 14, 2008
38,321
Since Q3 is configured as an emitter follower, its output will only be about 3.5V, so that won't work.
But you only need transistors Q1 and Q2 so the components inside the red line can be removed..
  1. Connect Q2 and R1 in place of Q3 with MOSFET source pin and R1 to V1+ (not drain to positive as you show). Q1's collector and the other end of R2 are still connected to Q2's gate.
  2. Eliminate D2, D3, C1, and R5, leaving SW2 connected only between +5V and R8.
  3. Connect the PICAXE power Vdd directly to the +5V.
The PICAXE's function is then as follows:
  1. When it first gets powered up by SW1 and detects a voltage at Pin 7 from SW2, it will output a voltage on Pin 3 to turn on Q1 and Q2. This will keep the power on when SW1 / SW2 are then opened.
  2. When it again detects a voltage on Pin 7 from SW1 / SW2 being pressed, it will remove the voltage from Pin 3. Everything will then power down when SW1 / SW2 are released.
  3. It will also remove the voltage from Pin 3 after loss of an audio signal for the desired delay time.
 
Last edited:

Thread Starter

Luky Skywalka

Joined Mar 22, 2017
10
Holy moly I think it actually does make better sense to me now! :)
One thing I am a bit confused about is you say
...other end of R2 are still connected to Q2's gate.
Did you mean other end of R1 instead? If not, what end of R2 are you referring to?

Can I leave like this?

New-Schematic-3.jpg
 

crutschow

Joined Mar 14, 2008
38,321
Yes I meant R1.
You still have Q2 incorrectly connected (notice that the body diode is forward biased, so the MOSFET will not be able to block the voltage.)
The MOSFET source must go the the V1+ (source and drain interchanged).
R1 goes from the source to gate.
 
Last edited:

EM Fields

Joined Jun 8, 2016
583
Hi,

I am new to this forum and new to the whole world of circuits.

I am building bluetooth portable speaker. Everything is finished and working, except for this switch that I don't know how to make.

I need a circuit that could turn system on/off with pressing single button and also has an auto off function so that if no song is playing timer starts and after 5 mins shuts down everything to save batteries.

Voltage is 14.8V.

I have seen some interesting circuits around but none of them had all of the functions I need. And I am too inexperienced to design my own + too impatient to learn heaps of stuff because everything else is finished. Just that one little switch...

Ideas much appreciated.
As I understand it, what you want is a hardware system which can be turned ON when it's OFF with a single press of a pushbutton switch, which can be turned OFF when it's ON with another press of the same pushbutton switch, which will automatically turn itself OFF once it's been turned ON if there's no action on its audio input for 5 minutes, and which will draw no current from the battery when it's OFF.

Am I right?
 

Thread Starter

Luky Skywalka

Joined Mar 22, 2017
10
Yes I meant R1.
You still have Q2 incorrectly connected (notice that the body diode is forward biased, so the MOSFET will not be able to block the voltage.)
The MOSFET source must go the the V1+ (source and drain interchanged).
R1 goes from the source to gate.
Crutschow you have my utmost gratitude! I wouldn't be able to finish it without your help. And thanks goes to other guys who posted here as well. I am posting the final schematics and going to work on PCB. When it's done, I will add it here as well along with the Picaxe code. The least I can do for the community.

Thank you all and happy circuiting!
Version-1.3.jpg
 

Thread Starter

Luky Skywalka

Joined Mar 22, 2017
10
As I understand it, what you want is a hardware system which can be turned ON when it's OFF with a single press of a pushbutton switch, which can be turned OFF when it's ON with another press of the same pushbutton switch, which will automatically turn itself OFF once it's been turned ON if there's no action on its audio input for 5 minutes, and which will draw no current from the battery when it's OFF.

Am I right?
Exactly sir
 

ScottWang

Joined Aug 23, 2012
7,498
1. When the values of R2 is too high then it will causing Q1(2N3904) can't get into the saturation region, If Q1 want to be a normal switch then R2 should be as 4.3K or 3.9K for a 5V input voltage, and R4 = 15K~47K

2. How much current will be though Q2(IRFR9020) from 14.8V, Q2(IRFR9020) has Rds(on) = 0.28Ω, I just think that if the current is higher then the heat problem will be following, maybe you should choose some other mosfets has smaller Rds(on) less than 20mΩ.
 

crutschow

Joined Mar 14, 2008
38,321
When the values of R2 is too high then it will causing Q1(2N3904) can't get into the saturation region, If Q1 want to be a normal switch then R2 should be as 4.3K or 3.9K for a 5V input voltage, and R4 = 15K~47K
Not really.
Since R1 is 100k, the current through Q1 is just 148μA when ON.
This only requires a base current of 14.8μA for complete saturation.
With 5V applied to R2, and R2=R4=100kΩ, the base current is about 38μA, over twice needed for good saturation.
So the value of R2 and R4 of 100kΩ is more than adequate.
 

ScottWang

Joined Aug 23, 2012
7,498
Not really.
Since R1 is 100k, the current through Q1 is just 148μA when ON.
This only requires a base current of 14.8μA for complete saturation.
With 5V applied to R2, and R2=R4=100kΩ, the base current is about 38μA, over twice needed for good saturation.
So the value of R2 and R4 of 100kΩ is more than adequate.
For more discussion the other posts was moved to here.
 

Thread Starter

Luky Skywalka

Joined Mar 22, 2017
10
Hi again,

PICAXE arrived and here is the programming code as I promised. In a case someone would be interested I will try to put tutorial how to make it from a scratch. It will be on Instructables and link will be here later.
So for now, the code:


Init: 'setting up nicknames for variables
Symbol button_press = b0
Symbol audiomon = b3
Symbol PICAXE_Ears = w1
Symbol countdown = b8
GoTo PowerOn


PowerOn:
pwm 2,1,5 pause 10 pwm 2,2,5 pause 10 pwm 2,3,5 pause 10 pwm 2,4,5 'start up chime (could be worse :)
pause 10 pwm 2,5,5 pause 10 pwm 2,6,5 pause 1 pwm 2,7,5 pause 1 pwm 2,8,10
pwm 2,7,5 pwm 2,8,5 pwm 2,7,5 pwm 2,8,5 pwm 2,7,5 pwm 2,8,40

high C.4 'turning on power to transistor so the IC will keep powered up
pause 2000 'this is just to prevent accidental turn off by button press
GoTo KeepPower


KeepPower:
let countdown = time + 45 'setting up timer (time value will catch up
GoTo PowerOffManual 'with countdown value within ~ 5 minutes)


PowerOffManual: 'what to do when you press a button
button_press = 0
do while pinC.3 = 1
button_press = button_press + 1
pause 100
loop
if button_press > 5 then 'if you keep pressing for at least ~ 0.5 seconds
goto ShutDown 'then we are going to shutdown procedure
else
goto BatterySave 'otherwise we're going to check sleep mode
endif
GoTo BatterySave 'if button was not pressed, skip the previous and jump to other part of the program


BatterySave:
button_press = 0
readadc10 c.1, audiomon 'read ADC values with high sensitivity
debug

if PICAXE_Ears <= 512 then 'when nothing is playing (audio signal is almost 0)
if countdown < time and PICAXE_Ears<= 512 then 'and 5 minutes elapsed since last audio signal was detected, then
goto ShutDown 'we're gonna sleep
endif
else
let countdown = 0 'otherwise we reset countdown and time so our 5 minuter counter would work again..
let time = 0
goto KeepPower '...and we repeat setting up counter, checking for button press and sleep again
endif
GoTo PowerOffManual 'if music is playing, PICAXE has a break. No, not really. It is asked to go again and check the
'button and then sleep routine and again and again...


ShutDown:
pwm 2,6,20 pause 200 pwm 2,6,20 pause 400 pwm 2,7,5 pwm 2,6,5 'final bye-bye chime
pwm 2,5,5 pwm 2,4,5 pwm 2,3,5 pwm 2,2,5 pwm 2,1,10
pause 1000
low C.4 'Power down the transistor which turns off MOSFET
'thus powering down whole IC. Now the PICAXE has a break!
 
Top