Posts: 27
Joined: Thu Mar 15, 2018 10:22 pm

Project advice on using analog accelerometers with an ADC

Thu Sep 06, 2018 4:42 pm

Hi everyone.

I am looking for some advice on part of a project i am doing. Last year for my dissertation I used 4 ADXL335 analog accelerometers and an arduino due to measure the acceleration of suspension components on a motorcycle that went over a specially designed mathematical speedbump and the response compared to a simulink model.

The results didn't match up as closely as i wanted them to so at the beginning of this year i'm going to redo the experiment but with different accelerometers. To determine which accelerometers will be the most accurate i'm going to perform a test of 4, maybe 5 accelerometers to determine which has the highest accuracy to the actual acceleration value. The 5 accelerometers i will be testing are below;

MPU-9260 (maybe)
Datron 2D 1 or 2 axis (Benchmark) - ... -DINA4.pdf

As said above, the datron accelerometer is probably going to be the benchmark at a retail price of around £100 as these are the same accelerometers used on MotoGP bikes. However, i dont know 100% that it would be the most accurate. So, why not test it?

My plan is to find an oscillating source (we have a suspension dynamometer at uni which is my first thought as it can run at repeatable frequencies, though will have to check the accuracy of IT'S sensors) and attach all the accelerometers to the source, so that the axes are all facing the same way to as high a precision as i can. Then run the source at multiple frequencies, compare the results of each accelerometer to each other and the known acceleration of the source.

However, this is where i've had issues before. When using the arduino, the highest sample rate i could achieve was around 180Hz (even though the bandwidths of the ADXL335 are up to 550Hz for the Z axis, and 1600Hz for the X and Y). I'm unsure whether this was down to my code, or limitations of the arduino. So, i bought the raspberry pi in the hope i could achieve faster sample rates.

The issue with using a pi is that it doesn't have analog inputs, So i'll have to use an ADC. I already had an adafruit ADS1115 and just bought an ADS1015. What I'm concerned about is if using an ADC will slow down the sample rate. This concern is because when using it with the arduino, as i originally had an ADS1115 connected for a fifth ADXL335 on the due, the sampe rate dropped from 180Hz without the ADC to 28Hz with the ADC. However, i was completely clueless and looking back over the datasheet, it seems that the default setting of the ADS1115 is to use single shot mode (ADS1115 datasheet, pg 21, section and i may have not been using code that allowed it to run at it's maximum sample rate.

So that is my description of my current project and the background. My questions and requests for advice are as follows (bearing in mind that the end goal is to have the accelerometers measuring suspension dynamics on a racetrack);

1. Any preferences on whether to use analog or digital?
2. Any suggestions on which Accell/ gyro module to use? or suggestion on one i haven't considered?
3. Would i be better using the ADS1115 (16 bit, up to 860 sps) or the ADS1015(12 bit, up to 3300 sps), or another i haven't considered?
4. If using the adafruit ADC's, would it be better to use single-shot mode with ALERT/RDY pin active, or continuous mode?
5. Would i get much better signals using differential inputs or is single ended accurate enough (considering possible noise)?
6. Any other suggestions?

Sorry for the long post, but thought i would try to tap into the massive collective knowledge and experience on here.

Thanks in advance


Posts: 198
Joined: Wed Dec 14, 2016 10:47 am
Location: Germany

Re: Project advice on using analog accelerometers with an ADC

Thu Sep 06, 2018 8:47 pm

Hi Ross,

what do you think is the advantage of using a Raspi with Linux OS? When doing real-time tasks with several hundred sps and a stringent timing, I would rather use a microcontroller and coding in C. You might want to take a look at STM32F303VC (discovery board) or similar. When using I2C SPI and such interfaces under Linux from a userland program, you will probably run into timing issues. The Rapsi might come in handy for processing, storing or visualizing the data.



Posts: 27
Joined: Thu Mar 15, 2018 10:22 pm

Re: Project advice on using analog accelerometers with an ADC

Fri Sep 07, 2018 8:13 am

Hi KnarfB

Up until last night i thought that the pi would be faster reading the ADC, I don't know if this COULD be true and if so by how much? This is why i asked for peoples inputs (thankyou for taking the time to reply)

This morning i did a little test using two arduinos (UNO and DUE) at two different baud rates and two different ADC sample rates to try learn what factors would be the most important.

I got up to 555Hz measuring the ADC, though only one analog input. I had a problem before of only achieving 180Hz when doing my dissertation, but now realise that might be more down to my programming as i didn't realise last year (as a complete and utter newbie) that i was using single shot mode, rather than continuous. As far as i can gather, i can either use continuous (drawbacks i don't know - todays reading), or single shot mode with the ALERT/RDY pin to check when the data is available. When doing my uni research i didnt use the ALERT/RDY pin and i dont know if that would effect the sample speed?

