Continue to Site

# Remote Control battery managment!

Status
Not open for further replies.

#### martinisonline

##### Member level 2
I am building a remote control and i want to put a led that indicates when the battery was low.

so, when i press a button, and if the battery was low, the led turn on while the button is pressed.

I need some ideas...

I'm using a PIC and CCS...

The PIC has an ADC which should be easy enough to use. Simply connect the battery to a very high value voltage divider say 2 1meg resistors and feed that into the ADC pin. Just wait till you drain your batteries to what you consider a low state and then read the ADC value, use that value to compare the ADC value to all the time and then run the routine for 'low battery' when the ADC value drops bellow that minimum acceptable value. The exact value the ADC will get to may be a little tricky because I'm not sure what the input impedance of the ADC on a PIC is. The input impedance will alter the voltage divider network's linearity. If you can tell me what the voltage refrence of the ADC on your PIC is and what the input resistance is I can give you a better idea. You can use a lower value voltage divider network if the linearity is unacceptable but 2 1 meg resistors will already draw 500 pico amps, and for a battery powered application you don't want to do much more than that.

### martinisonline

Points: 2
I would not turn on the LED when the battery is low. First of all, you drain it even more and second of all, if the battery is dead you cannot tell, since the LED can no longer be turned on.

So I would turn on the LED whenever the battery is in good shape and you press a button to transmit something.
You can use the A/D to decide all that, but you will be surprised, because you need high value resistors in the divider, to avoid draining the battery. But the PIC's A/D needs a source impedance of less than 10kΩ, in order to preserve accuracy. That means that each of your resistors should not be higher than 20kΩ each, which means a 40kΩ resistor total across the battery ALL the time.

Personally, I would just connect an extra LED with its own current-limiting resistor right across the IR LED/ resistor combination. That way, whenever you use the RC, the visible LED will pulse, indicating the RC is working. When the battery is dead, the visible LED will be off, so you will know something is wrong.
Of course, you cannot tell accurately the state of the battery, but you can judge it approximately by how bright the visible LED is.

### martinisonline

Points: 2

I thought already a ADC solution, but i have a problem. The ADC needs a Vref (reference voltage) that normally is a combination of VCC. When a battery is discarging, its voltage drops, and consequentely the Vref drops too!!!

I can put a zener or something that have a voltage drop constant, but the problem is that this circuit drain current just for 'nothing'!!! reducing the battery life...

The led in the remote control, is not the problem. I'm thinking and i can remove it. In the data transmitted i can put a bit that indicates the battery low, and the receiver, that have a matrix of leds, indicate the message.

So, the problem is how can i know the voltage of the battery to know that is running low!!!

My idea is : if the battery is 1,5 x 2 = 3V. The pic runs up to 2V. If the voltage is for example, 2,2V, then it sends a signal of battery low when i press a button.

Sorry my english...:|

The ADC of your PIC should have an internal voltage refrence selection which is usually a bandgap refrence that is essentially valid at the limits of the PIC's VCC voltages. This is usually in the 1-3 volts range. It would help if we know what PIC you were using for the ADC. If you're going to run it down bellow 2 volts or so you're going to want a bandgap voltage of 1.6 volts or lower. This is where picing an MCU and external battery requirements becomes kind of difficult. If you can give me the pic model you're using I can look up the internal voltage refrence (if available) if not you can always use a relational voltage derived from VCC and divide it twice, once for VCC and once for the ADC input, this would make the acuracy of the ADC input more exacting but not so much so as to be impossible. Also I'm not sure if your pic can do differential analog in which case you can come up with an absolute voltage related to a static divider from a battery if you want to.

### martinisonline

Points: 2
I'm not decided yet what PIC, but my first shot is the 16F819 because it has internal oscillator that can runs at very low frequencys, reducing the power and external components.

The remote control have around 6 buttons.

If you can recomend other pic better, i will apreciate.

Tanks.

I am biased because I use another companies chips. Atmel makes a line of processors the AVR series which is a very good sollution for general wide ranging applicatons. PICs tend to be more specialized in their application, and hence more limited in situations like this which require a wide range of capabilities. One major advantage an AVR has over a PIC is the processor speed is directly dependant on clock speed. PICS uses four system clocks for each processor clock, where as AVR's use one system clock for each processor clock. Giving an AVR an inherant speed advantage of 4 depending on the system clock.
They use a bit more power during idle and sleep modes but may be worth looking into. I'll look into the 16f819 series over the next day or so here and see if an AVR can compete, if not how best to use that PIC line.

### martinisonline

Points: 2
I have read something about atmel and AVR, but i don't know nothing about it. About pic, I have some pics and the lots of hardware for them... ICD1, ICD2, RS232-TTL, etc...and i learn assembler and C to pics...

So, i need to find a solution to my problem with pics, i'm more confortbale with them...

Tanks.

The recommended input impedance to the pic's ADC line is 2.5k ohms, the maximum is listed at 10k ohms. That's the required impedance to fully charge the capture and hold capacitor. This is too low to sample from 2 1 meg resistors acting as a voltage divider, unless the aquisition time was extended and I'm not sure if that is possible for a PIC's ADC, a pic expert would have to chime in on that part. An external capture and hold circuit may be required in this case.

We can control the A/D conversion clock. The time of one conversion can't be less than 1.6us and not greater than 6.4us...

But the time of sample/hold, i think we can't change it...

So, the voltage divider is out of question...

Any more ideas???

The voltage divider is not necessarily out of the question.
You can use a comparator with integrated reference, such as Maxim's MAX918, that has a total quiescent current of only 1.3µA and can operate down to 1.8V.

The reference voltage on this part is 1.245V, so you will need a voltage divider. However, since the input current is a maximum of 2nA, you can choose large resistors for the divider, avoiding current drain.

For example, you can choose the resistor to ground equal to 1MΩ, so the upper one would be about 820kΩ, resulting in a threshold of 2.25V.

The Thevenin equivalent of the divider is then 444kΩ. With that, the error due to the input bias current would be 444kΩ*2nA=0.9mV at the comparator input, which means only about 2mV at the divider input. Instead of a theoretical threshold of 2.25V, you would actually get 2.252V. Not bad!
You will get more errors due to resistor and reference tolerances than due to input bias current.

The total drain on the battery would be: 3V/1.82MΩ+1.2µA=2.85µA. That is pretty good.
The PIC will draw probably more current than that. One way to deal with that is to put the PIC to sleep and have it wake up on a port pin change, send out the code and go back to sleep. That way you minimize the battery drain when the RC is not in use.
Whenever it wakes up, the PIC can do a test on the comparator output and see if the battery is too low. If so, it would not light up the visible LED, indicating the battery is too low. Perhaps it should not send out any codes, seeing that the battery voltage could drop even more, due to the increased consumption, possibly resulting in faulty operation.

Just use a large value capacitor with a low leakage current in parallel with the voltage divider. With the input capacitance being about 14pf just use something like 1u min, and don't sample it very often. Completly negates the high impedance problem. Sorry I didn't post this earlier but the people over on AVR freaks mentioned it.

The cap at the A/D input is generally required and it does help remove the conversion noise.
However, the source impedance that charges up the capacitor is still your Thevenin equivalent of the divider. If that resistor is too large, then the leakage current of the A/D input can cause significant errors.

Look at hte picture. The leakage can be as high as 0.5µA. If the Thevenin equivalent is 1MΩ, you can get an error of up to 0.5V!
Or, put another way, you get 0.5/3*100=16 % error. Not very good.

In many cases the error will be smaller, though.

Status
Not open for further replies.