Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Default State of Microcontroller Pins

KD494

Member level 5
Joined
Jun 24, 2015
Messages
83
Helped
13
Reputation
26
Reaction score
13
Trophy points
1,288
Location
Boston, MA
Activity points
2,058
Hello!

I'm having an issue with the attached schematic, and I can't work out what the mistake is. The intention of Q1 is to save battery life by only powering up the micro after the user presses one of the 3 switches (SW1-SW3). Once the user holds a button long enough to power the micro, it will immediately set I/O D6 low to keep Q1 on, and when it decides its time to power off it will write pin D6 high.

However, as soon as I insert the batteries the micro powers up, which means Q1 must inadvertently be turned on. Everything I can find about the micro indicates the I/O should be high Z when it is powered off, so I dont understand how Q1 is being enhanced. It does seem like the micro is not receiving the full 4.5V because the LED on board is extremely dim, and lights up to full brightness when I do press a button. Is there something I'm missing that could be allowing Q1 to pass current.

Thanks in advance!

Schematic.PNG
 
Also consider what voltage is across the switches when they are not pressed. You pull the tops high from the same VCC that they turn on.

Try increasing the pull-up resistors to say 100K to minimize the current through them but attach them to the battery + instead of VCC. I would also add a diode and/or a resistor in series with D6 so all the switch signals are isolated from each other and closing a switch doesn't short D6 to ground through the diodes.

Brian.
 
Hi,

The Mosfet is a P-ch one, so it's connection is correct, as far as I can see.
But it is almost 1 Ohms when ON, so there is rather high voltage drop.
I'd chose one with lower R_ds_on.

You should tell min (operable) and max (when charging) of expectable battery voltage

There are acouple of issues in the schematic: (some are already said by others)
* when VCC is OFF, it is considered about zero volts, so logic LOW.
* thus when VCC is OFF, the resustirs pull to LOW, switching the Mosfet ON
* the microcontroller IOs have internal protection diodes, one is in direction of VCC. So when VCC is LOW, they pull the IO (all 4 invokved) to LOW, turning your Mosfet ON.
* still the Mosfet's gate pull up resistor would provide a little current to the Arduino when the Mosfet is OFF ... draining out the batteries (slowly)

It's not the default state, that turns ON the mosfet, it's the resistors and the internal protection diodes.

Thus you need to change the circuit a lot:
* the pushbuttons (PB) are still connected to GND.
* the other leg of each PB needs to be connected to two diodes cathodes (for low voltage drop I recommend a schottky one. Maybe use a double diode like BAT54C)
* for each PB: the anode of one diode needs to be connected to the port input pin, the other anode to the Mosfet's gate.
* 100k pull up resistors (4 ×) should work. They all are connected correctly already
* the one missing function is the microcontroller output to ON the power supply: here you need to add an external N-ch Mosfet (bjt would work, too)
- S to GND
- G to output port D6. Install a 100k to GND as pull down
- D to the gate of the power supply P-ch Mosfet

This extra Mosfet inverts the D6 signal. For the power supply to stay ON D6 needs to be programmed HIGH ( LOW for OFF)

How it works:
The double diodes provide proper LOW level (when PB is pressed) to the power supply mosfet (to turn ON), as well as to the input ports, still they prevent from current flow from batteries to Arduino when power supply Mosfet is OFF.
Also the extra Mosfet provides proper LOW level to the power supply Mosfet (when D6 is HIGH), while it prevents from current flow from batteries to Arduino.

When OFF I expect a battery current in the nanoamperes.

I recommend a capacitor from power supply mosfet gate to GND. This makes the Arduino to power up automatically whennthe batteries become connected. But it also adds some delay to properly power ON, even on very short PB pulses. It also prevents from accidental turn ON caused by external noise (ESD ...)

Klaus
 

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top