Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#ASP.NET
Hi,
 
I am working on Fuel Level Sensor module. We have a Fuel Level Sensor which is dipped into the fuel tank. The sensor sends the update in each 10 seconds. The volt varies from 0 to 5, wherein 0 means 'Fuel tank is Empty' and 5 means 'Fuel tank is Full'.
Currently I am working on to stabilize the voltage that I am receiving from the sensor. Since there is a lot of fluctuation happening while the vehicle is moving, I am not able to stabilize the graph.
 
Currently I am getting the graph in the following manner:
Current Graph
 
But I want the graph something like this:
Required Graph
 
I want to remove the fluctuation happening in the 1st graph.
Below is the data that I am receiving. Please download and open it in MS Excel 2007.(Trust me it is not a virus.)
Download Excel File
 
Please help.
Looking ahead for a helpful logic.
 
Thanks in Advance.
Linto.
Posted 4-Feb-13 20:30pm
Edited 4-Feb-13 20:32pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use a moving average: it sums the last "N" points and gives the average of those, rather than using the datapoints directly. You will still get some fluctuation, but it should be minimised, and you will probably need to play with the sample size to get the right "damping" factor.
 
BTW: If you want to show people "before" and "after" pictures, try to make sure that you use the same dataset, or at least similar - your two examples don't even use the same timescale!
  Permalink  
Comments
linto_11 at 5-Feb-13 3:14am
   
Thanks for your reply. The Graph 1 image is exactly drawn from the values of the dataset but Graph 2 is the imaginary one. I have implemented the averaging logic, but still the i receive fluctuations. Can you please help me in finding out the "damping" factor?
OriginalGriff at 5-Feb-13 3:30am
   
You will get fluctuations - the fun is getting it to the point where they are acceptable. Try doubling your sample size then try at half the difference: So if your original was 100, look at what you get for 200, then 150. Try to keep it as small as possible - otherwise it will start to negatively impact the rise speed when you refuel. Look at the fuel gauge in your car - it suffers from the same problems. It rises slowly when you fill it, because it is heavily damped to prevent sloshing on cornering, braking etc. showing up too immediately on teh guage.
linto_11 at 5-Feb-13 3:57am
   
Thanks, I'll try to implement the same and update you. Thanks Griff.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 840
1 OriginalGriff 407
2 Abhinav S 303
3 Manas Bhardwaj 285
4 thatraja 210
0 Sergey Alexandrovich Kryukov 7,967
1 OriginalGriff 4,332
2 Peter Leow 3,699
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 5 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid