PDA

View Full Version : ADC and power consumption



bogdan
- 31st March 2010, 03:02
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).



'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

mackrackit
- 31st March 2010, 07:07
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.

rsocor01
- 31st March 2010, 08:23
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

bogdan
- 31st March 2010, 15:03
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 ... :)

bogdan
- 10th April 2010, 04:25
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

High PortA.1
during the ADC reading/conversion

Best Regards,
Bogdan