How to add up analogue inputs to average them?

  • Thread starter Thread starter Stonestreecty
  • Start date Start date
  • Tags Tags
    Average
AI Thread Summary
To average readings from an ACS712 sensor, it is recommended to take multiple samples (e.g., 20), sum them, and then divide by the number of reads for a smoother output. Using a block average or a running average with a ring buffer can help reduce noise and improve accuracy. It is suggested to read samples in groups of 16 to simplify division and further decrease noise. Concerns were raised about the appropriateness of certain application circuits and the use of inverting op-amps for signals within a 0V to 5V range. Overall, the discussion emphasizes the importance of averaging techniques and proper circuit design for effective sensor data processing.
Stonestreecty
Messages
20
Reaction score
3
TL;DR Summary
How read a sensor (acs712) a number of times, add them all up, then divide them by the number of reads?
Hi,
I would like to read a sensor (acs712) a number of times (20), add them all up, then divide them by the number of reads. So I can get an average. to give me a sort of analogue "debounce". Am I guessing the sum function?

I sincerely appreciate any advice you can all give me, I'm incredibly excited about learning all of this! Many thanks.
 
Computer science news on Phys.org
Stonestreecty said:
Summary:: How read a sensor (acs712) a number of times, add them all up, then divide them by the number of reads?

I would like to read a sensor (acs712)
Some of the application circuits at your blog seem strange/wrong. Did you do the schematics or did you get them from somewhere. If the latter, where did you get them? Like this one for example looks wrong to me at first glance:

1616168876106.png


Stonestreecty said:
Summary:: How read a sensor (acs712) a number of times, add them all up, then divide them by the number of reads?

a number of times (20), add them all up, then divide them by the number of reads.
It makes it faster if you add up 16 or 32 of them before doing the division. Can you say why?
 
I agree with @berkeman, read it 16 times to make division easier, and to reduce the noise by a factor of √16 = 4.
If the bandwidth is 80 kHz then you must select a slow A-D converter, or wait about 15 μsec between reads. 16 conversions will then take 200 μsec.
 
I presume that you're talking about software, not hardware, to do the average. So coding the different ways of doing it could be instructive.

You could do it as a block average: organize into blocks of 16, take the average of each.

You could do it as a running average: with each new sample, compute the average of the most recent 16. Consider using a ring buffer for the running average.

You could do it not an average, but rather as a stream of samples through a low pass filter. How would you implement a filter as opposed to an average?
 
Tom.G said:
That happens to be Application 3 on pg. 12 of the Allegro datasheet.
Thanks Tom, that helps. I still don't understand why they would suggest using an inverting opamp to amplify a signal that runs between 0V and 5V...

1616246291174.png

I guess you could just invert the readings from your ADC, but why not just use a non-inverting opamp configuration?
 
I came across a video regarding the use of AI/ML to work through complex datasets to determine complicated protein structures. It is a promising and beneficial use of AI/ML. AlphaFold - The Most Useful Thing AI Has Ever Done https://www.ebi.ac.uk/training/online/courses/alphafold/an-introductory-guide-to-its-strengths-and-limitations/what-is-alphafold/ https://en.wikipedia.org/wiki/AlphaFold https://deepmind.google/about/ Edit/update: The AlphaFold article in Nature John Jumper...
Thread 'Urgent: Physically repair - or bypass - power button on Asus laptop'
Asus Vivobook S14 flip. The power button is wrecked. Unable to turn it on AT ALL. We can get into how and why it got wrecked later, but suffice to say a kitchen knife was involved: These buttons do want to NOT come off, not like other lappies, where they can snap in and out. And they sure don't go back on. So, in the absence of a longer-term solution that might involve a replacement, is there any way I can activate the power button, like with a paperclip or wire or something? It looks...
Back
Top