Better and faster Arduino analog sensor sampling - improve Stirling engine pressure wave measurement
My engines 5:32
5,641 views · 246 likes Watch on YouTube ↗
In this video I show you several ways to get better and faster analog measurements with an Arduino, using the special controller architecture and direct register manipulation.
Link to the Vcc compensation code and description: https://youtu.be/xI_qU2auVx8?feature=shared
To measure the pressure waves inside my new thermoacoustic Stirling engine, I want to use the MPX5010 analog pressure sensor with an Arduino UNO.
The measurements have to be as accurate and fast as possible because I want to use them to visualise the operating parameters on a test bench in order to improve the engine.
I would like to gradually improve the accuracy and speed of the analog measurements to see if the internal Arduino analog to digital converter ADC can meet my expectations.
All measurement results from the Arduino are validated with precise measuring devices.
For an initial test I directly connect the MPX5010 pressure sensor to the Arduino and display the measurements with the serial plotter.
Things are looking very good, but there are still a number of measures and improvements to be made to make the readings meaningful.
Any serious measurement system needs to be calibrated.
I use the relatively good internal 1.1 voltage reference to compensate Vcc for more accurate analog readings.
As I have an original Arduino UNO the Voltages Vref and Vcc are directly very accurate.
If you are using a cheap Arduino clone, Vcc is often much more variable and even Vref may not be as accurate.
A stable power supply from a battery or a stabilised lab power supply is much better and has less noise than USB, and the voltage regulator of Vin is much better than USB.
The next step is to check the sensor datasheet to see how to connect it correctly.
If necessary, decouple the supply and filter the output with an RC filter.
Many sensors have an offset which must be read from the datasheet or measured and compensated for.
I am already achieving very good results with all these measures.
If you need even more accurate readings or have problems with electrical noise, there are a few more ways to improve.
Use short cables and avoid cable loops
No serial communication, no interrupts, no timers, switch the Arduino in low noise (low power) mode
Sometimes there are external influences that affect the circuit, such as a powerful lamp etc.
Use an external voltage reference
Using the ADC free running mode may give more noise free results, I will discuss this later
If the accuracy is still not sufficient, you may need to use an external ADC such as the NCP3304 or ADS1115.
The correct interpretation of analogue measured values has been a very emotional discussion for many years in which I do not wish to take part.
I use the following formula, which in my opinion provides the best results:
The frequency of pressure oscillations in the thermoacoustic Stirling engine is quite high and the sampling rate must be increased to obtain accurate measurement results.
Data sampling at a constant rate is also very important and requires even higher speeds.
Serial communication is very slow, if possible it is much faster to buffer all measurements in the SRAM memory of the Arduino first and then process them further.
By default, the preset conversion rate of the ADC is set by a prescaler value of 128 in the ADCSRA register.
If you change it to 16, you can measure 8 times faster without losing much accuracy.
Another good option is to use ADC free running mode, where the ADC continuously converts the inputs and throws an interrupt at the end of each conversion.
This eliminates time wasted waiting for the next conversion and improves sampling accuracy with reduced jitter.
With the most important of these measures, I now get excellent results that meet my requirements.
I can now take care of the further construction of the entire test bench with several sensors and have confidence in the measurement results.
This will allow me to further optimise the thermoacoustic Stirling engine and hopefully achieve higher power outputs soon, which will be able to produce reasonable amounts of energy to support our domestic electricity supply.
As always I would be very happy for your comments and suggestions!
Thanks for watching.
Link to the Vcc compensation code and description: https://youtu.be/xI_qU2auVx8?feature=shared
To measure the pressure waves inside my new thermoacoustic Stirling engine, I want to use the MPX5010 analog pressure sensor with an Arduino UNO.
The measurements have to be as accurate and fast as possible because I want to use them to visualise the operating parameters on a test bench in order to improve the engine.
I would like to gradually improve the accuracy and speed of the analog measurements to see if the internal Arduino analog to digital converter ADC can meet my expectations.
All measurement results from the Arduino are validated with precise measuring devices.
For an initial test I directly connect the MPX5010 pressure sensor to the Arduino and display the measurements with the serial plotter.
Things are looking very good, but there are still a number of measures and improvements to be made to make the readings meaningful.
Any serious measurement system needs to be calibrated.
I use the relatively good internal 1.1 voltage reference to compensate Vcc for more accurate analog readings.
As I have an original Arduino UNO the Voltages Vref and Vcc are directly very accurate.
If you are using a cheap Arduino clone, Vcc is often much more variable and even Vref may not be as accurate.
A stable power supply from a battery or a stabilised lab power supply is much better and has less noise than USB, and the voltage regulator of Vin is much better than USB.
The next step is to check the sensor datasheet to see how to connect it correctly.
If necessary, decouple the supply and filter the output with an RC filter.
Many sensors have an offset which must be read from the datasheet or measured and compensated for.
I am already achieving very good results with all these measures.
If you need even more accurate readings or have problems with electrical noise, there are a few more ways to improve.
Use short cables and avoid cable loops
No serial communication, no interrupts, no timers, switch the Arduino in low noise (low power) mode
Sometimes there are external influences that affect the circuit, such as a powerful lamp etc.
Use an external voltage reference
Using the ADC free running mode may give more noise free results, I will discuss this later
If the accuracy is still not sufficient, you may need to use an external ADC such as the NCP3304 or ADS1115.
The correct interpretation of analogue measured values has been a very emotional discussion for many years in which I do not wish to take part.
I use the following formula, which in my opinion provides the best results:
The frequency of pressure oscillations in the thermoacoustic Stirling engine is quite high and the sampling rate must be increased to obtain accurate measurement results.
Data sampling at a constant rate is also very important and requires even higher speeds.
Serial communication is very slow, if possible it is much faster to buffer all measurements in the SRAM memory of the Arduino first and then process them further.
By default, the preset conversion rate of the ADC is set by a prescaler value of 128 in the ADCSRA register.
If you change it to 16, you can measure 8 times faster without losing much accuracy.
Another good option is to use ADC free running mode, where the ADC continuously converts the inputs and throws an interrupt at the end of each conversion.
This eliminates time wasted waiting for the next conversion and improves sampling accuracy with reduced jitter.
With the most important of these measures, I now get excellent results that meet my requirements.
I can now take care of the further construction of the entire test bench with several sensors and have confidence in the measurement results.
This will allow me to further optimise the thermoacoustic Stirling engine and hopefully achieve higher power outputs soon, which will be able to produce reasonable amounts of energy to support our domestic electricity supply.
As always I would be very happy for your comments and suggestions!
Thanks for watching.
Playback is via YouTube's official embedded player. Data from YouTube; Exumo is not affiliated with YouTube.