I was thinking of making a quick push button wifi board. Push a button, it turns on, sends a message over wifi and shuts off completely. No power loss in sleep mode.
My idea is the push button connects GND to Arduino or ESP8266. Then in the arduino code during the setup() an NPN transistor is used to connect GND. When I release the button, the switch is disengaged, then the code will run and at the end of the code it will digitalWrite(X, LOW); and shut off the NPN, thus closing all GND to the ESP8266 or Arduino.
brolly759:
What I am noticing is that when I disconnect GND, all the pins go HIGH for some reason...
Because if you disconnect ground, there obviously is no LOW. Ground = LOW.
You have discovered why on/ off switches are not connected in the ground line, always in the (positive) supply line.
You need a circuit such as ilguargua described, at least the part with the "high-side" FET which is switched in turn by the "low-side" FET.
You do not need the other complications in that other than the resistors to turn the FETs off.
And the device specified works only at a minimum of 5V, it may be more practical to use (bipolar - common) transistors instead with the PNP performing the "high-side" switching and a NPN connected to the control pin of the MCU (each transistor having a resistor in series with its base). Your pushbutton can conveniently connect across the NPN collector to ground.
On paper this process looked like it would work, but when I tested it, it didnt work.
So if the rule of thumb is, GND disconnected, pins are high:
N P N
Ard GND | P(from PNP) | GND
P N P
P(from NPN) | Pin 4(HIGH) | Pin 2 (HIGH)
So basically when the switch is not pushed, PIN 4 and 2 are HIGH. the PNP does nothing. Then when the switch connects the GND, the circuit turns on, and I just need to make sure I put Pin2 High and Pin4 low. When I did this it didn't work for some reason. I then tested, when I connect the pin directly to the P on the NPN, I don't get the full 3v coming across GND, only 2.5v. The esp8255 can only output 15mA on the pin.
when I disconnect the pin I get the full 3v. Is there something I am doing wrong?
The PNP transistor being used is 2907A.
The NPN transitor being used is 222a.
3V circuit.
FYI, I don't know which resistors to use, so I have been using everything that I have and no dice.
Either you are using the circuit I last posted (with the 10k resistors; the 100k resistors can be anything higher), or all bets are off. I have explained that you do not switch the ground line.
Your reference to two different pins is confused. Only one pin needed to control it, which must be pulled HIGH as soon as it starts, and LOW when you need to turn off.
I think I may of found an issue. The ESP8266 can go up to 500mA spurts and averages 250mA, and I am actually using a 3904 NPN transistor. The datasheet says the current collector capabilities is 200mA and emotter is 40V. Can I still use these NPN and PNP transistors or do I need a different set?
So I followed the schematic you linked, not connecting power to ESP8266, I get 3.3v, the push button switch works, when I connect it to ESP8266 the voltage drops to 1V.
You need a transistor rated for the 500 mA impulse.
You also need a 100 µF capacitor across the ESP8266 supply terminals to help absorb these surges and I realised in the meantime that the resistor (R2) feeding the base of the PNP transistor will need to be more like 330 Ohms in order for the transistor to switch anything near that current. That is an extra drain on the battery while the circuit is running but is pretty much unavoidable.
Okay, do you have any recommendations off the top of your head on transistors rated for that high? NPN and PNP of course.
Also, the drain while its active is not a worry too much. I am make a wifi button, when you press it, it will send a quick wifi notification and shut down for good, so it wont take too much power long term.
Because you had that point connected to something that was running from a separate VCC. If it is connected to the device that is supplied by VCC, then there will be no voltage there when switched off. That is the whole point of the circuit.
brolly759:
Battery GND connected to GND on chip
V_Battery conneted to VCC on Battery
V_OUT connected to VCC on chip
HIGH to RUN connected to any output pin.
That is how it should be.
OK, so if you had a 330 Ohm resistor connected across the whole 5 V supply, then the power dissipated would be 5 x 5 / 330 W. I calculate that as 0.075 W, so that is the maximum you could possibly expect and even a 1/10 W resistor (which I think is what the little chip resistors are) would be quite adequate.
brolly759:
I am using a 3V circuit (coin cell). What about amperage, that doesn't play any part in this?
You are using a coin cell to power everything?
That will just plain not work.
Internal resistance of, say, a CR2032 is about 25 ohms at the levels you'd need to drive just the ESP. It is just plain not capable of supplying the 200mA needed to drive the radio.