I was planning on using the pi more for speed of retrieving the data, but also i can do processing with the data straight away. Do you think i would be better using a microcontroller connected to the pi via SPI or I2C and then i can do my processing that way? Or ignore the Pi for inputs altogether and just use for processing afterwards?

Thanks for your time


User avatar
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: Project advice on using analog accelerometers with an ADC

Fri Sep 07, 2018 10:10 am

Your only ever as fast as your slowest bottle neck.

Most of these devices you have posted can be communicated by either I2C or SPI. Depending upon freq used SPI is usually 1000s of times faster than I2C.

My bet will be on the MPU9260 on being the fastest and most accurate. It is very much the current market leader in IMUs. I know the drones use mainly use the older MPU6050 because it was a little less accurate and read less vibrations from the spinning motors.

Some really good data here from a guy that has done a lot of testing ... sor-Fusion

and here is some data from the best IMU with hardware fusion to produce absolute heading ... MS-Sensors

Posts: 14
Joined: Sat Dec 16, 2017 4:33 pm
Location: Canada

Re: Project advice on using analog accelerometers with an ADC

Wed Sep 12, 2018 3:02 am

I'd break this up into two steps sensors&hardware vs software, assuming your University has a lab with digital storage oscilloscopes and arbitrary waveform generator.

1] Rule out software, If possible try connecting your accelerometers to an 2ch digital oscilloscopes. Use your scope to determine which accerometer works best, you could connect two different acc. at the same time to the 2ch scope and compare them to each other to determine which measures and works better in your application. Assuming you can attach both acc. to the same vibration at the same time so they see the identical input. Unless your an expert with accelerometer datasheets it can be easier to just try some as you suggest. Difference is use a scope to rule out any possible software problems.

2] Rule out hardware\sensors, using what is called an arbitrary waveform generator to generate a know signal instead of an unkown accelerometer's signal. This will generate a signal, depending on the type and how fancy it is you could simulate your accerometer expected signal and keep working on your software to make sure it works. You could create a sinewave or triangle wave and adjust the freq and see what your software does with a known signal which is easy to adjust [freq, shape and amplitude]. Increase the frequency and see how well you can sample the waveforms then you'll know your max bandwidth you can measure before it gets unacceptable.

3] after you determine the sensors are working as good as possible based on step#1 along with signal conditioner, bandwidth etc then try it with your software which you understand and trust from step#2's experiments. Then you can figure out your sample rate required based on the signal you captured on the scope in step 1.

Anti aliasing could be part of your problem, it usually is where I work. You need to sample the expected signal's max freq at least 2x as fast. Refer to Nyquist frequency in web searches to learn more. National Instruments has good hardware and software packages, perhaps look into this, they may offer special deals to universities, I find NI is popular choice with in automotive industries but it can be expensive.

Posts: 27
Joined: Thu Mar 15, 2018 10:22 pm

Re: Project advice on using analog accelerometers with an ADC

Mon Sep 17, 2018 5:53 am

Hi there

sorry for taking so long to reply. Thankyou for your inputs. I've made some enquiries and we do indeed have a signal generator, 2ch scope, and a constant frequency source. I know using a proffesional system would be better, and the 2D system i referred to in my first point is the market leader in race data collection with one logger costing £8000!!!

However, this has been more of a summer project to learn the C language as that is what i use in my calculations on matlab (C based). So part of all this is creating a system to learn. My plan eventually, depending on if my project idea changes is to model a motorcycle going round a racetrack mathematically, then measure using professional hardware and then build my own and compare the DIY vs professonal.

Thankyou for your help and i think Girtch27 i will be referring to this post a lot as an introduction to developing a working system that can be trusted.



Return to “Automation, sensing and robotics”