SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By Metalloy
#195203
Hi,

We are developing a Battery Monitor System for monitoring long battery strings used for UPS systems. The smallest string is 30-34 battery blocks, 12V, and has no ground. The two ends of the string are floating at ambiguous potentials. The string voltage is approx. 400V.

We need to measure each battery block (mainly its voltage) with accuracy better than 10mV, and linearity of measurement from low value (<5V) to highest value (>14V) better than 10mV. And since measurements have to be done on the High Voltage side, we opted for linear opto-isolators to send the analog voltage to the Low Voltage side, where we have an ATtiny84 that reads the Analog Value and sends it to an MCU based on ATMega2560. The concept is shown in the attached (RIP-Linear.pdf)

We worked for a while with Linear Opto-couplers, but accuracy was about 60mV. Please note that we first use an adjustable potential divider with a ratio of about 0.25 so that the working range would be 0-4V at the input of the linear coupler. We got the linear couplers to +/-15mV which expanded to +/-60mV after expansion.

So now we are thinking of dropping this approach, and using the following : put an ATtiny85 on the high side, to read the stepped-down (divide by 4) analog voltage directly and somehow transmit this value through a standard on/off opto-coupler to the ATtiny84.

We are not experts in this area, and we had a tough time making the ATtiny84 communicate with the MCU over RS485 using the SoftwareSerial Library. We also know that you cannot run two instances of SoftwareSerial in the same time, so we cannot simply use it to communicate with the ATtiny85 to read the battery voltage.

So :

1. Is SPI the correct approach to send the battery voltage from the ATtiny85 to the ATtiny84 ? or there is another simpler approach ?

2. If case is for SPI, can you kindly help / direct us for the code on both the two ATtinys ?

Thank you in advance for your support.