Multiple Sensor with AREF problem affecting other sensors

Hello!
I use 4 sensors were i read analog data and the problem I encountered is that the AnalogReference affect all my sensor, I just wanna use it for one which is the accelerometer i have, the others are fine.

Is there a way to use the AREF pin on one sensor without affecting other sensor values.

Sensors I use:
pH- Sensor 5v
Accelerometer 3.3V(use AREF) <-------- affects the other sensors, and gives corrupted values?
SoundSensor (5V)
Temperature sensor (5v)

You can reprogram the ADC, selecting the analog voltage reference as appropriate for each device. It is usually a good idea to discard the first ADC reading after reprogramming it.

The various registers and options associated with the ADC are fully described in the ATmega328 data sheet.

Thx , man i will look it up

I just reread your post and realized that you might be thinking of applying a fixed voltage to AREF, for example 3.3V. If you do that, and assuming that your Arduino is running on 5V, then you can't choose AVCC (5V) or the internal 1.1V source as the ADC reference voltage. You can always use 5 V as the ADC reference for all your sensors, and then scale the results for the 3.3V sensor up.

From the atmega328 data sheet:

If the user has a fixed voltage source connected to the AREF pin, the user may not use the other reference voltage options in the application, as they will be shorted to the external voltage.

How do you exactly mean with scale should i attach the 3.3V to the 5V pin on the accelerometer with the aref ?

here is the code i use for teh accelerometer.

Buffra_data_ACC_XYZ(SampleVector,Buffer_XYZ); // sample ten values
  for( int i = 0; i < 3; i++){
  Sortera_Data(SampleVector,Buffer_XYZ[i]); // sorts the value
  Medelvarde_Accelerometer[i] = MedelVarde(float(SampleVector),Buffer_XYZ[i]);  // gets the mean value
  }
  float Zero_G = 512.0;
  float scale = 102.3; // när det ändras så mycket blir det G
  Acc_X = (Medelvarde_Accelerometer[0] - Zero_G)/scale;
  Acc_Y = (Medelvarde_Accelerometer[1] - Zero_G)/scale;
  Acc_Z = (Medelvarde_Accelerometer[2] - Zero_G)/scale;

How do you exactly mean with scale should i attach the 3.3V to the 5V pin on the accelerometer with the aref ?

I have no idea what you mean. Please rephrase your question.

The output of a 3.3V accelerometer can never exceed 3.3 V. So if you use an ADC with 5V as the reference voltage to measure the output, you will have to rescale the ADC values. In particular, this will not be correct:

float Zero_G = 512.0;

Ah ok, is there any way to scale it right without using aref? Because its hard to scale if you dont know what the ZeroG are in analog values. For example with 5 volt i know that its scaled as 1023, and half of that value.. meaning 512(the analog value) is when we are at ZeroG. But when i stop using AREF, the values vary alot and i cannot see the Zero_G because i dont know the maximum analog value for 3.3 Volt.
here is the datasheet:

http://www.analog.com/static/imported-files/data_sheets/ADXL335.pdf

I am new to this and hope i have mentioned my problem in a clear way,

I want to get the right Scale and Zero_G, for 3.3v without using aref, cause this pin has caused me much problem..

Regards,

Volkan Coskun

You should calibrate the accelerometer yourself, which means to determine the scale and offset for each axis directly. There are several ways to do it, but all involve placing the sensor in many different fixed orientations and taking readings. Since you know the direction of the force of gravity, that can be used to determine those six constants.

Here is a description of the best way of calibrating magnetometers, but it works for accelerometers just as well: Sailboat Instruments: Improved magnetometer calibration (Part 1)

Ok , thx for the help bro !