TS-BAT12

From embeddedTS Manuals
TS-BAT12
TS-BAT12.jpg
Release TBD
Battery Data Sheet
Operating Temperature
Cold -20C
Hot 55C
Mechanical
148mm x 130mm x 102mm
Optional DIN Rail Clip

Overview

The TS-BAT12 is an inline 24V battery device used to power TS industrial controllers and peripherals. The device accepts 24V DC input, and outputs 24V DC while powered via external power, and provides approximately 22V DC while operating on battery power, reducing voltage on a perceptible level indicating battery usage until power is restored or the battery is drained.

Usage

With 24 VDC connected, the TS-BAT12 is transparent to downstream devices. If 24 VDC is removed, the device will provide ~22.3-20.5 VDC degrading output voltage according to the battery fall-off until just before the battery cannot sustain output (at 20.48 V the TS-BAT12 will shut off, preserving the life of the battery for at least 2 days before permanent damage to the battery is done due to low voltage). This voltage drop communicates to all attached devices that power is presently sourced from battery and devices should respond accordingly (by monitoring inbound power, entering a reduced consumption mode, or shutting down completely until the power line returns to 24 VDC). The TS-BAT12 will draw approximately 200 mA during charging cycle until the internal 12 volt lead-acid battery is fully charged. The device will perform all necessary battery maintenance so long as it continues to be powered. Bat12 drain graph.jpg

Storage

The TS-BAT12 should be stored in its OFF state fully charged for maximum shelf life. Exact shelf life depends on ambient temperature, colder temperatures provide longer shelf life. On average, the TS-BAT12 in storage will need to be recharged once yearly if stored in a controlled 20 degrees C environment. Higher temperatures reduce the shelf life of the device significantly: 40 degrees C will necessitate recharging to full capacity once every two months. Exceeding the device's shelf life without recharging can result in permanent reduction of the battery's maximum capacity. See the battery datasheet for more detailed information.

Connections

Power input and output reside on the screw terminal block. Pin 1 is the leftmost pin when looking at the front of the box.

Pin 1 Pin 2 Pin 3 Pin 4
Function 24 VDC Input Positive 24 VDC Input Negative Output Voltage Positive Output Voltage Negative

LEDs

There are two status indicating LEDs on the TS-BAT12. The amber LED indicates charging status (on = charging, off = not charging), and the green LED indicates current device mode (on/off/sourcing from battery).

Green LED Amber LED Function
ON OFF Device is ON and providing power, battery is not charging.[1]
ON ON Device is ON and providing power, battery is being charged.
BLINKING OFF Device is ON and providing power from battery.
OFF OFF Device is OFF and not receiving external power.
  1. Normally, battery "not charging" means the battery is fully charged. The device will continue to "float charge" the battery as long as external power is provided.

Shutdown Button

Upon power loss, the TS-BAT12 will continue to provide power output until the battery is nearly exhausted. If power was disconnected on purpose, a non-metallic probe should be inserted into the SHDN hole to push the button within, readying the UPS device for storage. This button does nothing while the device is connected to external power.

Example Software

The TS-BAT12 communicates battery status by modulating the voltage level output to the downstream devices. This mechanism makes it possible for any downstream device to be aware of overall system power status simply by monitoring inbound power. One example TS product that is capable of doing this is the TS-7670. This is a small scripting-friendly software example that the downstream developer could incorporate into an automated shutdown system for disaster avoidance.

TS-7670 Example

This source can be found on the Technologic Systems FTP here.

// TS-7670 BAT12 Monitor
// Written by Michael D. Peters
// C. 2016 Technologic Systems, Inc.

// Read ADC at I2C address 0x78, parse bytes 3 (adc high byte)
//  and 2 (adc low byte), divide by magic 24.7 and presto input
//  voltage.
// Output VIN=<input voltage> so a script can parse and use.

#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <stdlib.h>
#include <strings.h>
#include <linux/i2c-dev.h>

#define CONVERSION_DIVISOR 24.7
#define DATASET_SIZE 28

const char copyright[] = "Copyright (c) Technologic Systems - " __DATE__ ;

/// Divide raw by conversion value.
/// \arg rawValue The ADC value to convert to volts.
float vConvert(int rawValue){
	float theConversion;

	theConversion = (float)rawValue / CONVERSION_DIVISOR;

	return theConversion;
}

/// Gets ADC value from i2c.
/// \arg twifd file descriptor for i2c.
int getVinAdc(int twifd)
{
	uint8_t data[DATASET_SIZE];
	bzero(data, DATASET_SIZE);
	int adcValue = 0;

	read(twifd, data, DATASET_SIZE); // most of this data is reserved
					   // but the microcontroller will
					   // only dump all or none.
	adcValue = data[3]<<8|data[2];  // Byte 3 is MSB, byte 2 is LSB.
	return adcValue;
}

/// Opens I2C to 0x78.  Returns file descrptor if OK else quits.
int i2cInit()
{
	int fd = -1;
	fd = open("/dev/i2c-0", O_RDWR);
	if(fd != -1) {
		if (ioctl(fd, I2C_SLAVE_FORCE, 0x78) < 0) {
			return -2;
		}
	}
	return fd;
}

/// Main Entry Point.
//  program quits with -1 on file io error, -2 on i2c error.
int main(void)
{
	int raw, fd;
	float voltage;

	fd = i2cInit();
        if(fd == -1 || fd == -2) {
          printf("VIN=%d\n", fd);
          return fd; // quit on error.
        }
	raw = getVinAdc(fd);
	voltage = vConvert(raw);
        printf("VIN=%f\n", voltage);
	return 0;
}