Vous êtes sur la page 1sur 4

construction

construction
C9 bypasses the ripples, if any, in the regulated power supply. LED1 acts as the power-on indicator. Resistor R26 limits current through LED1.

Battery Bank Protector With Multiple Features


SriraM V. and arUnMUTHUPandian C. he prime function of a battery management system is to provide the necessary monitoring and control to protect the battery bank from out-of-tolerance ambient or operating conditions, saving the user from the consequences of battery failures. The microcontroller-based battery bank protection system described here can monitor the charge level, voltage, run time and temperature of your battery bank. It is designed around PIC16F877A microcontroller and also provides battery protection against high temperature and dry-run. The system is very useful for IT firms, computer laboratories, colleges and schools.

Circuit description
The block diagram for microcontrollerbased battery bank protector is shown in Fig. 1. The microcontroller senses the signals from three battery sensing units, temperature sensor and AC mains sensing unit. It controls the supply to the appliances and displays corresponding information on the LCD. The power supply section powers the complete circuit. The keyboard is used for time setting and can also mute the buzzer. Real-time clock (RTC) provides the timing inputs. Microcontroller. PIC16F877A is a low-power, high-performance, CMOS 8-bit microcontroller. Its main features are 8kB flash, 256 bytes of EEPROM, 368 bytes of RAM, 33 input/output (I/O) pins, 10-bit 8-channel analogueto-digital converter (ADC), three timers, watchdog timer with its own on-chip R-C oscillator for reliable op2 C interface. eration and synchronous I RTC DS 1307. Timing inputs are generated by RTC DS1307. It is a lowpower, real-time, full binary-coded 104 www.efymag.com october 2012 | electronics
for you

Relays RL1 and RL2. Relays RL1 and RL2 are operated through wire, bidirectional 12V unregulated supply. bus. The These clock/ are driven by calendar transistors provides T1 and T2, respectively. seconds, minutes, Port pins RC0 and hours, RC1 day, of midate, crocontroller month PIC16F877A and year drive transistors information. T1 and BatT2 into saturation tery (BATT) to eneris congise relays nected RL1 and at RL2, pin 3 to respectively, provide to operate battery the appliances backup. either on AC mains or battery Data backup. is transFig. 1: Block diagram for microcontroller-based battery bank protector Buzzer. ferred Port between pin RC2 the microcontroller of microcontroller and the RTC using PIC- two ParTs LisT wires (from16F877A the I 2 C drives bus), transistor one of which Semiconductors: serves as the T3 clock into line saturation (SCL)to and ring the IC1 - LM35 temperature sensor other as data the line piezobuzzer (SDA). The (PZ1). RTC is IC2 - PIC 16F877A microcontroller IC3 - DS1307 RTC driven by an external Battery 32.768kHz and mains crysIC4 - 7805, 5V regulator tal. Pins 5 and voltage 6 of DS1307 sensing circuitry. are pulled LED1 - 5mm red LED high by resistors The battery R20 and sensing R21 and circuit D1-D20 - 1N4007 rectifier diode connected to for pins BANK1 RC4 and is a RC3 voltage of the diT1-T3 - BC547 npn transistor microcontroller, vider respectively, circuit made for by resisserial Resistors (all -watt, 5% carbon): R1, R3, R5, R7 - 33-kilo-ohm communication tors R1 between and R9. theThe RTC output and R2, R4, R6, R8, the microcontroller. of the voltage divider is R15-R21, R25 - 10-kilo-ohm by the LM35. filtered The LM35 is acombination temperature R9, R10, R11, sensor whose of output resistorvoltage R2 andis capacilinearly R12, R13 - 5-kilo-ohm R14 - 1-kilo-ohm proportional tor toC2. degree This Celsius signal is (cenfed to R22, R23, R24 - 2.2-kilo-ohm tigrade) temperature. ADC channel Its low RA1 output of miR26 - 470-ohm impedance and crocontroller linear output PIC16F877A. make VR1 - 10-kilo-ohm preset interfacing easy. Diodes It D1 is rated and D2 to operate proCapacitors: over a temperature tect the range microcontroller of 55C to C1-C5, C11 - 10F, 16V electrolytic C6, C9 - 0.1F polyester 150C. Its other portsimportant from voltage features spikes. C7, C8 - 22p ceramic include linear Similarly, +10.0mV/C outputs scale of the factor C10 - 1000F, 35V electrolytic and current sensing drain ofcircuits less than of60 BANK2 A. Miscellaneous: Power supply. and BANK3, The and 230V, mains 50Hz AC S1-S5 - Push-to-on switch mains is stepped voltage, down are by fedtransformer to ADC RL1, RL2 - 12V, 1C/O relay X - 4MHz X1 to deliver channels a secondary RA2, output RA3 and of TA L1 X - 32.768kHz TA L2 12V, 500 mA. RA4 The of transformer the microcontroller, outX1 - 230V AC primary to 15V, put is rectified by a bridge rectifier respectively. 500mA secondary transformer comprising diodes D14 through D17, LCD - 162 LCD filtered by capacitor C10 and regulated
BATT. - 3V battery PZ1 - Piezobuzzer

by IC 7805 (IC4). Diode D18 is used to isolate the filtered voltage from the mains sensing voltage. Diodes D11, D12 and D13 prevent unregulated supply from passing to the batteries Fig. 3: Pin configurations of 7805 when AC mains is on. Capacitor and BC547
electronics for you | october 2012 www.efymag.com

