PS200/CH200 12 V Charging Regulators Revision: 8/13 C o p y r i g h t © 2 0 0 0 - 2 0 1 3 C a m p b e l l S c i e n t i f i c , I n c .
Warranty “PRODUCTS MANUFACTURED BY CAMPBELL SCIENTIFIC, INC. are warranted by Campbell Scientific, Inc. (“Campbell”) to be free from defects in materials and workmanship under normal use and service for twelve (12) months from date of shipment unless otherwise specified in the corresponding Campbell pricelist or product manual. Products not manufactured, but that are re-sold by Campbell, are warranted only to the limits extended by the original manufacturer.
Assistance Products may not be returned without prior authorization. The following contact information is for US and international customers residing in countries served by Campbell Scientific, Inc. directly. Affiliate companies handle repairs for customers within their territories. Please visit www.campbellsci.com to determine which Campbell Scientific company serves your country. To obtain a Returned Materials Authorization (RMA), contact CAMPBELL SCIENTIFIC, INC., phone (435) 227-9000.
Table of Contents PDF viewers: These page numbers refer to the printed version of this document. Use the PDF reader bookmarks tab for links to specific sections. 1. Introduction .................................................................1 2. Precautions and Tips..................................................2 3. Quick Start...................................................................3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 Connecting Power ..............................................................
Table of Contents 6.3 RS-232 Interface................................................................................ 39 6.3.1 Text Based Interface................................................................... 39 6.3.2 RS-232 Communications with a Campbell Scientific Datalogger .............................................................................. 42 6.3.3 RS-232 Host (Datalogger) Command Strings and PS200/ CH200 Response Strings ........................................................ 44 6.
Table of Contents Station Power Usage ..................................................................... A-31 A.5.1 Station Power Usage SDI12 Programming Example............. A-31 A.5.2 Station Power Usage RS-232 Programming Example ........... A-33 A.6 Changing the SDI-12 Address Programming Example................. A-37 A.5 Figures 3-1. 3-2. 3-3. 3-4. 3-5. 3-6. 3-7. 3-8. 4-1. 5-1. 6-1. 6-2. 6-3. 6-4. 6-5. 6-6. 6-7. 7-1. 7-2. 8-1. 8-2. 9-1. The PS200 connected to a CR1000 and AC power.................
Table of Contents iv
PS200/CH200 12 V Charging Regulators 1. Introduction The PS200 is a 12 volt power supply that includes a rechargeable 7 amp hour valve-regulated lead-acid (VRLA) battery and charging regulator. The CH200 is a charging regulator for an external rechargeable 12 V VRLA battery such as the BP12 or BP24 offered by Campbell Scientific, Inc. Charging power for these charging regulators is typically supplied by an unregulated solar panel, AC/AC transformer, or AC/DC converter.
PS200/CH200 12 V Charging Regulators 2. Precautions and Tips Under normal charging conditions with sealed VRLA batteries, hydrogen and oxygen gasses are produced in relatively small quantities, most of which later recombines back into water. Aggressive overcharging produces excess hydrogen and oxygen gasses, resulting in gas venting by means of a pressure activated valve. Hydrogen gas emitted from VRLA batteries must not be allowed to accumulate, as it could form an explosive mixture.
PS200/CH200 12 V Charging Regulators CAUTION Leaving a lead-acid battery in a discharged state for prolonged periods of time results in the undesirable growth of large sulfate crystals (sulfation) that are detrimental to battery performance. VRLA batteries self-discharge at approximately 3% of rated capacity per month at room temperature1. A 3% of rated capacity per month self-discharge results in 100% discharge in approximately 33 months (≈ 3 years) for a battery stored at room temperature.
PS200/CH200 12 V Charging Regulators FIGURE 3-1. The PS200 connected to a CR1000 and AC power FIGURE 3-2.
PS200/CH200 12 V Charging Regulators FIGURE 3-3. CH200 connected to BP24 battery pack and CR1000 3.1 Connecting Power WARNING Although the power supply and battery are low voltage, they do have the ability to supply a high current and could potentially heat up a metal ring, watch band, or bracelet enough to burn skin or melt metal when shorted. Remove rings, watches, or bracelets before hooking up power and connecting a battery.
PS200/CH200 12 V Charging Regulators 3.1.1 Solar Panel WARNING To prevent sparking while wiring up the solar panel, either lay the solar panel face down on its packing box or cover it with something fairly opaque to block the sunlight while wiring up the panel. Connect the BLACK (negative) lead from the solar panel to the terminal block marked “G” that is directly adjacent to the “SOLAR” terminal block. Connect the RED (positive) lead from an unregulated solar panel to the terminal block marked “SOLAR”.
PS200/CH200 12 V Charging Regulators FIGURE 3-5. AC power connections on PS200 3.2 Plug In the Battery The battery used with the PS200 is shipped inside of the PS200 case if the power supply is NOT installed inside an enclosure. If the PS200 is mounted inside an enclosure then the battery will be located separately packed in one of the packing boxes. This is done to minimize any damage that could occur if the power supply should get loose from its mounts inside the enclosure during shipment.
PS200/CH200 12 V Charging Regulators Latch Lift latch up. FIGURE 3-6. Lift latch up on PS200 Slide lid off. FIGURE 3-7. Slide PS200 lid off Plug the battery into the connector marked “BATT”. This connector is polarized and will only allow the mating connector to be plugged in one way. Push the connector all the way in until it locks in place.
PS200/CH200 12 V Charging Regulators FIGURE 3-8. Wiring harness plugged into battery connector NOTE 3.3 When connecting the battery the “CHG” LED will briefly flash red and then go out. Hook Up Power to Datalogger Both the PS200 and the CH200 come with a 1 foot black wire attached to one of the G terminal blocks and a 1 foot red wire attached to one of the 12V terminal blocks.
PS200/CH200 12 V Charging Regulators 3.5 Turn On the Charging Source Turn on the power going to the charging source or uncover the solar panel. The “CHG” LED should flash green approximately every 4 to 5 seconds if all incoming connections are correct and there is an adequate charging voltage present. 3.6 Turn On Power to the Datalogger Flip the switch on the PS200/CH200 supply to “On”.
PS200/CH200 12 V Charging Regulators 4. Specifications 4.1 Specifications (CHARGE - CHARGE terminals) AC or DC Source: AC – (18 to 24) VRMS with 1.2 ARMS maximum DC – (16 to 40) VDC with 1.1 A DC maximum (SOLAR terminals) Solar Panel or Other DC Source1: 15 to 40 VDC Maximum Charging Current: 3.6 ADC typical 2.8 ADC to 4.
PS200/CH200 12 V Charging Regulators Physical Specifications PS200: 10.6 cm (4.2 in) tall, 19.3 cm (7.5 in) long, 7.6 cm (3 in) wide CH200: 10.0 cm (3.9 in) tall, 7.5 cm (3 in) long, 3.7 cm (1.5 in) wide 1. Battery voltages below 8.7 V may result in < 3.0 A current limit because of foldback current limit. 2. Cycle and Float charging voltage parameters are programmable with the default values listed. 3.
PS200/CH200 12 V Charging Regulators 4.3 Charging Sources Campbell Scientific Solar Panels SP10 SP20 SP50 SP90 Peak Power 10 W 20 W 50 W 90 W Voltage @ Peak Power 16.8 V 16.8 V 17.5 V 17.8 V Current @ Peak Power 0.59 A 1.19 A 3.9 A 4.8 A Notes: 1. Specifications assume a 1 kilowatt per square meter illumination and a solar panel temperature of 25°C (77°F). 2. Individual panels may vary up to 10%. 3.
PS200/CH200 12 V Charging Regulators NOTE Output Current: 3.8A (–25°C to +70°C) Protection: 3.15A internal slow-blow fuse UL Approval: UL/C-UL listed UL 508. UL/C-UL Listed 1604 Class I, Division 2, Groups A, B, C, D Both of the recommended chargers have dc voltage output which can be used on either the CHARGE/CHARGE or SOLAR/G terminal blocks. Maximum input charging current on the CHARGE/CHARGE terminal blocks is limited to 1.1 Adc.
PS200/CH200 12 V Charging Regulators 4.5 Communication Cable Interface Connector Pin-Out The communication connector has four pins. The following drawing shows the connector pin-out as viewed looking at the connector. FIGURE 4-1. Communication connector pin-out 5. Operational Overview A simplified schematic of the CH/PS200 charging regulator is illustrated in FIGURE 5-1.
PS200/CH200 12 V Charging Regulators FIGURE 5-1. PS200/CH200 schematic Charging power for the PS200/CH200 is typically supplied by an unregulated solar panel, AC/AC transformer, or AC/DC converter. As illustrated in FIGURE 4-1, the CHARGE – CHARGE terminals are connected to a diode bridge, accommodating either AC or DC voltages from a charge source. Because of the diode bridge, polarity does not matter when connecting sources to the CHARGE – CHARGE input terminals.
PS200/CH200 12 V Charging Regulators An AC/DC converter charge source could be connected to either the CHARGE – CHARGE input terminals or the SOLAR - G input terminals. The best input terminals to use with a given AC/DC converter should be based on the converters output current capability. For example, the CHARGE – CHARGE input terminals provide a user programmable current limit, with a maximum limit of 2.0 A DC for the charging source. Whereas the SOLAR - G input terminals have a fixed 3.
PS200/CH200 12 V Charging Regulators 6. User Interface Unlike any other power supply that Campbell Scientific has ever built the PS200/CH200 has the unique ability to send a wealth of information back to the user to observe and manage power requirements and possible problems. It can also be configured to work with a wide range of batteries and input power supplies and test the existing battery system for possible shorting and sulfation problems.
PS200/CH200 12 V Charging Regulators other charge control parameters normally not of interest to the user can be viewed. See Section 6.3, RS-232 Interface, for an in-depth explanation. The advantage of SDI-12 over RS-232 is that many sensors can share a single datalogger SDI-12 port, whereas, RS-232 is limited to one device per port. The advantage of RS-232 over SDI-12 is that its speed can be faster than SDI-12. Datalogger programming for SDI-12 is usually simpler than programming for a RS-232 device.
PS200/CH200 12 V Charging Regulators FIGURE 6-1.
PS200/CH200 12 V Charging Regulators 6.1.1 Main DevConfig Screen The DevConfig window is divided into two main sections: the device selection panel on the left side and device-specific tabs on the right side. Click on the PS200/CH200 device name from the list on the left, for which a list of installed RS-232 serial ports (COM1, COM2, etc.) will appear. The PS200/CH200 has a fixed baud rate of 9600. The page for each device presents instructions about how to set up the device to communicate with DevConfig.
PS200/CH200 12 V Charging Regulators When the user clicks on the Connect button, the device type, serial port, and baud rate selector controls become disabled and, if DevConfig is able to connect to the PS200/CH200, the button will change from “Connect” to “Disconnect”. The Display will change to: 6.1.2 Settings Editor Tab Not all settings can be changed. Grayed out fields cannot be changed. To change a setting, select the field to be changed, type in a new value and press Enter.
PS200/CH200 12 V Charging Regulators The bottom of the Settings Editor displays help for the selected setting. The Apply and Cancel button will become active when a setting is changed. An asterisk (*) will also appear next to values that have been changed. Clicking the Factory Defaults button on the Settings Editor will send a command to the PS200/CH200 to revert to its factory default settings (PS200/CH200 factory made calibration values and other “read only” values are not affected).
PS200/CH200 12 V Charging Regulators TABLE 6-1. PS200/CH200 Settings Setting Description Serial Number Displays the PS200/CH200serial number. This setting is set at the factory and cannot be edited. OS Version Displays the PS200/CH200 operating system version. Visit the web site, www.campbellsci.com/downloads , to determine whether a newer operating system is available. OS Date Displays the last revision date of the operating system presently in the PS200/CH200.
PS200/CH200 12 V Charging Regulators TABLE 6-1. PS200/CH200 Settings Battery Family This field displays which battery family type the PS200/CH200 is configured to use. Available battery types are selected using a drop-down menu. See Section 6.1.2.1, Battery Families, for more information. Custom Battery Cycle C0 25ºC Cycle Charge Voltage (V) This field will allow changes made to it when “Custom Battery” is selected for the battery family.
PS200/CH200 12 V Charging Regulators TABLE 6-1. PS200/CH200 Settings Continuous Charge Source Current Limit (A) The maximum amount of current applied to the battery while being float charged. User adjustable for any battery family. Default value is 1.1 Amps. SDI-12 Address Allows the user to set the SDI-12 address of the PS200/CH200. Factory default for this address is 0. Each SDI-12 sensor connected to a port of an SDI-12 recorder (datalogger) should have a unique SDI-12 address. See Section 6.
PS200/CH200 12 V Charging Regulators TABLE 6-1. PS200/CH200 Settings Battery Current Offset. Not user adjustable. Calibration offset for battery current measurement. “Factory Defaults” button does not affect calibration values. Load Current Offset. Not user adjustable. Calibration offset for load current measurement. “Factory Defaults” button does not affect calibration values. Battery Current Multiplier. Not user adjustable. Calibration multiplier for battery current measurement.
PS200/CH200 12 V Charging Regulators FIGURE 6-2. Battery family dropdown menu The PS200 is configured at the factory to work with the EnerSys/Genesis 7 Ah battery algorithm. For a CH200 change the “Battery Family” to match the battery family being used. The CH200 is by default sent from the factory with a battery capacity of zero (0) and a battery family of EnerSys/Genesis NP Series. Setting the battery capacity at zero (0) forces the charger to only float charge the battery.
PS200/CH200 12 V Charging Regulators TABLE 6-2. Battery Specifications Vcharge(T) = C0 + C1(T-25°C) + C2(T-25°C)2, where T = Battery temperature in °C. Note: C2 = 0 for linear charge voltage vs. temperature relation. Cycle C0 @ 25°C (V) Cycle C1 (mV/°C) Cycle C2 (mV/°C)2 Float C0 @ 25°C (V) Float C1 (mV/°C) Float C2 (mV/°C)2 Minimum Voltage (V) 14.70 –24 0 13.65 –18 0 12.5 Cyclon Series 14.70 –24 0.24 13.65 –24 0.24 13.2 Concorde Sun Xtender 14.31 –24 0.24 13.29 –24 0.24 13.
PS200/CH200 12 V Charging Regulators • Each battery family requires a different charging algorithm and there could also be differences from manufacturer to manufacturer of the same style of battery. For example, Campbell Scientific sells VRLA AGM style batteries from two different manufacturers — EnerSys/Genesis (PS200, BP12, and BP24) and Concorde (BP84) — yet both batteries require a different charging algorithm.
PS200/CH200 12 V Charging Regulators 6.1.3 Terminal Tab Click on the “Terminal” tab to invoke the PS200/CH200 terminal interface. Only the SDI12 address can be changed from this window. (Or, Windows Hyper Terminal could be used. See Section 6.3.1, Text Based Interface.) A screen similar to the following should appear: FIGURE 6-4. Device Configuration Utility terminal tab Press ESC (may have to press ESC twice) to invoke the PS200/CH200 RS-232 text based interface.
PS200/CH200 12 V Charging Regulators PS200/CH200 from the list on the left hand side of the Device Configuration Utility. Select the tab at the top marked “Send OS”. Click on the “Start” button at the bottom of the screen. A dialog box marked “Select the operating system to send” should appear. If the operating system was stored on the computer as shown above then navigate to the “C:\Campbellsci\LIB\OperatingSystems” folder. Select the file “CH200.a43” and click on the “Open” button.
PS200/CH200 12 V Charging Regulators Campbell Scientific CR1000 datalogger, for example, has four SDI-12 ports on control ports 1, 3, 5, and 7. Campbell Scientific Item #20769 SDI-12 Cable Wiring (see FIGURE 6-6) Green: Control port used for SDI-12 communication. (CR1000 odd numbered control ports) Black: G Clear: G NOTE All SDI-12 sensors take time to reply back to a request for data. It is recommended to put any SDI-12 instructions in a “slow sequence” to minimize interrupting the main program.
PS200/CH200 12 V Charging Regulators 3. Via SDI-12 according to the SDI-12 standard. Normally Device Configuration Utility (see Section 6.1.2, Settings Editor Tab) or the RS-232 text based interface (see Section 6.1.3, Terminal Tab) is used to change the SDI-12 address of a PS200/CH200. The SDI-12 address is usually set once and then seldom if ever changed again. The SDI-12 address stored in the PS200/CH200 is saved in “nonvolatile” memory and will not be lost by power cycling the device.
PS200/CH200 12 V Charging Regulators The SDI-12 commands “Mx!” with x = 1...6 can be used to select different subsets of the above measurements, as described below: Recorder: M1! Return Battery Voltage, Battery and Load Current. PS200/CH200 measurements: 1 - Battery Voltage (V). 2 – Battery Current (A). 3 – Load Current (A). Recorder: M2! Return Battery Voltage, Battery and Load Current and Temperature. PS200/CH200 measurements: 1 - Battery Voltage (V). 2 – Battery Current (A). 3 – Load Current (A).
PS200/CH200 12 V Charging Regulators See Appendix A.4.1, Zero Out QLoss SDI12 Programming Example, for an example program. Recorder: M7! Available for future use. Recorder: M8! Available for future use. Recorder: M9! Available for future use. Below is a CR1000 programming example that acquires all 9 measurements once per minute from a PS200/CH200.
PS200/CH200 12 V Charging Regulators Dim CheckBatteryArr(2) As String 'Variables to hold the words for charge state, charge source, and check 'battery. Public ChargeState As String Public ChargeSource As String Public CheckBattery As String 'Stored hourly data.
PS200/CH200 12 V Charging Regulators 6.2.3.1 Write Remote Battery Temperature to PS200/CH200 aXTmm.dd! command overrides the internal temperature measurement, where ‘a’ is the PS200/CH200’s SDI-12 address and mm.dd refers to an ASCII string of numerals with a decimal point of temperature in degrees Centigrade within -40 and 100°C. This command overrides the PS200/CH200 internal temperature measurement for 15 minutes or until canceled by a temperature restore command.
PS200/CH200 12 V Charging Regulators 6.2.3.5 Zero Out Qloss (Battery Charge Deficit) aXRQ! Set Qloss to zero, where ‘a’ is the SDI-12 address of the PS200/CH200. Qloss will not automatically set itself back to zero unless it has been trying to cycle charge a battery for eight hours or more. Qloss is a handy way to monitor the charge/discharge characteristics of a system but occasionally it might need to be set back to zero. See Appendix A.4.
PS200/CH200 12 V Charging Regulators Pick a name for the connection, such as “CH200”.
PS200/CH200 12 V Charging Regulators Click on OK, and then set the COM port settings: Click on Apply and then OK, and the terminal screen should open. Click inside the terminal screen and press ESC (may have to press ESC twice). To refresh the charger status screen, press ESC. To change the SDI-12 address of the PS200/CH200, press 1 and then Enter. Also, as shown in Section 6.2.2, SDI-12 Measurements, the PS200/CH200 RS-232 text based interface can be viewed from within Campbell Scientific DevConfig.
PS200/CH200 12 V Charging Regulators 6.3.2 RS-232 Communications with a Campbell Scientific Datalogger The Campbell Scientific CRBasic commands “SerialOut” and “SerialIn” are designed for RS-232 communications in general and can be used with a PS200/CH200 to read battery voltage (V), battery current (A), load current (A), charge input voltage (V), charge input current (A), temperature (°C), charge state, charge source (solar or continuous), and a check battery flag (true or false).
PS200/CH200 12 V Charging Regulators The RS-232 settings are: Bits per second: Data bits: Parity: Stop bits: Flow Control: Green: White: Black: Shield: 9600 8 None 1 None C1 (Tx) C2 (Rx) G G FIGURE 6-7. PS200 connected to a CR1000 via RS-232 The PS200/CH200 will answer via RS-232 when commanded by an RS-232 host. The host initiates communication by sending an ASCII command string (ASCII '>').
PS200/CH200 12 V Charging Regulators 6.3.3 RS-232 Host (Datalogger) Command Strings and PS200/CH200 Response Strings 6.3.3.1 Read Status Host command string: RD_STAT> PS200/CH200 response string: *,nnnn,nnnn,….,cc0 where “nnnn” refers to ASCII character strings that are separated by ASCII commas, “cc” is a two-character CRC nullifier, and 0 is the string terminator.
PS200/CH200 12 V Charging Regulators 6.3.3.3 Restore Internal Battery Temperature Measurement Host command string: RS_INTBT> PS200/CH200 response string: *OKcc0 where “cc” is a two-character CRC nullifier, and 0 is the string terminator. See Appendix A.1.2, Write/Reset Remote Battery Temperature RS-232 Programming Example, for a programming example using this instruction. 6.3.3.4 Change Battery Capacity Value in PS200/CH200 Host command string: WR_BC(xx.
PS200/CH200 12 V Charging Regulators 6.3.3.7 Read Special PS200/CH200 Settings and Variables Host command string: RD_SPECIAL> PS200/CH200 response string: *,nnnn,nnnn,….,cc0 where “nnnn” refers to ASCII character strings that are separated by ASCII commas, “cc” is a two-character CRC nullifier, and 0 is the string terminator.
PS200/CH200 12 V Charging Regulators Below is an example CRBasic program that reads the status information from a PS200/CH200 via RS-232. 'CR1000 Series Datalogger 'Program: RS-232_Status_Info.CR1 'Date: 1.November.2010 'Ver: A ' 'Notes: Program returns all information from PS200/CH200. 'Connect the PS200/CH200 to RS-232 port COM2 of the CR1000. 'Use Campbell Scientific SDI-12 cable part # 25356.
PS200/CH200 12 V Charging Regulators Minimum Maximum Maximum Maximum Maximum Maximum Maximum Minimum Maximum EndTable (1,Chg_TmpC,FP2,0,False) (1,VBatt,FP2,False,False) (1,IBatt,FP2,False,False) (1,ILoad,FP2,False,False) (1,V_in_chg,FP2,False,False) (1,I_in_chg,FP2,False,False) (1,Chg_TmpC,FP2,False,False) (1,PanelTempC(),FP2,0,False) (1,PanelTempC(),FP2,False,False) 'Subroutine sends two back space characters to the PS/CH200 to 'wake it up and switch over to RS-232 mode.
PS200/CH200 12 V Charging Regulators 7. Charging Details 7.1 Charging Algorithm The PS200/CH200 offers both Continuous and Solar charging inputs. The Continuous charging input has a user adjustable input current limit with a maximum (default) value of 1.1 A DC to help protect AC/AC transformers and AC/DC converters. The 3.6 ADC typical current limit of the PS200/CH200 Solar charging input is well suited for 70 W solar panels.
PS200/CH200 12 V Charging Regulators fully charged battery was swapped in replacing an old battery which suffered from a significant Qloss. During cycle charging if the battery charge current falls below C/100, then cycle charge will be terminated and Qloss will be zeroed. 15 1.2 1.013 14.4 0.96 13.8 0.72 Vbatt Ibatt 13.2 0.48 12.6 0.24 12.332 0.029 12 0 5 0 10 0 20 15 Hours 19.667 Time in Hours FIGURE 7-1. 2 step constant voltage battery charging by PS200/CH200 7.
PS200/CH200 12 V Charging Regulators 4.5 70 4.5 70 60 50 2.7 40 Im Pm 30 1.8 Power (Watts) Current (Amps) 3.6 20 0.9 10 0 0 0 0 0 1 2 3 4 5 6 7 8 9 0 10 11 12 13 14 15 16 17 18 19 20 21 Vcm 21 Voltage (Volts) FIGURE 7-2. 70 W solar panel I – V and power characteristics 8. A100 Null Modem Adapter The A100 adapter has two 9-pin CS I/O ports with a null modem between them. The ports are used to connect two 9-pin devices (e.g.
PS200/CH200 12 V Charging Regulators FIGURE 8-2. PS200 with A100 module using a COM220 and RF450 9. A105 Additional 12 V Terminals Adapter The A105 adapter adds four 12 V terminals and four ground terminals to a PS200/CH200 charging regulator. The extra terminals make it easier to wire multiple continuously powered 12 Vdc devices to the power supply. FIGURE 9-1.
PS200/CH200 12 V Charging Regulators 10. References 1 – Genesis Application Manual – Genesis NP and NPX Series US-NP-AM002, June 2006.
PS200/CH200 12 V Charging Regulators 54
Appendix A. Advanced Programming Techniques The following CR1000 programming examples show how to use both SDI-12 and RS-232 advanced instruction programming techniques. All of these example programs can be pulled down from Campbell Scientific’s website at www.campbellsci.com. After connecting to the home page select “Support” and then “Downloads” from the pull-down menu. Search for PS200. Wiring for the communication interface cable for all programs is as follows.
Appendix A. Advanced Programming Techniques Public CH200_M0(6) 'Array to hold data coming from the PS200/CH200 'Alias names for array elements.
Appendix A. Advanced Programming Techniques A.1.2 Write/Reset Remote Battery Temperature RS-232 Programming Example 'CR1000 Series Datalogger 'Program: RS-232_Set_Batt_Temp.CR1 'Date: 1.November.2010 'Ver: A ' 'Notes: This program sets the battery temperature value. 'Connect the PS200/CH200 to RS-232 port COM2 of the CR1000. 'Use Campbell Scientific RS-232 cable part # 25356.
Appendix A. Advanced Programming Techniques Public ChargeState As String 'Charging source: None, AC, or Solar Public ChargeSource As String 'Check battery error: 0=normal, 1=check battery Public Ck_Batt 'Word or phrase equivalent of check battery error. Public CheckBattery As String 'Array to hold the names of the battery error information. Dim CheckBatteryArr(2) As String 'Variables & constants used to write an external battery temperature to the 'PS/CH200 and reset it. 'True - use external battery temp.
Appendix A. Advanced Programming Techniques 'SlowSequence with RS-232 measurements SlowSequence SendBattTemp = True 'Configure the COM port used with the PS/CH200 SerialOpen (COMPRT,9600,3,0,150) Scan(30,sec,0,0) 'Measure battery temp with TC attached to external battery TCDiff (ExtBatTempC,1,mV2_5C,1,TypeT,PanelTempC,True ,0,_60Hz,1.0,0) 'Send the external battery voltage temperature if SendBattTemp is true. If SendBattTemp Then 'Send out the external battery temperature and format it.
Appendix A. Advanced Programming Techniques 'Values for check battery start with zero. Have to shift the value 'by one to line it up with the correct words in the array. CheckBattery = CheckBatteryArr(Ck_Batt + 1) EndIf NextScan EndProg A.2 Change Battery Capacity Battery capacity is used by the PS/CH200 to determine when to switch from a higher current charge state, such as cycle charging or current limited, to a lower current charging state – float charging.
Appendix A. Advanced Programming Techniques Public CH200_MX(4) 'Array to hold extended data from the PS200/CH200 'Alias names for array elements. Alias CH200_MX(1) = BattTargV 'Battery charging target voltage. Alias CH200_MX(2) = DgtlPotSet 'Digital potentiometer setting. Alias CH200_MX(3) = BattCap 'Present battery capacity. Alias CH200_MX(4) = Qloss 'Battery charge deficit. 'SDI-12 formatted battery capacity value. Public SDI12command As String 'Response from PS/CH200.
Appendix A. Advanced Programming Techniques A.2.2 Change Battery Capacity RS-232 Programming Example 'CR1000 Series Datalogger 'Program: RS-232_Set_Batt_Cap.CR1 'Date: 1.November.2010 'Ver: A ' 'Notes: This program sets the battery capacity value in the PS/CH200. 'Connect the PS200/CH200 to RS-232 port COM2 of the CR1000. 'Use Campbell Scientific RS-232 cable part # 25356.
Appendix A. Advanced Programming Techniques 'Variables & constants used to write the new battery capacity 'to the PS/CH200. 'Command sent to the PS/CH200 to write external battery temperature. 'Instruction responds with "OK" if all went well. Const WRITE_BATT_CAP_CMD = "WR_BC(" Public NewBattCap 'New battery capacity. 'String storing the formatted ASCII equivalent of the ext battery 'temp. Public NewBattString As String * 5 'String coming back from either the "WR_BT" or "RS_INTBT" command.
Appendix A. Advanced Programming Techniques 'SlowSequence with RS-232 measurements SlowSequence 'For this exercise a battery capacity of 12 will be written to the CH200. NewBattCap = 12 'Configure the COM port used with the PS/CH200 SerialOpen (COMPRT,9600,3,0,150) Scan(30,sec,0,0) 'NOTE: THE ORDER IN WHICH COMMANDS ARE SENT, AND READ FROM, THE CH200 'IS VERY IMPORTANT! KEEP THE STRUCTURE AS SHOWN IN THIS EXAMPLE. IT 'WILL TAKE TWO COMPLETE SCAN CYCLES TO UPDATE ALL VARIABLE 'INFORMATION.
Appendix A. Advanced Programming Techniques 'Send new battery capacity to the CH200 if different from the presently 'stored value. If NewBattCap <> BattCap Then 'Save the old and new values before it changes. Store a time stamp. CallTable BattCap 'Convert the new battery capacity value to ASCII text. 'Specify four digits with one decimal after the decimal point. 'No leading zeroes. NewBattString = FormatFloat (NewBattCap,"%4.1f") 'Completed string sent to the PS/CH200 must be "WR_BC(nn.n)>" where 'nn.
Appendix A. Advanced Programming Techniques sending the battery test instruction will cause the charger to go back to normal within 90 seconds. Depending on the state of the battery and the load on the system it might take only a few minutes or several hours to detect a bad battery. The examples provided for this instruction leave the system running on battery voltage for three hours. Both the SDI12 and RS-232 programming examples show two different methods of using the battery test instruction.
Appendix A. Advanced Programming Techniques 'Array to hold all the data coming from the PS200/CH200 Public CH200_M0(9) 'Alias names for array elements.
Appendix A. Advanced Programming Techniques 'Only save this information when the TestBatt flag 'is on. DataTable (DischargeTest,TestBatt,144) DataInterval (0,10,Min,10) Sample (1,ElapsedHrs,FP2) Average (1,Chg_TmpC,FP2,False) Average (1,VBatt,FP2,False) Average (1,IBatt,FP2,False) Minimum (1,VBatt,FP2,False,False) Sample (1,Qloss,FP2) Sample (1,ChargeState,String) Sample (1,ChargeSource,String) Sample (1,CheckBattery,String) EndTable 'Main Program BeginProg 'Put length of battery test in hours here.
Appendix A. Advanced Programming Techniques TestBatt = Off EndIf 'Get PS200/CH200 values. SDI12Recorder (CH200_M0(),3,0,"MC!",1.0,0) 'Array values start with one. Values for charge state start with -1. 'Have to shift the value by two to line it up with the correct words 'in the array. ChargeState = ChargeStateArr(Chg_State + 2) 'Values for charge source start with zero. Have to shift the value 'by one to line it up with the correct words in the array.
Appendix A. Advanced Programming Techniques 'Arrays to hold the associated words for the charge state, charge source, 'and check battery values. Dim ChargeStateArr(6) As String Dim ChargeSourceArr(3) As String Dim CheckBatteryArr(2) As String 'Variables to hold the words for charge state, charge source, and check 'battery.
Appendix A. Advanced Programming Techniques 'Load arrays with words to associate with the charge state, 'charge source and check battery values from the PS/CH200.
Appendix A. Advanced Programming Techniques A.3.2 Enter Battery Test State RS-232 Programming Example A.3.2.1 Calendar Date Battery Test – RS-232 'CR1000 Series Datalogger 'Program: RS-232_Calendar_Battery_Load_Test.CR1 'Date: 1.November.2010 'Ver: A ' 'Notes: This program tests the existing battery for problems by 'setting the target voltage down to 11.5VDC forcing the system to run 'strictly on battery power for user settable amount of time.
Appendix A. Advanced Programming Techniques Public ILoad 'Voltage coming into the charger: VDC Public V_in_chg 'Current coming into the charger: Amps Public I_in_chg 'Charger temperature: Celsius Public Chg_TmpC 'Charging state: Cycle, Float, Current Limited, or None Public ChargeState As String 'Charging source: None, AC, or Solar Public ChargeSource As String 'Check battery error: 0=normal, 1=check battery Public Ck_Batt 'Word or phrase equivalent of check battery error.
Appendix A. Advanced Programming Techniques 'Only save this information when the TestBatt flag 'is on.
Appendix A. Advanced Programming Techniques Call WAKEUP 'Send out the PS/CH200 command followed by a carriage return. SerialOut (COMPRT,BATTEST_CMD,"",1,3) SerialOut (COMPRT,CR,"",1,3) 'Bring in the result from either command and process it. 'Discard characters in the receiver buffer up to and including 'asterisks "*" SerialIn (xmit_str,COMPRT,50,"*",40) 'Capture the PS/CH200 response string after the asterisks and 'including the string terminator hexadecimal zero (&H00).
Appendix A. Advanced Programming Techniques If Check_sum = 0 Then 'Split up the main string from PS/CH200 into separate components. SplitStr (CH200_MX(),CH200string,COMMA,4,4) 'Sort out the components to specific variables. BattTargV = CH200_MX(1) DgtlPotSet = CH200_MX(2) BattCap = CH200_MX(3) Qloss = CH200_MX(4) EndIf CallTable (DischargeTest) 'write data before zeroing ElapsedHrs NextScan EndProg A.3.2.
Appendix A.
Appendix A. Advanced Programming Techniques Minimum Maximum Maximum Maximum Maximum Maximum Maximum Minimum Maximum EndTable (1,Chg_TmpC,FP2,0,False) (1,VBatt,FP2,False,False) (1,IBatt,FP2,False,False) (1,ILoad,FP2,False,False) (1,V_in_chg,FP2,False,False) (1,I_in_chg,FP2,False,False) (1,Chg_TmpC,FP2,False,False) (1,PanelTempC(),FP2,0,False) (1,PanelTempC(),FP2,False,False) 'Only save this information when the TestBatt flag 'is on.
Appendix A. Advanced Programming Techniques If TestBatt = Off AND (ManualTest = On OR XDays <= DayCntr) ManualTest=Off TestBatt = On DayCntr = 0 Timer (1,Hr,0) EndIf Then 'Battery test command will be sent every 30 seconds. Must send it 'at least every 90 seconds or the PS/CH200 will automatically reset! If TestBatt=On AND ElapsedHrs <= TestLengthHrs AND VBatt >= 11.7 Then 'Call WAKEUP to wake up the PS/CH200. Call WAKEUP 'Send out the PS/CH200 command followed by a carriage return.
Appendix A. Advanced Programming Techniques 'Discard characters in the receiver buffer up to and including asterisks "*" SerialIn (xmit_str,COMPRT,50,"*",40) 'Capture the PS/CH200 response string after the asterisks and including the 'string terminator hexadecimal zero (&H00). SerialIn (CH200string,COMPRT,50,&H00,140) Check_sum = CheckSum (CH200string,5,0 ) 'For the string to be correct the check sum must be zero. If Check_sum = 0 Then 'Split up the main string from PS/CH200 into separate components.
Appendix A. Advanced Programming Techniques 'Array to hold data coming from the PS200/CH200 Public CH200_M0(6) 'Alias names for array elements.
Appendix A. Advanced Programming Techniques A.4.2 Zero Out QLoss RS-232 Programming Example 'CR1000 Series Datalogger 'Program: RS-232_Clear_QLoss.CR1 'Date: 8.Nov.2010 'Ver: A ' 'Notes: This program sets QLoss back to zero using the RS-232 'command "RESET_QLOSS>" to set QLoss to zero. ' 'Use Campbell Scientific RS-232 cable part # 25356.
Appendix A. Advanced Programming Techniques 'Command to get extended status information. Const EXTSTATS_CMD = "RD_SPECIAL>" 'Array to hold extended data from the PS200/CH200 Public CH200_MX(4) As String * 20 'Battery charging target voltage. Public BattTargV 'Digital potentiometer setting. Public DgtlPotSet 'Present battery capacity. Public BattCap 'Battery charge deficit. Public Qloss ' 'Command to clear out QLoss.
Appendix A. Advanced Programming Techniques 'SlowSequence with RS-232 measurements SlowSequence 'Configure the COM port used with the PS/CH200 SerialOpen (COMPRT,9600,3,0,150) Scan(30,sec,0,0) 'Get the PS/CH200 status information. 'Call WAKEUP to wake up the PS/CH200. Call WAKEUP 'Send "read status" command to PS200 followed by a carriage return.
Appendix A. Advanced Programming Techniques SerialIn (CH200string,COMPRT,50,&H00,140) Check_sum = CheckSum (CH200string,5,0 ) 'For the string to be correct the check sum must be zero. If Check_sum = 0 Then 'Split up the main string from PS/CH200 into separate components. SplitStr (CH200_MX(),CH200string,COMMA,4,4) 'Sort out the components to specific variables. BattTargV = CH200_MX(1) DgtlPotSet = CH200_MX(2) BattCap = CH200_MX(3) Qloss = CH200_MX(4) EndIf NextScan EndProg A.
Appendix A. Advanced Programming Techniques Public CH200_M0(9) PS200/CH200 'Alias names for array elements.
Appendix A. Advanced Programming Techniques Scan (5,Sec,0,0) PanelTemp (PanelTempC,250) Battery (Batt_Volt) CallTable Hour NextScan SlowSequence Scan (SlowScan,Sec,3,0) 'Get extended status values. SDI12Recorder (CH200_MX(),3,0,"M6!",1.0,0) 'Get PS200/CH200 values. SDI12Recorder (CH200_M0(),3,0,"MC!",1.0,0) 'Values for the following parameters start at -1 for the charge state and 0 for 'the charge source and check battery. Array locations start with one.
Appendix A. Advanced Programming Techniques Const COMPRT = COM2 'Hexadecimal equivalent of a carriage return. Const CR = CHR(&H0D) 'It is a comma. Sort the string from the PS/CH200 using commas. Const COMMA = CHR(&H2C) 'I like to use the words "on" and "off" vs. "true" and "false". Const On = True Const Off = False Public PanelTempC 'Datalogger panel temperature: Celsius 'Array holding all the three Amp-hour calculations Public Amp_Hour(3) 'Amp-hours used by the entire system.
Appendix A. Advanced Programming Techniques 'Stored hourly data.
Appendix A. Advanced Programming Techniques 'For the string to be correct the check sum must be zero. If Check_sum = 0 Then 'Split up the main string from PS/CH200 into separate components. SplitStr (CH200_M0(),CH200string,COMMA,9,4) 'Sort out the components to specific variables.
Appendix A. Advanced Programming Techniques A.6 Changing the SDI-12 Address Programming Example The CR1000 program example below shows how to change the SDI-12 address in PS200/CH200 using SDI-12 port 3 (C3). The Campbell Scientific programming software, CRBasic, would be used to set the variable “new_sdi12_address” initially to a desired value but the value can be changed “on the fly” while monitoring the data by changing the variable to a new value.
Appendix A. Advanced Programming Techniques Alias CH200_M0(6)=Chg_TmpC 'Charging state: Cycle, Float, Current Limited, or None Alias CH200_M0(7)=Chg_State 'Charging source: None, AC, or Solar Alias CH200_M0(8)=Chg_Source 'Check battery error: 0=normal, 1=check battery Alias CH200_M0(9)=Ck_Batt 'Arrays to hold the associated words for the charge state, charge source, 'and check battery values.
Appendix A. Advanced Programming Techniques SDI12Recorder (CH200_M0(),3,new_sdi12_address,"MC!",1.0,0) 'Array values start with one. Values for charge state start with -1. 'Have to shift the value by two to line it up with the correct words 'in the array. ChargeState = ChargeStateArr(Chg_State + 2) 'Values for charge source start with zero. Have to shift the value 'by one to line it up with the correct words in the array.
Appendix A.
Campbell Scientific Companies Campbell Scientific, Inc. (CSI) 815 West 1800 North Logan, Utah 84321 UNITED STATES www.campbellsci.com • info@campbellsci.com Campbell Scientific Africa Pty. Ltd. (CSAf) PO Box 2450 Somerset West 7129 SOUTH AFRICA www.csafrica.co.za • cleroux@csafrica.co.za Campbell Scientific Australia Pty. Ltd. (CSA) PO Box 8108 Garbutt Post Shop QLD 4814 AUSTRALIA www.campbellsci.com.au • info@campbellsci.com.au Campbell Scientific do Brasil Ltda. (CSB) Rua Apinagés, nbr.