Abstract:
The present disclosure provides a programmable controller for monitoring battery performance and usage at a remote pump jack location. The disclosure provides an energy efficient controller and display system which allows the operator to quickly and accurately test batteries in an installation. It uses programmable logic to switch between system modes and decide which battery supplies power to the output. Further it will sense any high voltages at and disable the input from the faulty source. Further, the programmable logic is designed such that the mode selection process is automatic when the system is in operation. The purpose is to elongate battery and connected equipment life by preventing battery failure. The present disclosure also provides an easy and economical method of communicating potential battery failure and status to an operator via cell phone communication.

Description:
FIELD OF THE DISCLOSURE 
       [0001]    The present invention relates generally to the control units for chemical pumps at oil well pump jacks and more particularly to a device which enables adjustment of power supplies from two or more batteries and to monitor the conditions of each battery at each well site for status information and transmission of such information through an economical text message format to an operator. 
       BACKGROUND OF THE DISCLOSURE 
       [0002]    In the production phase of an oil well, it is usually necessary to artificially lift the crude oil from its natural level in the wellbore to the wellhead. The two most common lift methods are to use either a surface pumping unit or a subsurface rotary pump, A familiar sight in the oil fields around the world is the conventional beam pumping unit (pump jack). This method of bringing oil to the surface accounts for between 70% to 80% of the artificial lifting of oil. The pumping unit may be powered by either an electric motor or an internal combustion engine. In either case it is usually necessary to couple the motor and pump through a speed reducer. A reduction of 30 to 1 is typically needed to operate the pump at 20 strokes per minute (spm). The rotation of the prime mover is converted into an up-and-down motion of the beam and horse head through a pitman/crank assembly. The oscillating horse head of the pumping unit raises and lowers a sucker rod and reciprocates the sucker rod pump in the wellbore. This action lifts the oil on the upstroke to the wellhead. 
         [0003]    During production it is often necessary to inject a treatment chemical into the annular space between the well casing and tubing. These might include demulsifiers, corrosion inhibitors, scale inhibitors, paraffin inhibitors, etc. Demulsifiers are chemicals used to dehydrate crude oil containing emulsified water. In many cases this water-in-oil emulsion is very stable. Without the use of a demulsifier, the water would not separate from the crude oil, The rapid separation of the water from the oil phase may be necessary at the well site because of limited storage capacity. The combined total of water remaining in the crude oil must be below 1% in most cases. Excess water can cause serious corrosion problems in pipelines and storage tanks. In addition, water in a refinery stream can interfere with the distillation process and damage the refinery equipment. 
         [0004]    In wells which use a production pumping unit, a small chemical pump may be used to inject the treatment chemical into the wellhead. Several types of chemical pumps are known in the art. For example, a pneumatically powered system creates motor force by utilizing compressed air or gas to power a motor. The motor applies forces to a plunger or diaphragm which in turn inject chemical into the well at a measured rate. Another example is electrically powered systems. These systems create motor force by utilizing municipal electricity to power an electrical motor. The motor applies force to a plunger or diaphragm which in turn injects the chemical. A variant of the electrically powered system is a solar powered system which utilizes solar cells to create electricity. The electrical current is stored in a battery bank which in turn powers a DC electric motor. Sealed gel or a matted glass batteries are required due to deep cycle requirements of the environment. Furthermore, these systems must be designed to operate without sunlight for extended periods of time up to thirty days in locations such as Canada, Northern Russia or the Artic. 
         [0005]    In solar powered systems extended delays without sunlight due to cloudy weather or location can create a problem for maintaining battery voltage and therefore proper chemical injection rate. 
         [0006]    It is therefore extremely important to provide reliable battery service for chemical injection pumps for pump jacks. However, as with other mechanical systems of the pump jack, routine maintenance is required to assure battery performance. The routine maintenance is difficult to provide because the battery usage varies widely from installation to installation. In the prior art, to assure battery performance an operator is required to periodically travel to the installation and test the batteries to prevent failure. Repeated travel to the installation raises costs and reduces profit. Similarly, neglected batteries can easily cause injection failure with concomitant losses in production or efficiency. 
       SUMMARY OF THE DISCLOSURE 
       [0007]    The present disclosure provides a programmable controller for monitoring battery performance and usage at a remote pump jack location. The disclosure provides an energy efficient controller and display system which allows the operator to quickly and accurately test batteries in an installation. It uses programmable logic to switch between system modes and decide which battery supplies power to the output. Further it will sense any high voltages at and disable the input from the faulty source. Further, the programmable logic is designed such that the mode selection process is automatic when the system is in operation. The purpose is to elongate battery and connected equipment life by preventing battery failure. The present disclosure also provides an easy and economical method of communicating potential battery failure and status to an operator via cell phone communication. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0008]      FIG. 1  is a schematic of a dedicated control system for a chemical pump in place at a pump station. 
           [0009]      FIG. 2  is a schematic view of the components of a preferred embodiment of the present disclosure. 
           [0010]      FIG. 3  is a schematic of the microcontroller circuit of a preferred embodiment of the present disclosure. 
           [0011]      FIGS. 3A-3D  is a schematic of the microcontroller circuit of a preferred embodiment of the present disclosure. 
           [0012]      FIG. 4  is a schematic of the sensing control circuit of a preferred embodiment of the present disclosure. 
           [0013]      FIGS. 4A-4C  is a schematic of the sensing control circuit of a preferred embodiment of the present disclosure. 
           [0014]      FIG. 5  is a schematic diagram of a communications board of a preferred embodiment of the present disclosure. 
           [0015]      FIG. 6A  is a flowchart of the system functions of a preferred embodiment. 
           [0016]      FIG. 6B  is a flowchart of a status interrupt request of a preferred embodiment. 
           [0017]      FIG. 6C  is a flowchart of a system communication interrupt request of a preferred embodiment. 
           [0018]      FIG. 7A  is a preferred embodiment of a look up table of a preferred embodiment. 
           [0019]      FIG. 7B  is a preferred embodiment of a look up table of a preferred embodiment. 
           [0020]      FIGS. 8A-8V  are a preferred embodiment of a software program stored in memory of the microcontroller circuit. 
           [0021]      FIGS. 9A-9U  are preferred embodiments of .cpp programs and .h library files of a preferred embodiment. 
       
    
    
     DETAILED DESCRIPTION 
       [0022]    Referring then to  FIG. 1  a preferred embodiment of system  100  will be described. Solar panel  102  and  104  are connected to charger regulators  106  and  108  respectively. The solar panels in a preferred embodiment are 80 watt solar panels which generate less than 20 volts a piece. Charger regulators  106  and  108  are capable of transferring approximately 14 volts to each battery and serve to regulate the output from the solar panels. Battery  110  and battery  112  are connected to charger regulators  106  and  108 , respectively. In a preferred embodiment the batteries are sealed gel deep cycle storage batteries suitable for solar applications. 
         [0023]    Batteries  110  and  112  are connected to dedicated machine  114  which will be further described. Dedicated machine  114  directly powers chemical pump  118 . Chemical pump  118  distributes chemicals from tank  116  to pump jack  120 , at the well head. 
         [0024]    Referring then to  FIG. 2  dedicated machine  102  further includes microcontroller board  202  connected to or integrated with a sensing control board  204 . The sensing control board is connected to relay  206  and relay  208 . Relay  206  is connected to battery  104 . Similarly, relay  208  is connected to battery  110 . The relays are connected to the chemical pump  118  and, when activated, distribute electrical power from the batteries to the chemical pump. The microcontroller board is also connected to a communications board  210 . The communications board that is periodically connected to cell phone  212  through a cellular network (not shown). 
         [0025]    Referring then to  FIGS. 3A-3D , the schematic of microcontroller board  202  will be described. The microcontroller board includes two separate processors, processor  302  and processor  304 . Processor  304  is used to receive and store programming instructions from USB port  305  as will be further described. The programming instructions are passed to processor  302  through jumpers between Port B of processor  304  and Port B of processor  302 , where they are stored in Flash memory. Processor  302  receives analog input related to battery voltages through Port C at inputs AD 0  through AD 5  located at pins  23  through  28 . Processor  302  communicates output voltages through Port D labeled IO 0  through IO 7  located at pins  2 ,  3 ,  4 ,  5 ,  6 ,  11 ,  12 , and  13 . 
         [0026]    In the preferred embodiment, processor  302  is Atmega328p-pu microcontroller available from Atmel Corporation, San Jose, Calif. Processor  304  is the Atmega16u2-um(r) microcontroller also available from Atmel Corporation. In another preferred embodiment, both processors are available in an integrated package, Arduino 3 available from Adafruit Industries of New York, N.Y. (or other supplier). 
         [0027]    Referring then to  FIGS. 4A-4C , the sensing control board will be further described. Sensing control board  204  is connected to the microcontroller board via connectors J 1  and J 2 . Connector J 1  provides VCC, RESET, GROUND and VIN signals. Connector J 2  provides access to the analog Port D through pins  1  through  6  labeled AD 0  through AD 5 . VIN voltage signal supplies the microcontroller and sensor board with power. 
         [0028]    Input/output is provided through connectors IOL and IOH labeled IO 0  through IO 7  and IO 8  through IO 13 , respectively. AREF is the analog reference pin for the Analog-to-Digital converter (ADC) of the microcontroller. 
         [0029]    Connector J 4  is connected to relay  206  at pin  1  and relay  208  at pin  4 . Pin  3  of the connector is attached to ground. Pin  2  of the connector is attached to control voltage VIN 2  and is used to power the relays ON and OFF. Pin  1  is also connected to the collector of Q 5  and the collector of Q 6 . The emitter of Q 5  and Q 6  both are tied together and then to ground. The collector of Q 5  and Q 6  are also tied to the control voltage VIN 2  through voltage control resistors R 13  and R 17 , respectively. The base of Q 5  is tied to IO 4  through voltage control resistor R 12 . The base of Q 6  is tied to IO 5  through voltage control resistor R 18 . VIN 2  voltage signal supplies the relays and relay control circuits with power directly from the batteries, thereby isolating the relay circuits from the microprocessor control board power circuit. 
         [0030]    When IO 4  goes high, Q 5  is activated bringing pin  4  of J 4  low. When pin J 4  goes low, relay  1  is activated and battery  110  is connected to the load. When  104  goes low, Q 4  is deactivated bringing pin  4  of J 4  to control voltage VIN 2 . When pin  4  is at control voltage VIN 2 , relay  1  is deactivated thereby disconnecting the battery from the load. 
         [0031]    Similarly, when IO 5  is high, Q 6  is activated, bringing pin  1  to ground. When pin  1  is at ground, relay  2  is activated, thereby connecting battery  112  to the load. When IO 5  is low, Q 6  is deactivated bringing pin  1  of J 4  to control voltage VIN 2 . When pin  1  is at VIN 2 , relay  2  is deactivated and battery  112  is disconnected from the load. 
         [0032]    Connector  3  is attached to the battery and to ground. Pin  1  of connector  3  is connected to the positive side of battery  112 . Pin  2  of connector  3  is attached to ground. Pin  3  of connector  3  is connected to ground. Pin  4  of J 3  is connected to the positive terminal battery  110 . Both negative terminals of battery  112  and battery  110  are connected to ground. 
         [0033]    Pin  1  of J 3  is also connected through diode D 2  to one terminal of single pole single throw switch U 2 . Pin  1  of J 3  is also connected to the emitter of transistor Q 8 . The collector of transistor Q 8  is connected to the voltage divider made up of R 15  and R 11 . At the midpoint of the voltage divider comprised of R 15  and R 11 , a connection is made to analog input AD 1 . AD 1  is tied to a stabilizing network comprised of R 11  and C 2  through diode D 7  to supply voltage VCC. The base of Q 8  is also tied through voltage control resistor R 6  to the collector of Q 2 . The emitter of Q 2  is tied to ground. The collector of Q 2  is tied through voltage control resistor R 2  to control voltage VIN 2 . 
         [0034]    In a similar way, pin  4  of J 3  is also connected through diode D 1  to one terminal of single pole single throw switch U 2 . Pin  4  is also tied to the emitter side of Q 7 . The base of Q 7  is connected through voltage control resistor R 5  to the collector Q 1 . The emitter of Q 1  is tied to ground. The collector of Q 7  is connected to one side of the voltage divider comprised of resistors R 14  and R 10 . At the midpoint of the voltage divider a connection is made to analog input AD 0 . AD 0  is connected through a stabilizing network comprised of resistor R 10 , diode D 6 , and capacitor C 1  through diode D 5  to supply voltage VCC. 
         [0035]    The second terminal of single pole single throw switch U 2  is connected through voltage control resistor R 1  to the base of Q 2 . In the same way, the second terminal of single pole single throw switch U 2  is connected through voltage control resistor R 2  to the base of Q 2 . The second terminal is also connected to the control voltage VIN 2 . The second terminal is also connected to the collectors of Q 3  and Q 4 . The emitter of Q 4  is tied through voltage control resistor R 9  to power voltage VIN. The emitter of Q 4  is tied through voltage control resistor R 8  also to control voltage Vin. The bases of Q 3  and Q 4  are tied to stabilizing diodes D 3  and D 4  and stabilizing Zener diode D 9  to ground. 
         [0036]    In a similar way, the collectors of Q 3  and Q 4  are connected to stabilizing network comprised of R 16 , R 19 , D 1 , D 11 , and C 3 . R 16  and R 19  form a voltage divider. At the midpoint of this voltage divider, a signal is drawn and connected to IO 6 . IO 6  and IO 7  are the inputs for the analog comparator module of the processor. IO 7  is connected to the 3.3V reference voltage pin. IO 6  is R 19 /(R 16 +R 19 ) of the battery voltage and under normal operation will be lower than the 3.3V IO 7  reference voltage. In case of charge controller failure, the IO 6  voltage will be higher than IO 6  triggering the analog reference interrupt on the processor. 
         [0037]    Connector J 5  is joined at pin  1  to supply voltage VCC. At pin  3 , the connector is attached to GROUND. At pin  2 , the connector is joined to color RGBLED U 1 . The control signals for red are connected through resistor R 20  to IO 8 , for blue through resistor  21  to IO 10 , and for green through R 22  to IO 9 . This jumper allows the choice of the color RGBLED to be common cathode or common anode variety. 
         [0038]    Push-button spring loaded switch U 3  is connected at one terminal to ground and at the other to IO 2 . The switch is used to initiate a signal interrupt which activates the function of the color RGBLED U 1 . 
         [0039]    In operation, switch U 2  is used as an “ON-OFF” switch which activates sensing control board  204 , microcontroller board  202  and communications board  206 . When the switch is in the “OFF” position, terminal  1  is connected to the high side of both battery  110  and battery  112  through jumper J 3 . Isolation diodes D 1  and D 2  prevent a short circuit. The collector of both Q 1  and Q 2  are both effectively low due to the isolation effect of diodes of D 3  and D 4 . As a result, the base of Q 7  and Q 8  are drawn high through voltage control resistors R 3  and R 4 . In this state, both Q 7  and Q 8  do not conduct and the outputs AD 0  and AD 1  are effectively low or float. In the same way, IO 6  is drawn low through R 19  to ground. 
         [0040]    When U 2  is closed, current moves through isolation diodes D 1  and D 2  through resistors R 1  and R 2  to the bases of Q 1  and Q 2 . Both transistors are energized thereby setting the bases of Q 7  and Q 8  to ground. When set to ground, Q 7  and Q 8  conduct and voltages AD 0  and AD 1  reflect the voltages of battery  110  and battery  112 , respectively. In a similar way, the voltage divider comprised of R 16  and R 19  is energized and IO 6  drawn high. When U 2  is closed, the positive sides of battery  112  and battery  110  also energize the bases of Q 3  and Q 4  through voltage control resistor R 7 . Current flow from the collectors of Q 3  and Q 4  to VIN thereby energizes the system. 
         [0041]    Referring then to  FIG. 5 , the communication board will be described. Communication board  210  includes a power management unit  502  connected to a radio frequency controller  504 . The radio frequency controller is connected to bus  506 . The radio frequency controller is also connected to GSM module  508  for global system and mobile communications. Radio frequency controller  504  is also connected to a Bluetooth module  510 . Power management unit  502  is directly connected to and powers analog baseband module  512  and digital baseband module  514 . Both analog baseband  512  and digital baseband module  514  are connected to bus  506 . 
         [0042]    The power management module is also connected to power supply  516 . The power management module is also connected to real time communications unit  518  which enables exchange of multimedia and audio content in real time. GPS receiver  520  is also connected to bus  506 . Analog interface  522  includes audio interface  524  and Analog to Digital (“SIM”) converter  526 . 
         [0043]    Digital interface  528  includes an interface for a subscriber identity module  530 , a universal asynchronous receiver/transmitter  532 , a keypad  534 , an ion window manager  536 , inter-integrated circuit (I2C computer bus)  538 , a pulse code modulation decoder for representing sampled analog signals  540 , and a universal serial bus  542 . 
         [0044]    In a preferred embodiment, the communication board is the Adafruit 808 GSM+GPS Shield based on the SIM800/SIM900 module. The 808 GSM+GPS Shield board is available from Adafruit Industries. 
         [0045]    Referring then to  FIG. 6A  the functions of a preferred embodiment will be described. At step  602 , the system is initialized by activating the program code which is resident in flash memory. The code sets variables and initializes the processors as will be further described. Custom programming of the system can be accomplished at this step by changing certain variables which will change system operation. One example is changing the battery voltage level definitions as shown in relation to  FIG. 8B , as will be further described. Another example is changing the system modes as shown in  FIGS. 8N-8O , as will be further described. If changes are made, the code is downloaded to the processor at this step. In this embodiment, the code is written in C. Of course, other languages will suffice. 
         [0046]    At step  603 , the microprocessor continuously monitors IO 6  for an over voltage condition. If at any time, an over voltage condition is detected, then an over voltage detection interrupt is indicated and the system performs steps  604 - 610  and disconnects the appropriate battery path (battery  1  or  2 ) with the overvoltage condition. Under normal operation conditions, the system executes step  604 . 
         [0047]    At step  604 , the microprocessor reads the battery levels indicated by AD 0  and AD 1 . A reference table similar to Table 1, is consulted which indexes battery voltages for battery  110  and battery  112  against a battery charge level or status. Table 1 shows a preferred embodiment of values for the voltage thresholds to determine battery charge and status. 
         [0000]    
       
         
               
               
               
               
             
               
               
               
               
             
               
               
               
               
             
           
               
                   
                 TABLE 1 
               
             
             
               
                   
                   
               
               
                   
                 Battery 
                 Voltage Range (V) 
                   
               
             
          
           
               
                   
                 Charge/Status 
                 Low 
                 High 
               
               
                   
                   
               
             
          
           
               
                   
                 VHIGH 
                 16.00 
                 20.00 
               
               
                   
                 VCHARGING 
                 12.75 
                 15.99 
               
               
                   
                 V100 
                 12.50 
                 12.74 
               
               
                   
                 V75 
                 12.16 
                 12.49 
               
               
                   
                 V50 
                 11.86 
                 12.15 
               
               
                   
                 V25 
                 11.62 
                 11.85 
               
               
                   
                 V0 
                 11.5 
                 11.61 
               
               
                   
                 VFAIL 
                 2.00 
                 11.49 
               
               
                   
                 VGND 
                 0.00 
                 1.99 
               
               
                   
                   
               
             
          
         
       
     
         [0048]    The thresholds can be changed by the operator and programmed into the system based on the application. 
         [0049]    Table 2 shows another preferred embodiment of values for voltage thresholds to determine battery charge and status. 
         [0000]    
       
         
               
               
               
               
             
               
               
               
               
             
               
               
               
               
             
           
               
                   
                 TABLE 2 
               
             
             
               
                   
                   
               
               
                   
                 Battery 
                 Voltage Range (V) 
                   
               
             
          
           
               
                   
                 Charge/Status 
                 Low 
                 High 
               
               
                   
                   
               
             
          
           
               
                   
                 VHIGH 
                 16.00 
                 20.00 
               
               
                   
                 VCHARGING 
                 12.75 
                 15.99 
               
               
                   
                 V100 
                 12.50 
                 12.74 
               
               
                   
                 V75 
                 12.25 
                 12.49 
               
               
                   
                 V50 
                 12.00 
                 12.24 
               
               
                   
                 V25 
                 11.75 
                 11.99 
               
               
                   
                 V0 
                 11.5 
                 11.74 
               
               
                   
                 VFAIL 
                 2.00 
                 11.49 
               
               
                   
                 VGND 
                 0.00 
                 1.99 
               
               
                   
                   
               
             
          
         
       
     
         [0050]    At step  606 , the system updates the system mode by indexing the battery voltage status for all batteries in the system, against another reference table (similar to  FIG. 7A  or  FIG. 7B ) to determine a system “mode”, as will be further described. The system then moves to step  608 . 
         [0051]    At step  608 , the microprocessor sends appropriate signals to IO 4  and IO 5 , thereby setting relays  206  and  208  to connect either battery  110 , battery  112 , or both to the load. At step  609 , the system loads the mode of the system into the communications board and instructs it to send the mode to the operator in a SMS format, if system mode has changed or the periodic communication time has been reached. Of course, other formats are possible in other embodiments. The system then moves to step  610 . At step  610 , the microprocessor delays all activity for a predetermined period of time. After the predetermined period of time, the system returns to step  604 . The system loops through the flowchart in  FIG. 6A  periodically and continuously unless stimulated by an overvoltage or communication interrupt. 
         [0052]    Referring to  FIG. 6B  a status request interrupt,  650  is described. At step  652 , the microprocessor receives an interrupt request to display status, triggered by spring-loaded push-button switch U 3  pressed by the operator. The system then moves to step  654 . At step  654 , the system generates a status code as shown in Table 3. 
         [0000]    
       
         
               
             
               
               
               
             
           
               
                 TABLE 3 
               
             
             
               
                   
               
               
                 BATTERY LEVELS 
               
             
          
           
               
                   
                 ← BAT 1 
                 BAT 2 → 
               
               
                   
                 1 FLASH 
                 2 FLASHES 
               
               
                   
                   
               
               
                   
                 UNKNOWN 
                 BLANK 
               
               
                   
                 REG FAIL 
                 RED 
               
               
                   
                 CHARGING 
                 WHITE 
               
               
                   
                 HIGH 
                 GREEN 
               
               
                   
                 MEDIUM 
                 YELLOW 
               
               
                   
                 LOW 
                 RED 
               
               
                   
                 BAT FAIL 
                 CYAN 
               
               
                   
                 NO BAT 
                 BLUE 
               
               
                   
                   
               
             
          
         
       
     
         [0053]    In a preferred embodiment, the system indicates the status of battery  110  by a single white flash followed by a single color LED flash indicating charge level or status and battery  112  by two white flashes followed by a single color LED flash indicating charge level or status. For each battery, if the charge level is low, a red signal is sent. If the battery is charging, a white signal is sent. If the battery charge level is high, a green signal is sent. If the battery charge condition is medium, a yellow signal is sent. If the battery charge regulator has failed indicating abnormally high voltage, a red signal is sent. If a battery has failed, a cyan signal is sent, and if no battery is present, a blue signal is sent. 
         [0054]    Referring then to  FIG. 6C  a flowchart for a preferred embodiment of system communications will be described. The smart switch can be equipped with a cellular communication module daughterboard for remote communication and control capability. Communication with the remote operator can be via SMS/text messages that include system status messages and alerts. The cellular communication module will be used either in continuous mode or hibernation mode to communicate with the remote operator. In the continuous mode it will allow incoming communication and connectivity to the switch, allowing the remote operator to monitor status and control the switch via a remote request or user interface. In the hibernation mode, the cellular communication module will be powered up either (a) periodically (period set by user) or (b) upon critical system mode change (such as low battery or battery failure), to send system status messages and alerts to the remote operator. The hibernation mode will be normally used due to power consumption considerations. In continuous communications mode, the system monitors for an interrupt signal from the communication board. If an interrupt is detected then a function is performed to initiate SMS communication with the operator as will be further described. 
         [0055]    At step  677 , the system waits for a system communication interrupt if it is in continuous communications mode only. Under the default hibernation mode the system goes periodically to step  679  directly, and checks whether the conditions to send a message to the operator have been met. The conditions that need to be met are either (a) system mode has changed or (b) periodic time for communication has been reached or (c) remote request text has been buffered while the system was offline. At step  681 , if either step  677  or step  679  indicate that a message needs to be communicated to the remote operator, the system creates the status message to be sent via SMS text. At step  683 , the system retrieves the phone number of the operator to which the text message is to be sent. 
         [0056]    At step  685 , the system activates the communications board which has been asleep, if the system communication board has been in hibernation mode. At step  687 , the system loads the system status into a SMS packet. The communications board sends the text message including the packet showing the system status details including battery voltages. 
         [0057]    At step  691 , the system returns from the handle communications routine. 
         [0058]    Referring then to  FIG. 7A , the system mode table will be described. The system mode table comprises six codes which are generated depending on a matrix of battery voltages. Table 4, below describes the system mode definitions. 
         [0000]    
       
         
               
             
               
               
             
           
               
                 TABLE 4 
               
               
                   
               
               
                 System Mode Definitions 
               
               
                   
               
             
             
               
                   
               
             
          
           
               
                   
                 E0 - only battery 1 supplying power 
               
               
                   
                 E1 - only battery 2 supplying power 
               
               
                   
                 E2 - no power - no battery voltages 
               
               
                   
                 M1 - normal mode switching periodically 
               
               
                   
                 M2 - switching based on battery levels 
               
               
                   
                 M3 - both batteries supplying power 
               
               
                   
                   
               
             
          
         
       
     
         [0059]    Table 3 shows that in mode E0 battery  110  alone is supplying power to the system. In mode E1 battery  112  alone is supplying power to the system. In mode E2 both batteries are not in service and no power is supplied to the system. In mode M1, considered “normal mode” the system toggles between battery  110  supplying power and battery  112  supplying power after the sleep cycle. In mode M2 the system switches between battery  110  and battery  112  so that the battery with the highest voltage level is connected to the system. In mode M3 both battery  110  and battery  112  are connected to the system and supply power to it. 
         [0060]    As indicated earlier, voltage threshold settings (boundary voltage levels to determine battery charge or status) can vary based on operator or customer input for specific applications. Battery status is set to one of the charge or status modes indicated in Table 1. A system mode is set based on the mapping of the battery modes into a system mode table. For each set of battery modes a system mode can be and is assigned. Two embodiments of such assignment tables are shown in  FIG. 7A  and  FIG. 7B , respectively. It can be seen from  FIG. 7A  that the system mode is set to E0 when battery  110  charge/status is V0, V25, V50, V75, V100 or VCHARGING AND battery  112  charge/status is VGND, VFAIL or VHIGH. Mode E1 is set where battery  110  charge/status is VGND, VFAIL or VHIGH and battery  112  charge/status is V0, V25, V50, V75, V100 or VCHARGING. Mode E2 is set when battery  110  charge/status is VGND, VFAIL or VHIGH AND battery  112  charge/status is also VGND, VFAIL or VHIGH. 
         [0061]    Referring further to  FIG. 7A , system mode is set to M1 when battery  110  charge/status is V0, V25, V50, V75, V100 or VCHARGING and battery  112  charge/status is V75, V100 or VCHARGING. System mode is also set to M1 when battery  110  charge/status is V75, V100 or VCHARGING and battery  112  charge/status is V0, V25, V50, V75, V100 or VCHARGING. The system mode M2 is set where battery  110  charge/status is V0, V25, or V50 AND battery  112  charge/status is V0, V25, or V50. 
         [0062]    Referring to  FIG. 7B , the system mode is set to E0 when battery  110  charge/status is V0, V25, V50, V75, V100 or VCHARGING and battery  112  charge/status is VGND, VFAIL or VHIGH. Mode E1 is set where battery  110  charge/status is VGND, VFAIL or VHIGH AND battery  112  charge/status is V0, V25, V50, V75, V100 or VCHARGING. Mode E2 is set when battery  110  charge/status is VGND, VFAIL or VHIGH AND battery  112  charge/status is also VGND, VFAIL or VHIGH. 
         [0063]    Referring further to  FIG. 7B , system mode is set to M1 when battery  110  charge/status is V0, V25, V50, V75, V100 or VCHARGING and battery  112  charge/status is V75, V100 or VCHARGING. System mode is also set to M1 when battery  110  charge/status is V75, V100 or VCHARGING and battery  112  charge/status is V0, V25, V50, V75, V100 or VCHARGING. The system mode M2 is set where battery  110  charge/status is V50 AND battery  112  charge/status is V0, V25, or V50. The system mode M2 is also set where battery  110  charge/status is V0, V25, or V50 AND battery  112  charge/status is V50. System mode M3 is set when battery  110  charge/status is V0 or V25 AND battery  112  charge/status is V0 or V25. 
         [0064]    All voltages are sensed within a tolerance of about 0.2 volts without a precision voltage reference input and should be anticipated to be about the voltage specified. A precision voltage reference with 0.01% accuracy can be alternatively used to enhance accuracy. 
         [0065]    Referring then to  FIGS. 8A-8V , a preferred example of programing code, written in C, for controlling the microcontroller and the system is described. 
         [0066]    Code section  802  loads libraries that contain functions to be executed by the processor. The processor libraries are available at https://github.com/leomil72/analogComp and https://github.com/n0m1/Sleep_n0m1. Code section  802  also loads libraries that contain functions to be executed by the communications board. The Adafruit libraries are available at https://github.com/adafruit/Adafruit_FONA. 
         [0067]    Code section  804  defines variables and parameter definitions to be used by the program. 
         [0068]    Code section  806  defines the setup function which runs during system initialization. This section invokes several libraries of the microcontroller to test system functions. The libraries are located at https://www.arduino.cc/en/Reference/Libraries. 
         [0069]    During section  806 , the data rate is set for the communications board and the SIM card IEMI number is located and retrieved. During section  806 , the sleep time variable is set and the relays are tested. Initial battery levels are set. Scaling factors for the analog input are set. Voltage divider ratios are set. Initial relay variables are set. Initial mode of the system is set. The system then enables interrupts, tests the battery levels, and updates the battery mode and system mode. The system then defines the colors of the LED to be displayed during various system status interrupt responses. 
         [0070]    The fona.getIMEI function retrieves the SIM card number from the communication board. The serial.begin function sets the data rate in bits per second per a serial data transmission. The interrupt for the digital pin is attached to a specific interrupt service routine. The pinmode function configures the specified pins of the microprocessor to behave either as an input or an output. Interrupts are enabled after system setup is complete. The delay function suspends the program for 100 clock cycles. The digital color LED is cycled through the specified status colors for a specified number of clock cycles indicating the conclusion of the startup sequence. The analogcomparator function is enabled with AIN 0  and AIN 1  as inputs. The analogcomparator.enable interrupt function is attached and to enable execution when a difference occurs between the voltages at pins AIN 0  and AIN 1 . 
         [0071]    In section  808 , the system enters a repetitive loop to monitor communications, measure the battery levels, update the system mode, and set the relays on a continuous basis. The program then enters power savings mode while monitoring for any interrupts that may occur. 
         [0072]    The digitalread function reads the value from a specified microprocessor pin, either low or high to determine if the system is in DEBUG mode. The handle communications function is also called to send any text messages if necessary conditions have been met. The sleep.ADCmode function sets the microprocessor into an idle sleep mode thereby saving power. The function stops the MCU but leaves the peripherals and timer running. The sleep.sleepDelay function sets the number of clock cycles during which the power setting mode is active. 
         [0073]    At section  810 , a function is provided to measure the battery  110  and battery  112  voltage levels. In this section, the microprocessor reads A0 and A1, averaged over four readings to reduce noise and applies a scale factor before exiting. 
         [0074]    The analogread function obtains the analog voltage value at the specified pin. 
         [0075]    At section  812 , a function is provided which compares the battery levels to determine battery charge/status. 
         [0076]    At section  814 , the system mode is updated to implement the tables showed in either  FIG. 7A  or  FIG. 7B . 
         [0077]    At section  816 , the program sets the relays according to the system mode provided in the tables. The digitalwrite function sets the value at a specified microprocessor pin to either high or low. In mode Ml the system toggles the battery supplying power to the pump controller after the sleep delay. If there are two batteries and one battery is currently supplying power, the system will switch to the other battery allowing the first battery to be charged for the ensuing delay period. The process is repeated as long as the system is in mode M1. 
         [0078]    At section  818 , the LED is set to indicate the battery status for batteries  110  and  112  according to Table 1 and Table 2. 
         [0079]    At section  820 , the processor is instructed to set the red, green, and blue LED pins to implement the mode defined in section  818 . 
         [0080]    At section  822 , a function is provided which sets the flag indicating that the operator has requested status indicator display using the interrupt mechanism. 
         [0081]    At section  824 , a function is provided which services the analog interrupt which occurs when one of the two batteries is in over voltage condition. 
         [0082]    At section  826 , the handlecommunications function is defined. The handlecommunications function loads a value for the battery levels of battery  110  and battery  112  into the reply buffer variable. The function also defines two cases, COMMCONTINUOUS and COMMHIBERNATE. During a COMMCONTINOUS case the function checks to see if a SMS message has been received, and if so, it responds. The function also monitors the modes of the system, and if a system error occurs, sends a SMS message to the operator. In the default case COMMHIBERNATE, the function powers up the communications board only if a problem arises. Once powered up, the board is instructed to send a SMS message located in the reply buffer variable. The function then powers down the communications board to save power. 
         [0083]    The fona.powerstatus function returns true if the communications board is powered up and functioning. The fona.powerup function turns on the communication board. The fona.available returns true if data is present in the communications board incoming memory. The fona.read function returns the data in the communication board memory. The fona.getSMSSender function which returns a designated number of characters from the communications board which define the SMS sender address and phone number. The fona.sendSMS sends the content of a variable to a designated phone number in SMS format. The fona.deleteSMS function clears SMS messages from incoming slots. The fona.powerdownfunction turns off the communications board. 
         [0084]    Referring then to  FIGS. 9A-9G , the program listing of the analog cop analogComp.cpp file is shown. The functions are described in the remarks in the Figure. 
         [0085]    Referring then to  FIGS. 9H-9J , the program list of the analogComp_h and shows a library file referenced by the analog cob function. The functions are described in the remarks in the Figure. 
         [0086]    Referring then to  FIGS. 9K-9Q , the Sleep_n0m1.cpp file is shown. The functions are described in the remarks in the Figure. 
         [0087]    Referring then to  FIGS. 9R-9U , the Sleep_n0m1.h libraries are defined. The functions are described in the remarks in the Figure. 
         [0088]    It will be appreciated by those skilled in the art that the described embodiments disclose significantly more than an abstract idea including technical advancements in the field of data processing and a transformation of data which is directly related to real world objects and situations in that the disclosed embodiments enable a computer to operate more efficiently. For example, the disclosed embodiments transform positions, orientations, and movements of durable plant tags as well as transforming one or more servers and hand held devices from one state to another state. 
         [0089]    It will be appreciated by those skilled in the art that modifications can be made to the embodiments disclosed and remain within the inventive concept. Therefore, this invention is not limited to the specific embodiments disclosed, but is intended to cover changes within the scope and spirit of the claims.