# Gen 3.2 PCS Voltage Monitor ADC

Gen 3.2

Gen 3.1

Microcontroller-related

Other Microserver-Related

## Introduction

The PCS is capable of providing the system power supply voltage to reasonable accuracy to the Single Board Computer (SBC). By means of a voltage divider we take the system supply voltage (between say 0 and 16 volts) and convert this to (0 to 2.5 volts), then digitize this and recover the original system supply voltage using a sensor model. This process is calibrated in the lab. As a result the SBC can estimate how much power it has remaining and budget its activity time accordingly. This is different from and better than the simple voltage thresholding (digital 1-or-0 for V < Vwarn and V < Vfail) in Gen 3.1.

## Technical Description

JP4 on the PCS board is the input for the External Battery Monitoring Circuitry. It leads to ground and to two serial resistors at R1=470kohms and R2=150kohms. Between these is a tap to Bat_Monitor (which has nothing to do with chiropterae.) In fact the Bat_Monitor line connects to RA5 on the PIC uc (pin 24), also known as AN4 (ADC channel 4). Assuming minimal current leakage and therefore no offset, these resistors will produce from (0--16 volts) an intermediate analog voltage of (0--3.87V). In fact the Ohm's law calculation gives a supply voltage corresponding to the maximum 4.096V reference voltage that can be pushed into the ADC:

$V_{(ADC=4.096V)}=2.5\cdot\left(\frac{R_1+R_2}{R_2}\right)=16.9V$

Unfortunately (I know what you're thinking) the reference voltage requires a supply of at least 4.3V and if the uc is driven by 2 D-cells combining to reach say 3.1V the only way to check the system voltage is to use the system voltage to power the voltage-check circuit. Ok, we can fix this if we need to by using a different reference voltage generating part.

There are three 8-bit configuration registers used to configure, acquire, convert, and recover digital representations of analog signals. In addition to the Bat_Monitor we also have two "general purpose" ADC lines available on PORTA, pins RA0 and RA1. (Special firmware would be needed to take advantage of these.)

A-to-D Control Registers, Initial Configurations

* ADCON0 NU--NU--CHS3-2-1-0--GO/DONE--ADON  Set to 00010001 (Select AN4, ADC Enable)
* ADCON1 NU--NU--VCFG1--VCFG0--PCFG3-2-1-0  Set to 00011010 (Set Vref = [0, RA3], ADC: RA0, RA1, RA5==Bat_Mon)