Using Arduino for Data Collection

Change of plan. Previously I said we'd take a look at the static test fire results in this post. Instead I'm going to make a short digression and talk about a few issues related to using the Arduino Mega 2560 as a tool to collect and log sensor data. I decided to use an Arduino because I had one handy and I didn't want to purchase a specialized tool like LabJack. Will the Arduino give satisfactory performance?

After reading on the web about similar attempts by others I had two questions.

First, how fast can the Mega's on-board analog to digital converter (ADC) perform reads across multiple input pins? Recall that we are measuring force and pressure data. In practice that means the Arduino reads one input pin, then the other, and then it loops repeatedly. According to the 2560 microcontroller's datasheet, the program should allow a minimum of 125 microseconds after switching the channel to another pin. This time is necessary for the ADC to stabilize. However, some authors recommend putting a delay of at least 5 milliseconds in between successive pin reads to ensure clean data. That would slow down our data collection significantly. Are the 5 milliseconds really necessary?

Second, how noisy is the data? Will we be able to extract meaningful measurements without significant post-processing?


(1) No additional delay is required in the program to allow the ADC to settle between pin reads. I verified this by running trials with a variety of delays between 0 and 7 milliseconds across 3 input pins. The graph below shows readings for one of the three pins. As you can see, there is no visible difference in the noise levels. All of the traces stay within an absolute range of about 0.01V. Including the processing overhead associated with the program, I obtained a loop frequency of 353 Hz for the 0-delay program. So, each pin will be read 353 times per second. I'm guessing that's more than enough for our purposes. Therefore we won't need to mess with more advanced strategies like modifying the prescaler or putting the ADC into freerunning mode and using interrupts (see the datasheet).

ADC performance with different read delays: Readings for 1 of 3 input pins

(2) The data is surprisingly clean. Below is a sample trace from the pressure transducer during test firings at different input pressure settings. I'll discuss the results later, but for now simply note that the data looks quite tidy.

OK, now we're ready to blow some stuff up...