I have the circuit built and the arduino correctly reads two separate voltages at the same time accurately but when I try to split one voltage across a known resistor and an unknown resistor to find the value of the unknown the meter tells me that even though I am inputting only 3 volts there are 3 volts going into pin 0 and 1.8 volts going into pin 1. I know I am not creating 1.8 volts out of nothing. why is this happening?
any help would be great.
Schematic? Code? Please use code tags, and make your schematic images less than 1000 pixels wide.
ok. Here is my code. so far it measures the voltage coming into the 0 and 1 analog pins and displays the value onto the lcd
the picture is at https://drive.google.com/file/d/0B0KwO5OEf0tWai1rVG9HUWtSbFE/edit?usp=sharing
which is my google drive.
//going to be an ohm meter but for now it is just two voltmeters
// include the library code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3,2);
// variables for input pin and control LED
int analogInput = 1;
int analogInput1=0;
float vout = 0.0;
float vout1 = 0.0;
float vin1 = 0.0;
float vin = 0.0;
float R1 = 50000.0; // !! resistance of R1 !!
float R2 = 4400.0; // !! resistance of R2 !!
// variable to store the value
int value = 0;
int value1 = 0;
void setup(){
// declaration of pin modes
pinMode(analogInput, INPUT);
pinMode(analogInput1, INPUT);
// set up the LCD
mySerial.begin(9600);
delay(500);// wait for it to boot
}
void loop(){
// read the value on analog input
value = analogRead(1);
value1 = analogRead(0);
vout1 = (value1 * 5.0) / 1024.0;
vout = (value * 5.0) / 1024.0;
vin1 = vout1 / (R2/(R1+R2));
vin = vout / (R2/(R1+R2));
// print result to lcd display
mySerial.write(254);
mySerial.write(128);
mySerial.print(vin);
mySerial.print("V");
mySerial.print(" ");
mySerial.print(vin1);
mySerial.print("V");
// sleep...
delay(500);
}
Schematic? Much more helpful than a pictorial.