Don´t know why my PIC16F1503 is powering up. - Page 1
Forum section: electronics / general

author: diegoterc3
author_rank: Regular Contributor
timestamp: June 30, 2014, 10:24:16 pm
content: Hello I have a mini proyect that senses through ADC a rectified AC inlet. Also I have a switch and a voltage regulator for mi PIC. The switch only cuts off the output pin of the 7805 regulator. I know I can put the switch at the beggining of the circuit and the problem would be solved, but in this case I can´t because the circuit senses when there is power or not and if I put the switch at the beggining of the rectified AC that wouldn´t work.So my idea was this. When the switch is on, the pic would power up and start sensing and everything should work as expected. When the switch is off, nothing works right?. But here´s what happens.1) The switch is on, I plug the circuit and everything works fine.2) I turn of the switch with the AC still plugged in and a led indicator that I have keeps lit up.3) I turn the switch on, and nothing works. The led is still on.I have no clue why this is happening. My thought is that somehow when the switch is off the rectified AC current powers up the PIC from other pin that isn´t VDD or MCLR. Not sure about this one but on the datasheet it says that the pic would work with 2.3V and that is close to what my multimeter reads. I have turned off all the resets on the PIC by software.Has anyone else had this kind of problem before?. To make the question clear:Is there a way that a MCU can still work when there is no power on it´s power terminals but there is on other non-power related pin?

author: diegoterc3
author_rank: Regular Contributor
timestamp: June 30, 2014, 10:46:53 pm
content: Ok. Luckly for me the dataheet says that those diodes support +-20mA and the setup I have has a 3k resistor with 15V source at that pin so it has sinks around 5mA which would explain why the PIC is still working at that 2.3V rank. Obviouslly I´m not making that design mistake again.But I would like to solve this problem without having to make mayor changes on my PCB.Is there a way to limit the operating voltage by software? Or maybe a trick I can use to ensure that pin doesn´t sink that current when the switch is off? a diode or something like that?Thank you in advance

author: diegoterc3
author_rank: Regular Contributor
timestamp: June 30, 2014, 11:05:12 pm
content: OK I think I figured it out. If I use the POR and BOR interrupts I might be able to twitch my mistake. Please let me know if there is a better way that does not compromise my MCU.

author: dannyf
author_rank: Super Contributor
timestamp: June 30, 2014, 11:13:55 pm
content: Google ghost powering - sometimes a very convenient way to power remote comms stuff.Sounds like you are looking for a one-button on/off solution. There are tons of them on the net.If you want to stop ghost powering, put a sufficiently high value serial resistor on the adc pin, and across the Vcc/Gnd pins, put a small value resistor.

author: dannyf
author_rank: Super Contributor
timestamp: June 30, 2014, 11:47:24 pm
content: ADC'ng a pin isn't the most effective way to detect a voltage threshold.I would use a digital pin instead: apply the input voltage to a divider. and from there connect to a digital input pin. Adjust the divider so that it goes from 0->1 at the desired voltage. From that point, reading the digital pin will tell you if the voltage is above a certain threashold.The opposite works for detection of low voltage.

author: dannyf
author_rank: Super Contributor
timestamp: July 01, 2014, 01:30:18 am
content: Comparators would be another solution. It has the advantage of (more) flexible reference voltage but limited pin availability.

author: diegoterc3
author_rank: Regular Contributor
timestamp: July 01, 2014, 10:38:19 pm
content: Saddly I have used all of my pins so another ADC is not possible. Also read that the BOR and POR work for the whole 2.3 to 5V range so this time it won´t work.I started reading some things about ghost voltage but it doesn´t say how to fix or avoid this.QuoteIs there an engineering way to calculate this values?I will also try to use the FVR but i´m still trying to figure out the easiest way which sounds to be resistor one. Also I need the PIC to shut down when this happens or at least go to RESET mode. Sleep mode is not possible. If I use the FVR or other I know that there is a lowered voltage but is there a way I can get it to reset and then work normally when the voltage is ok?I will try both and see what works best.

author: dannyf
author_rank: Super Contributor
timestamp: July 01, 2014, 11:11:11 pm
content: QuoteThe basic reason for ghost powering is that the input, + the clap diodes + input resistance formed a loop. Vcc gets charged up sufficiently by the input signal when the power is removed.the purpose of paralleling Vcc/GND with a resistor is so the rail is never charged up high enough to power the mcu.So see your mcu wouldn't work unless Vcc is over Vccth. The parallel resistance is Rcc. and the input serial resistance is Rin and the input voltage is Vin.You want the following to be true:Vccth > Vin * Rcc / (Rcc + Rin).There are other considerations that may limit the values of Rcc or Rin. But that's the basic math.