Fly Electric!

'LVC1' - Lithium Low Voltage Cutoff / Data Logger

This device monitors a 3 cell lithium battery to prevent any cell from going below a voltage threshold. Most ESCs can monitor all three cells, but only 'as one'. Should one cell drift lower than the others, it is likely to get damaged. The more cells you have the greater the risk. This circuit prevents that. It can also provide valuable flight data. LVC2 is a version that can monitor 2 separate packs in a twin.

The program is written for Microchip's PIC12F683 chip and the BoostC compiler. Other chips with at least 3 ADCs should work too. As with many of their chips this one has a 256 byte EEPROM flash memory. This can store up to 256 events which I have programmed to be 128 highest throttle positions and 128 lowest low cell values. With heatshrink covering, my circuit weighs 13.5g.

PLEASE NOTE: THIS DESIGN IS PROVIDED WITHOUT WARRANTY AND FOR PERSONAL NON-COMMERCIAL USE ONLY.

C source code | PIC Projects | Beginners Guide

The exact workings of this device are recorded in the above C file. However, the following describes it operation and some design features.

* The PIC converts cell voltages to digital representations based on a reference voltage. 5v is a logical choice and any 5v regulator will suffice but a 0.1A capability is more than adequate. I drive this from all three lithium cells. Their voltage should range between 8.4 and 12.6v so make sure the input and drop-out voltages of your regulator are suitable. The regulator will need a capacitor on both input and output (C4/C5) and its data sheet will specify typical values.

* On brushed motors I have found it necessary to provide additional filtering on the supply from the battery. My regulator seems sensitive to voltage spikes which caused the PIC to hang and the motor stops running. So my experience so far is that C6 is optional. I found 100uF to be just too small, 220uF OK so the 470uF suggested should provide a little more resilience. C6 would normally be an electrolytic capacitor with a voltage rating comfortably in excess of the supply voltage (16v minimum for 3 lipos, 25v better).

* ESC's with BEC have 5v regulators built into them but these are not normally suitable for use as the PIC's reference voltage. Their ability to regulate accurately is often affected by servo load, heat build-up and poor connections (the smallest resistance has a dramatic effect on voltage as servo current rises). In the tests I have performed they have fluctuated by up to 0.5v which would cause problems with this circuit. So go with a separate regulator as discussed above.

* The PIC can only accept inputs up to its working voltage. This means you have to divide each cell input with a 'resistor divider' to give the required ADC input voltages to the chip. As you can see I have used 15k and 43k. This creates a ratio of 15k:58k which means that the 12.6v input (3rd cell) will be 3.26v at the chip, the second cell will be 8.4v (ie: 2.17v at the chip) etc.

* To help smooth the inputs I put a 0.1uF capacitor across each input. I was not very scientific about this value. The cell voltages recorded by my data logging are believable so I think this aspect of the design is OK.

* The '10 bit' ADCs in this chip converts the reference voltage into 1023 steps (~0.005v each). This is compared with the input voltage to yield an ADC 'value'. At 12.6v, the ADC value of the third cell (3.26v) will be ~671. Since this represents 3 cells, a single cell will have an ADC value of about 224 when fully charged (671/3). This fits comfortably into an 8 bit register (0-255) which helps keep the program size down and allows more data records to be stored in the EEPROM memory.

* You generally want resistor divider values to be as large as possible to reduce the load on the cells. However, they also provide current to internal ADC capacitors used for the ADC conversion. This has to be between 10 and 1000 uA for the chip I used. To help check that these values are in spec and to keep the resulting single cell ADC values <255, I developed this spreadsheet.

* I have included one LED on my board to flash on startup and to help with diagnostics. Choose R7 to limit current to say 5-20mA (it does not need to be very bright). Anything from 560 to 1k is probably OK.

* I have a 6 pin plug for in-circuit programming. You only need 5 pins but I remove one of the 6 to ensure correct orientation.

* LVC circuits can be prone to false triggering (on voltage measurements). A number of design features reduce this risk:
(i) I only sample the voltages every time the RX signal goes low. This occurs about every 20ms on most radios. So I 'only' measure about 50 times a second which may sound very frequent but this is much slower than a PIC can perform.
(ii) Each voltage measurement is actually four measurements to average results (ie: ~200 measurements per cell per second).
(iii) As you can see on my Lithium Tester page, a cell's voltage 'overshoots' when a load is suddenly imposed. This is a very short event (about 0.2sec) so I always ignore voltage changes for 0.2sec after the throttle exceeds 75%.
(iv) The ADC inputs are buffered with capacitors.

* I have also built in some pulse-width checking. The ESC should handle most safety checks and I've not tried to replicate those. However, I do prevent the program from jittering between steps which makes the signal to the ESC more 'solid'. I also ensure that pulse widths that are way out of band are ignored. The design memorises the last 'good' signal and replays that to cover glitches and jitter.


DATA LOGGING

The data logging happens automatically on every flight. It remains persistent even after disconnecting the power supply. It starts being over-written 3 seconds after it is powered up (after the LED finishes flashing 3 times). You need a programmer interface cable to access the data as suggested on my main PIC page. The raw data then needs to be manipulated in Excel to provide the above graphs.

The throttle position and cell voltages are measured every time the Rx signal pulses (every 20 milli-seconds on most radios). The highest of the throttle positions is determined as is the lowest of the cell voltages. These data points are then written to memory every 7 seconds to give 15 minutes recording time. So, every 7 seconds you get a pair of records containing the highest/lowest events during the past 7 seconds. The gap between writes can be changed for different recording periods. The data will not over-write (wrap around) during a flight. So if you fly longer than 15 minutes the extra data is not recorded.

Back
Click on the links below for other pages.

Home Art of the Possible Absence of Matter Links Updates Email
SITE MAP