Arduino atmega328 giving random readings.

Hi!!
can anybody tell me why my arduino atmega328 is giving me random reading when I connect my pressure sensor to analog pin of arduino. If i connect that analog i/p pin to gnd then only it shows 0 reading. If i don’t applying any pressure then it should show 0 reading. why this is happening sometimes. sometimes it is showing correct values.pl. help.

can anybody tell me why my arduino atmega328 is giving me random reading when I connect my pressure sensor to analog pin of arduino.

Usually because you have connected it incorrectly.

If i connect that analog i/p pin to gnd then only it shows 0 reading.

What a surprise.

What pressure sensor is it? EXACTLY how is it wired?

rupaliambardekar: Hi!! can anybody tell me why my arduino atmega328 is giving me random reading when I connect my pressure sensor to analog pin of arduino. If i connect that analog i/p pin to gnd then only it shows 0 reading. If i don't applying any pressure then it should show 0 reading. why this is happening sometimes. sometimes it is showing correct values.pl. help.

How [u]exactly[/u] is it connected ? Are you using a breadboard ? Are the connections loose ? How long are the connecting wires ?

Have you commoned the grounds? Are cables shielded? Have you tried adding a 10nF capacitor between the anlog pin and ground to remove high frequency noise and interference?

Hi!! I am connecting analog pin with my opamp's output using connector which we can get ready made from the store. I hv not connected capacitor between gnd & analog pin. Is that really require? I' ll try it today.

Hi!!
4 Sensors are connected to multiplexer,multiplexer is connected to amplifier and amplifier’s output is connected to arduino’s analog input pin. I am not using breadboard. my ckt. is on pcb.

#define X_AXIS 1
// These constants won’t change. They’re used to give names
// to the pins used:
const int analogInPin = A1; // Analog input pin that the amplified o/p of sensor is attached to

int sensorValue = 0; // value read from the sensor
//int outputValue = 0; // value output to the PWM (analog out)
int CONTROLpin1 = 2; //*mux pin assignment to select channel no.
int CONTROLpin2 = 3; //*mux pin assignment to select channel no.
int CONTROLpin3 = 4; //mux pin assignment to select channel no.
int analogPin = 0; //

//int sensor = 0;
int i=3;
void setup()
{

pinMode(CONTROLpin1, OUTPUT);//*
pinMode(CONTROLpin2, OUTPUT);//*
pinMode(CONTROLpin3, OUTPUT);//*

digitalWrite(CONTROLpin1, bitRead(i,0));//bit3*
digitalWrite(CONTROLpin2, bitRead(i,1));//bit2*
digitalWrite(CONTROLpin3, bitRead(i,2));//bit1*

// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop()

{

// read the analog in value:
sensorValue = analogRead(analogInPin);
// print out the value you read:
Serial.println(sensorValue); // print out the value you read:
delay(100); // delay in between reads for stability

}

Your code is using A1 which is the 2nd analog. Is your multiplexer physically connected to A1 or is it A0? Are you sure you want to do a bitRead()?

Simplify your circuit to 1 analog connected to the Analog i/p and see if it works.

I hv connected 10nF capacitor between analog pin & ground. Now I am getting random readings for sensor 0&2. sensor 1&3 are perfectly working.Also pl. tell me can we connect 3.3v to ARef pin directly or any resistor is needed to attach in between? I am supplying analog reference to ADC externally.Pl. reply.