How can I speed up the ADC?

pbrouwer:
Hi Firemann00b,

Just a few design considerations before you max out on the ADC.

  • Do you really need to sample that fast. Controlling stuff is about controlling or changing the state they are in. Speed is a state. What is important is how fast does your robot CHANGE speed / steer. I take it it is not going to make a U-turn with a radius of 1 cm if it's doing 2 m/s. There is no point in having a very fast controller if the robot cannot comply with the commands its been given. It will cause the controller to oversteer, and can cause stability issues (oscillations)
  • Fast sampling creates noisy readings. You will have to filter the readings.
  • Fast sampling creates lots of data. Arduinos do not have lots of memory to store that information, nor do they have a lot of CPU power to process it in real time.
  • Look ahead. Knowing what's coming gives you more time to react. Faster sampling won't.

regards,

Pieter

I plan to read the interrupts on a cyclic basis. I'm not going to implement it fully, but my aim is to make my program run hard real time(for those who aren't into controller theory, this means there is no jitter on the delay between reading the input and writing the output). So it's of great importance I generate an input fast, so there's enough time left in the cycle to calculate the output. The cycle time for the whole algorithm is about 5 ms to make turns with a minimal radius of 10cm. It's calculated that if the car keeps going forward for 10 cycles, it will have lost the line. For 8 sensors, it takes about 1 ms to read them all with a division factor of 128. This means a fifth of the cycle is lost just to reading the sensors. And I have to use linear interpolation to translate the sensor values to an error and then calculate the motor speeds to compensate for the error.