ADC and power consumption


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    78

    Default ADC and power consumption

    I have a project based on a pic16f913 to open (unlock) a box of cigarettes after a certain period of time.

    parts used:
    -LM2936 (LDO Voltage Regulator 5V)
    -dumb LCD for countdown
    -BD6222 (H-Bridge to control the latching solenoid)

    The consumtion on SLEEP of the circuit is somewhere close by 42uA

    When i add the ADC to check the battery the consumtion increase to 390uA (with the ADC off.....ADCON0.0=0).


    Code:
    'CHECK THE BATTERY VOLTAGE
    
    TRISA.0 = 1                                   'set PORTA.0 to input
    ANSEL.0 = 1                                   'set PORTA.0 to analog
    ADCON0.7 = 1                                  'A/D result have to be right justified for 10 bits (2^10=1024)resolution (ADFM bit)
    ADCON0.6 = 0                                  'set voltage_reference=Vss (VCFG1 bit)
    ADCON0.5 = 0                                  'set voltage_reference=Vdd (VCFG0 bit)
    
    ADCON0.4 = 0                                  'set analog_channel=AN0=PORTA.0 (CHS bits)
    ADCON0.3 = 0
    ADCON0.2 = 0
    
    ADCON1.5 = 1                                  'set A/D conversion clock source to F_rc=dedicated internal osc (ADCS bits)
    ADCON1.4 = 1
    
    ADCON0.0 = 1                                  'enable A/D module
    PAUSE 4                                       'wait 0.5sec (...acquisition time)  (32768*500/4000000)
    'start_adc_conversion:
    FOR readADCloop=8 TO 1 step -1
       ADCON0.1=1                                'start A/D conversion  (GO/DONE bit)
        WHILE ADCON0.1=1                          'wait for it to complete
        WEND
                                                         
        VbatTEMP.HighByte = ADRESH                'read high-byte of result
        VbatTEMP.LowByte = ADRESL                 'read low-byte of result
        Vbat=Vbat+VbatTEMP
        PAUSEUS 13                                'wait 10msec (10000*32768/4000000)
    NEXT readADCloop
    
    
    
    SELECT CASE Vbat
        CASE IS < 500
            END                                   'battery is too low to drive the solenoid=END THE PROGRAM
        CASE IS < 900                             'attention: battery low
            LCDDATA10.5 = 1                       'write to lcd "b" (as in Battery low)
            LCDDATA4.5 = 1
            LCDDATA7.5 = 1
            LCDDATA4.6 = 1
            LCDDATA1.5 = 1
    END SELECT    
    
    ADCON0 = 0                                    'disable A/D module
    It is normal just one ADC to increase the consumtion so much ???

    Im sure is something wrong with my setup / code

    Please just take a look... Thank You
    Attached Images Attached Images  

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Was the battery voltage divider in circuit before the ADC command was added and the first measurments taken?

    Leave the code as is and disconnect the divider from the battery and see if that makes a difference.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    bogdan,

    That voltage divider alone is using 45 uAmps all the time. Also, why are you using resistors R5, R9, and R10? If you have these ports set to high then you would have more current leaking in there.

    Robert

  4. #4
    Join Date
    Jan 2009
    Posts
    78


    Did you find this post helpful? Yes | No

    Default reply / thx

    Was the battery voltage divider in circuit before the ADC command was added and the first measurments taken?
    No, the voltage divider circuit wasn`t there when i measured 42uA


    Leave the code as is and disconnect the divider from the battery and see if that makes a difference.
    It is going back to 42uA


    R5, R9, and R10
    = pulldown resistors for unused pins



    Thank You for your help ...

  5. #5
    Join Date
    Jan 2009
    Posts
    78


    Did you find this post helpful? Yes | No

    Default what about now ?

    In order to reduce the power consumption it is a good idea to use a common emitter transistor circuit for the voltage divider (as in the attachment) ?

    I will
    Code:
    High PortA.1
    during the ADC reading/conversion

    Best Regards,
    Bogdan
    Attached Images Attached Images  

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts