3
\$\begingroup\$

I am trying to collect data from analog sensors (temperature and relative humidity) with a PIC microcontroller (PIC18F14K50). In order to save battery, the supply voltage of the sensors is turned ON when data have to be collected and turned OFF after. The supply voltage is controlled by the pin RB7 of the microcontroller. The problem is that when the pin RB7 of the PIC goes high, the PIC is reseted, I have tried several software and hardware modifications but the problem remains. I am out of ideas now, may you have any suggestions ?

enter image description here

Note :

  • If RB7 is turned ON at the very beginning of the program and remains ON, there is no reset.
  • The 4MHz crystal and two 15pF capacitor connected to RA4 and RA5 are not shown here
  • I am using a switching voltage regulator to provide the +5V from +9V battery
\$\endgroup\$
3
  • \$\begingroup\$ Maybe the 9v is dropping too low when you activate the sensors. \$\endgroup\$
    – Andy aka
    Commented Mar 19, 2015 at 23:37
  • 2
    \$\begingroup\$ You might need a bit more "bulk storage" on your +5V supply. Try adding a few 10's of uF with low-ESR capacitors. \$\endgroup\$
    – brhans
    Commented Mar 20, 2015 at 13:10
  • \$\begingroup\$ @brhans, Thank you for your comment, I added a 100nF at each steps and checked the result, with the third 100nF capacitor the reset problem has been solved. \$\endgroup\$
    – topic
    Commented Mar 22, 2015 at 14:11

1 Answer 1

3
\$\begingroup\$

I would guess, when you connect the +5V_SEC to +5V, there is a transient dip on +5V. That is perceived by the PIC as a brownout. The dip happens because the capacitors connected to +5V_SEC suddenly charge. You can probably see the dip with an oscilloscope.

[I've seen that sort of behavior before. I'll see if I can find the old oscilloscope screenshot.]

On a different note. Add a pull-down resistor from the gate of Q1 to ground. That will ensure that Q1 will not turn on RB7 is high impedance.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for your answer, I don’t have oscilloscope, but I checked the /BOR and /POR bits indicating that a brown out has occurred. As explained above, changing the bypass capacitor (C13) with a 470nF has solved the problem. Thanks for the missed pull down resistor. \$\endgroup\$
    – topic
    Commented Mar 22, 2015 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.