Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4118130
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:55:15+00:00 2026-05-20T22:55:15+00:00

Reading a battery voltage in an embedded device. However, the actual voltage varies greatly

  • 0

Reading a battery voltage in an embedded device. However, the actual voltage varies greatly depending upon system load. We need a method to reduce the fluctuation of the voltage to display the best value.

Currently, we’re using a rolling/moving average. However, over the last 15 readings, the result still fluctuates too much.

In reading about smoothing algorithms, it appears that b-splines, kernel filters, or some other smoothing algorithms would be ideal. However, I can’t find a simple example that doesn’t use numpy or intrinsic functions within mathcad or some such.

Anybody know of a simple-to-implement function that could help with this? This is a C++ project (using Qt 4.5) with just the bar minimum of libraries. I’d prefer to stay in the integer domain (showing the voltage in millivolts from 3300-4200).

TIA
Mike

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:55:16+00:00Added an answer on May 20, 2026 at 10:55 pm

    Well, it’s a bit tough to tell what you need without specifics on your situation. For example, what is your sensor sampling rate, and how is the sensor fluctuation and noise that you’re trying to remove characterized?

    However, if you already have moving average implemented, I might recommend trying a moving median instead. (Median of the last n samples, rather than average.) This will tend to reduce the impact of large short-term aberrations from normal from your output.

    If you can find parameters that work, it would be preferrable for CPU and memory requirements to use some form of a discrete-time low-pass filter. These are quite easy to implement, and only require knowledge of the previous output value and the current input to compute the current output. For example:

    Y = Y[n-1] + A * (X - Y[n-1])
    

    (Where Y is the current output, Y[n-1] is the last computed output, and X is your latest sensor reading.)

    A is effectively the time constant of the low pass filter, but it’s discrete time, so it depends on the sampling rate. Specifically, A = dt / tau, where dt is your sampling period in seconds, and tau is roughly analagous to the continuous-time time constant.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A method which can be used for finding the battery percentage of your device
Reading through the SendAsync , BeginAsync method illustrations of Socket s, I realized that
Reading about the lack of persistence ignorance in Entity Framework I often stumble upon
I was reading how to get the temperature of the battery and I make
Reading this post here on stackoverflow want to load a different css when compiling
Reading about the Dispose pattern , I see the documentation repeatedly refer to cleaning
Reading some questions here on SO about conversion operators and constructors got me thinking
Reading among the list of possibilities of the Java ME platform, its possible for
reading the documentation for java org.w3c.dom.ls it seems as a Element only can be
Reading some posts from Jimmy Boggard and wondering - how exactly is it possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.