• AVR Freaks

Hot!Do I need to worry about voltage swing?

New Member
  • Total Posts : 14
  • Reward points : 0
  • Joined: 2013/08/24 00:27:51
  • Location: 0
  • Status: offline
2019/08/25 22:39:11 (permalink)

Do I need to worry about voltage swing?

I have a circuit that uses the pic18F27J13, DS18B20, 24LC256 and an LED run of an unregulated 3x1.2v nimh battery back.
  1. uses HLVD to monitor the state of the battery i.e. when an interrupt occurs at 3V the program closes down cleanly.
  2. uses RTCC to keep track of time
  3. communicates using usart
My program loop is
  1. takes a temperature reading from the DS18B20
  2. processes the temperature captured 
  3. stores the temperature in the 24LC256
  4. communicates that it's done something using usart
  5. goes to sleep for 20 minutes
  6. wakes up and repeats this loop
The program works as expected.
I've observed one potential issue which I'm unsure whether it's a problem or not. When the pic is sleeping the circuit consumes about 20nA,  when it's processing it consumes about 7mA.
What I'm seeing is that when the PIC is sleeping my multi-meter sees the full 3.6V on the voltage rail, but when the program is processing this can drop by as much as 0.25V. Is this likely to be due to the internal resistance of the battery or something else? Should I be concerned about this or just work round it?
This voltage swing will have an impact on how I set the voltage level (HLVDL) of the HLVD module.  I'm setting it at 3V because of the DS18B20 because it's supposed to operate between 3 and 5v

2 Replies Related Threads

    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2013/08/24 00:27:51
    • Location: 0
    • Status: offline
    Re: Do I need to worry about voltage swing? 2019/08/26 23:11:02 (permalink)
    Shortly after making the original post I did the calculations and discounted battery internal resistance as the cause of the problem.
    Dived in to debug the code by using an if statement to gradually invoke the code that was processed in the main loop. This involved about 10 iterations. Every iteration except the last revealed a voltage swing of just .05V. The last iteration brought me back to the 0.25V swing which was causing my problems with HLVD.
    The problem piece of code that's causing the voltage to drop by 0.2V is
    The voltage dip here could well be more than the 0.25V I measured with the multimeter.
    Seems bizarre, won't have time to another look at  the problem until later this week. Closing USART was supposed to reduce power consumption before going into sleep, but what it appears to be doing is introducing a large dip in voltage that triggers an interrupt from HLVD. I've yet to measure the impact on power consumption of not closing USART before entering sleep mode.
    The circuit is still on a breadboard. I have checked that all the wires are properly seated.
    With the evidence I've seen so far and once I've understood what's going on with Close1USART() I can move to a more permanent solution for the breadboard.
    Super Member
    • Total Posts : 25585
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Do I need to worry about voltage swing? 2019/08/27 00:05:15 (permalink)
    +2 (2)
    What is providing the code for Close1USART(); ?
    PLIB? MCC?
    My guess us that it is disabling the USART peripheral, which is allowing the TX pin to become a (floating) input if you hadn't manually set it to output mode.
    I really don't think disabling the USART would be saving any significant power anyway. It shouldn't be using any if nothing is being transferred.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    Jump to:
    © 2020 APG vNext Commercial Version 4.5