Vinay

Members
  • Content Count

    3
  • Joined

  • Last visited

About Vinay

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Vinay

    Analog.read error

    Hello Jon, Thanks for your help. I have been using wrong ADC header all the time. I got to know my mistake after seeing your setup pictures. Now my code works fine.
  2. Vinay

    Analog.read error

    Hello Jon, Thanks for your help. I am using a circuit which have two thermistors(10K ohms @25 degC) and a resistor(10K ohms) in series to get the voltages as mentioned in my post. When I use your code (variable type as int), I was getting all negative values as shown in the attached file. When I use my previous code (variable type as float), I was getting values around 45000 as mentioned in my post. I have tried passthrough demo. I have changed the input from 0 to 3 and checked the voltage on the output-0 in all cases (input as 0,1,2,3 and output as 0). I was getting the voltages as 4.9V in all cases. Am I missing anything in the coding part or can it be an issue with my hardware. Serial monitor with variable type as float: Serial monitor with variable type as int:
  3. Vinay

    Analog.read error

    Hello, I need to measure voltages at 2 points on a circuit for calculating temperatures using RTD's. For this I have used UNO board and connected pins 0,1,2,3 to the different points on the circuit (pin 0 to source and pin 3 to ground). From multimeter, I got voltage readings as V0: 4.9V, V1:3.2V, V2:1.5V and V3:0V. I got the readings from the UNO board as 1023, 659, 293 and 0 respectively. But when I add an analog shield on the UNO to increase the accuracy I was not getting proper readings from it. Analog shield is returning the readings as 45934, 45976, 46055 and 45921 for the voltages 4.9V, 3.2V, 1.5V and 0V respectively. Following is the code I was using to get the readings from the analog shield. #include <analogShield.h> void getTemp (float *t) { unsigned int V0,V1,V2,V3; V0 = analog.read(0); V1 = analog.read(1); V2 = analog.read(2); V3 = analog.read(3); t[0] = V0; t[1] = V1; t[2] = V2; t[3] = V3; return ; } void setup() { analogReference(DEFAULT); Serial.begin(9600); } void loop() { float temp[4]; getTemp(temp); Serial.print(temp[0]); Serial.print(" V0 "); Serial.print(temp[1]); Serial.print(" V1 "); Serial.print(temp[2]); Serial.print(" V2 "); Serial.print(temp[3]); Serial.print(" V3 "); Serial.println(); delay(200); return; } My question is why the sheild is returning a lower value for 4.9V than that of 3.2V. Also it need to return a value of 32768 for 0V (I guess). Is there any error in code. Thanks.