decimal clock/calendar having 56 bytes of non-volatile static randomaccess memory (RAM). Address and data are transferred serially via a two-

103

construction
Display. A two-line, 16-character alpha-numeric liquid crystal display (LCD) is used to show the messages. Data lines D0 through D7 of the LCD are connected to port B of PIC 16F877A. Register select (RS), control (R/W) and enable (E) lines are connected to port pins RD0, RD1 and RD2 of the microcontroller, respectively. Preset (VR1) is used to set the contrast of the LCD for proper display. Switches. Switches S1 (SCRL), S2 (Inc), S3 (Dec), S4 (Set) and S5 (Mute) are interfaced to port pins RC5, RD7, RD6, RD5 and RD4 of microcontroller PIC16F877A to set the real-time clock and mute the buzzer. To set the time and date, press Scroll switch S1. The display will show Hour. Press Set (S4) switch and change the hours value using increment switch S2 or decrement switch S3. Again, press Set switch (S4). The display will show minute. Change the minutes value by using the increment and decrement keys and then again press Set switch. The display shows AM/PM. Select either AM or PM using increment/decrement switch and press Set (S4). Now the time setting is over and the correct time is displayed on the LCD. Port pins RC5, RD7, RD6, RD5 and RD4 of microcontroller PIC16F877A are pulled high with resistors R15 through R19, respectively, and RD3 is pulled down by resistor R25 for key return.

Fig. 4: An actual-size, single-side PCB for the microcontroller-based battery bank protector

Construction and working


An actual-size, single-side PCB for microcontrollerbased battery bank protecelectronics for you | october 2012

Fig. 5: Component layout for the PCB

www.efymag.com

105

construction
tion is shown The display TEMP: 043 deg C in Fig. 4 and scrolls down further TIME : 11:43 PM its component to show the changeFig. 6: Temperature and layout in Fig. 5. over timereal time time display on the LCD Assemble the at which the supply circuit on a PCB changes from mains BAT-1 POWER:099% as it minimises to battery supply BAT-2 POWER:099% time and assem(refer Fig. 10). Fig. 11: Configuration bit Fig. 7: Power indication of bly errors. Carebattery banks 1 and 2 Software fully assemble Header Files Used in the Program The program is written in C the components BAT-3 POWER:099% and doublelanguage and compiled using MAINS VOLT:206Files V and subroutines Functionality HI-TECH PICC compiler to check for any #include delay.c Generate a time delay Fig. 8: Power indication of overlooked ergenerate hex code. The generbattery bank 3 and mains #include i2c_bat.h Configure master/slave port ror. Use proper ated hex code is burnt into the voltage #include lcd_bat.h Contains the display subroutine IC base for the microcontroller using a suitable #include adc_bat.h Contains the analogue-to-digital programmer with configuration microcontroller BAT1, conversion data bit setting. The set configuration and RTC. Before DRY RUNNING void control(void) Control real-time monitoring inserting the bit is shown in Fig. 11. process Fig. 9: Indication for ICs, check all the battery power below 60 When the system is switched void key(void) Check the status of the pushbutton and set the real time supply voltages. on, the main program initiates per cent When power the LCD. The display scans every five seconds, showing all the param is switched on, analogue input is converted into 8-bit BATTERY RUN TIME the microcondigital data by the ADC. The sensed eters. The control subroutine monitors 000:08 (MMM:SS) troller-based battery power is displayed on the LCD all the parameters at the background battery bank in terms of percentage (refer Fig. 7). without interruptions. CLRWDT( ) is Fig. 10: Battery run time protection mesThe display can be scrolled down used to reset the watchdog timer. If the sage is displayed on the LCD along again to check the voltages of batmicrocontroller cannot reset the watchwith a short beep from piezobuzzer tery-3 and mains. The analogue input dog timer to the particular time period, PZ1. The battery temperature is sensed is converted into 8-bit digital data by an internal reset can be generated to by LM35 and displayed on LCD (refer the ADC. The mains voltage is sensed reset the microcontroller to avoid malfunction. The header files used in this Fig. 6). Simultaneously, the real time from the unfiltered output of the bridge rectifier. The sensed battery-3 is read from RTC IC DS1307 and disprogram are shown in the table. played on LCD (refer Fig. 6). When the battery temperature rises above 50C, the piezobuzzer sounds an alarm continuously and both the relays de-energise to cut off the power to appliances. The display can be scrolled down to check the power of batteries 1 and 2. Powers of batteries 1 and 2 are sensed by the ADC of the microcontroller. The and mains voltages are displayed on the LCD (refer Fig. 8). If any battery bank (say Battery Bank 1) goes down below 60 per cent, it is displayed on the LCD as indicated in Fig. 9. Piezobuzzer PZ1 sounds continuously if all battery banks go below 60 per cent. When the mains fail, the microcontroller shifts the appliances from mains to battery supply through relay RL2. EFY note. The source program of this project is included in EFY-DVD and also available on the www.efymag.com website for free download.
V. Sriram is a lecturer in Department of EIE, Maharaja Engineering College (MEC), Coimbatore. C. Arunmuthupandian worked as an R&D engineer in a private firm and is studying EIE at MEC, Coimbatore. Their interests are automotive control applications and embedded systems

106

october 2012 | electronics for you

www.efymag.com

Vous aimerez peut-être aussi