‘ON’ Button circuit

efftek
Sat Apr 15, 2017 9:44 am
Hi, I am developing a hand held device with a TFT screen and navigation keys for a menu.

I would like to have an way to turn it on and off without using a simple power switch. My thoughts are to use an N gate MOSFET with a push button in parallel as shown below. Simply put, from an OFF state, GRD is connected to the MCU initially by pressing the push button (which will have to be held down for a couple of seconds) and when the MCU has booted up, it asserts the digital pin connected to the latch keeping GRD connected via the MOSFET. The unit is turned off, either after a period of inactivity to save power or after a seperate ‘OFF’ button has been pressed, or ‘OFF’ has been selected on the menu and the MCU has put its afairs in order (eg saving config data so it starts up next time in the same place) prior to unasserting the latch.

I would appreciate some input. Does this sound like a feasable solution?

on_switch.jpg
on_switch.jpg (38.67 KiB) Viewed 789 times

Pito
Sat Apr 15, 2017 10:05 am
Yes, it is. I used similar solution 35y back with a DIY multimeter. But with more enhanced functionality and no mechanical switch required :)
I added a small foil capacitor between Gate and ground, while the Gate-Vcc was 2 small metallic blobs on the (plastic) case. The multimeter was powered via that mosfet.
While putting my finger on the blobs it charged the capacitor immediately (via finger’s R), the mosfet switched on, after about 10minutes the C discharged itself and the multimeter switched off.
I liked it, my first invention :) :)

ahull
Sat Apr 15, 2017 10:39 am
Although the STM32F103 doesn’t have a built in touch controller, you might be able to use the method described here to allow you to add touch buttons.

https://www.youtube.com/watch?v=VRQ3XJO1VFo

+Ekawahyu Susilo Yup, touch control is implemented in software using pure GPIO functionality. In short – you set GPIO to output low, then start the timer and switch GPIO to input with pull-up (internal or external). Due to pad (and human body) capacitance, the GPIO input level will get high not instantly(it will charge the capacitance for some time, no more than dozen cpu ticks), this period is measured with the timer and compared to a threshold. Most of hardware touch controllers work just in the same way.


efftek
Sat Apr 15, 2017 11:58 am
Thanks for your replies guys.

@Pito, that’s an excellent method, well done, I wish I was that knowledgeable. I think I’ll stick to a tactile switch though.


efftek
Sun Apr 16, 2017 11:59 pm
Guys, it occured to me that as my hand held device is battery powered and I also need to plug it into the PC’s USB to transfer data, I can end up with two power supplies. The battery and the 5V from the USB.

I therefore need some protection to stop the board destroying magic smoke from appearing.

My prototype board has a 2 X 20 pin connector so I can plug a blue pill in and also has a 5V regulator and a 3.3V regulator to supply both 5V and 3.3V to the blue pill, the TFT and the sensors. It also has a coin cell for the RTC. Can anyone help with suggesting what I need to ensure that when I plug the USB in to the blue pill, I keep it and the battery power seperate to ensure no magic smoke ensues?

Thanks, Steve.


ahull
Mon Apr 17, 2017 12:19 am
Diodes…

More specifically, you probably need a Schottky diode in line with one or both power inputs to stop you from feeding one supply with the voltage of the other. Simple rectifier diodes may work, but may have too much voltage drop. Things become more complicated if your batteries are rechargeable, even more so if they are LiPo so perhaps we need a slightly more complex solution than the one I have just suggested.


vargham
Mon Apr 17, 2017 4:48 am
Once I made something similar.
https://circuits.io/circuits/3352039-so … h-5v-logic

Center button is ON. You can also check its pressed state with the MCU at the rightmost voltmeter’s positive input. It will be high when you press button.

The other button is OFF. You can change it to an MCU pin, so you can turn off power from software.



ag123
Mon Apr 17, 2017 5:35 am
found this, seemed like a similar concept as what ahull has posted
http://playground.arduino.cc/Main/Capac … n.CapSense
https://www.youtube.com/watch?v=BHQPqQ_5ulc

efftek
Tue Apr 18, 2017 7:10 am
Thanks for the replies.

Ive been thinking and I stand to be corrected if any of my thoughts are wrong.

The blue pill does not need 5V to run but when the USB is plugged in, the 5V pin is high so I can take that to a LiPo charger. The LiPo voltage will run my TFT shield when applied to the 5V pin as I have tested it but the backlight may not be full brightness however, it does seem well lit. It will also power the accelerometers, again I have checked. So basically, I only need to worry about the 3.3V side which I am protecting with a Schottky diode.

The following is my design for the power supply with a charger, 3.3V regulator and an ‘on’ button which is latched once the blue pill is booted up. I also have a PTC fuse to protect the LiPo circuit and maybe I should have included a second diode to protect from connecting the LiPo the wrong way round

charger.jpg
charger.jpg (155.11 KiB) Viewed 693 times

ag123
Tue Apr 18, 2017 8:25 am
for a blue pill i’d think it is quite possible to power it off 2 x 1.5v AA or AAA batteries, no regulator etc, then in software you could switch it into one of those ‘sleep’ or ‘standby’ low power modes, i.e. possibly the bluepill could run off those coin cell batteries or even ni-mh rechargable bateries
i think it also has ‘wake on interrupt’ features where in you can make a button connected to a gpio pin to wake the mcu up from sleep

you could literally program a timer in software in the stm32f103 to ‘switch off’ (rather set ‘sleep’ or ‘stand by’ modes) after a timeout and you could reset that timer on any activity (in software)


efftek
Tue Apr 18, 2017 9:42 am
Thanks for the comment ag123 however, it’s more than a blue pill. Theres a TFT screen which needs more than a couple of AA’s

My project is an extension of the board I already have – see below

Steve.

WP_20170417_10_46_28_Pro.jpg
WP_20170417_10_46_28_Pro.jpg (184.87 KiB) Viewed 207 times

ag123
Tue Apr 18, 2017 11:31 am
that’s a pretty cool project :D

Leave a Reply

Your email address will not be published. Required fields are marked *