At this moment I am using oversampling to increase my analogread resolution. This in combination with increasing the frequency of the ADC. Is someone able to take a look at it?
#define FASTADC 1
// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
int value[100]; // variable to store the value coming from the sensor
int i=0;
void setup()
{
Serial.begin(9600) ;
int start ;
int i ;
#if FASTADC
// set prescale to 16 (1MHz)
sbi(ADCSRA,ADPS2) ;
cbi(ADCSRA,ADPS1) ;
cbi(ADCSRA,ADPS0) ;
#endif
}
void loop()
{
for (i=0;i<100;i++)
{
value[i]=Read12bit(0);
}
for (i=0;i<100;i++)
{
Serial.println(value[i]);
}
Serial.println();//Some blanks between values
Serial.println();
delay(5000);
}
int Read12bit(uint8_t pin){
int Result = 0;
analogRead(pin); //Switch ADC
for(int i = 0;i < 16; i++) { //Read 16 times
Result = Result + analogRead(pin); //Sum results
}
Result = (int)Result/4; //Divide by 4 for 12 bit value
return(Result);
}
At this moment the resolution of this oversampled analogread is 12-bits. With a little calculation the time to read will take 0,208milliseconds. If I want to increase my resolution more i.e. 13-bit. This will take the measurement 0,832 milliseconds. This seems rather big, so my question is can I do this in another way?
EDIT Why? I am trying to position multiple linear actuator using multiple arduino's connected via CAN-bus (the arduino's will not communicate with eachother unless an error occures) THe positioning has to be precise (<0.1mm on a 30 cm rod).
Why is 12 or 13 bit accuracy and/or resolution needed?
12 is probably enough. But I just like to find out the boundaries of the equipment :)
What real world processes are being monitored that 0.012% perbit step sizes are not swallowed in the noise of reality?
Probably none 13-bit resolution is probably too high for my application anyways.
Other reason why I like a higher resolution First couple of voltages I cannot use. My sensor gives a 4 to 20mA signal which i convert with resistor to ground.