Welcome to the N1IR Electronics Website. Totally off the cuff, one take, unrehearsed video projects for anyone interested in amateur radio, electronic design, makers, hardware hackers and science.

Get off your duff and build something!
Training the hand and mind since 1982.

Thursday, February 20, 2014

Automatic Battery Voltage Entry in Excel

Hi all,
Sorry it been a while since the last post, I’ve been working on some bitcoin mining with a laptop on solar power! So far made $5 a month with just spare parts laying around and on my network dead time.

Anyway here is a new project I was just working on, I wanted a way to plot the capacity on my larger 80 Ah Lead acid batteries. In years past I would hook up a load and a voltmeter and read every 10 minutes and enter in the voltage by hand in excel. This is okay  but I wanted a better autonomous way to enter in the voltages. I looked into commercial meters and other stuff, way to expensive.

Then I cam across the Arduino Micro at my local radio shack, I was floored RS had arduino stuff. Well anyway the micro has a USB keyboard and mouse library.

So with a very simple program I was able to read A0 and print it out via USB keyboard to excel, here is the program.

const int analogInPin = A0;
int sensorValue = 0;

void setup() {
void loop() {
delay (5000);
sensorValue = analogRead(analogInPin);
delay (100);
delay (100);
delay (100);
delay (100);
delay (100);

delay (5000);

A bit about the program I used LibreOffice so the =NOW() is a time stamp function, also as soon as you plug in the USB it will start entering data make sure your on A1 block in excel when starting

Be careful with the delay, if the delay is too small it will be difficult to program, hit the reset button while programming to "break" in.

You can see it in the video below:

Here is the circuit, I used (3) 100K precision resistor .1% this is to eliminate the need to calibrate, should be close enough. I am monitoring a 9 Volt battery for test with no load. 

The Math okay the A to D has 1024 steps from 0 to 5 Volts so take 5/1024 = about 4.88 mV/Step.

So VIN = ((A2DValue*.00488)*3) for this circuit.

Overall I was impressed by the Mico, other projects I have in mind with the micro:

Password keeper (press a button and output a large password)
Automatic data entry in web apps (end boring same data entry)