Code Monkey home page Code Monkey logo

circuitpython_rangeslicer's People

Contributors

cedargrovestudios avatar tekktrik avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

mmartinortiz

circuitpython_rangeslicer's Issues

Question: How is the RangeSlicer different to a Scaled value?

Hi,

After I heard you at the CircuitPython podcast talking about this library, and it got me thinking about a little project of mine. I'm tinkering with an old Wheel controller from the 90s—just a couple of potentiometers and a bunch of buttons. When I first tackled the project, I scaled the potentiometer values between -127 and 127 based on their min and max readings. But, just like you mentioned in the podcast, the potentiometer noise started messing with my values.

I've been playing around with the library for a few days now. To get a handle on things, I collected data on registered values for 50 reads without touching the potentiometer. Check out the results below:

  • slice: Value of the slice argument.
  • hyst: Value of the hyst argument
  • avg_slicer: Average value returned by the range_slicer method.
  • avg_scaled: Average value resulted of directly scaling the potentiometer value
  • avg_slicer_diff: Average absolute difference between two consecutive values returned by the range_slicer method
  • avg_scaled_diff: Average absolute difference between two consecutive scaled values
slice hyst avg_slicer avg_scaled avg_slicer_diff avg_scaled_diff
0 1 0.15 13.6 12.88 0.76 1.24
1 1 0.25 13.5 12.88 0.84 1.34
2 1 0.5 13.38 13.08 0.78 1.2
3 1 1 13.7 13.02 0.8 1.12
4 1 2 14.7 12.88 0.7 1.2
5 1 4 16.6 13 0.92 1.28
6 1 8 20.54 13.06 0.96 1
7 2 0.15 14 12.86 1.1 0.98
8 2 0.25 13.12 12.82 0.58 1.08
9 2 0.5 12.8 12.88 0.54 1.12
10 2 1 14.08 12.94 1.34 1.02
11 2 2 16 12.86 1.18 1.18
12 2 4 20.04 12.9 1.38 1.14
13 2 8 27.68 12.9 1.58 1.08
14 4 0.15 13 12.74 0.26 1.1
15 4 0.25 13 12.82 0.26 1.22
16 4 0.5 12.68 12.8 0.74 1.22
17 4 1 13 12.8 0.26 1.28
18 4 2 17 12.96 0.34 1.12
19 4 4 25 12.98 0.5 1
20 4 8 41 12.78 0.82 1.32
21 8 0.15 11.72 12.88 3.54 1.14
22 8 0.25 9 13 0.18 1.32
23 8 0.5 9 12.84 0.18 1.08
24 8 1 17 12.84 0.34 1.28
25 8 2 24.84 12.96 0.66 1.32
26 8 4 40.52 12.78 1.62 1.08
27 8 8 72.68 13.2 2.1 0.78

Looking to the data, I get the following conclusions:

  1. The value of slice changes the output value scale without an impact in the noise.
  2. The hyst value plays a bigger role in the sliced value. Values below 1 get me results closer to a regular scale.
  3. RangeSlicer produces less noise.
  4. There is not direct relation between values of slice and hyst, and the noise produced.

When do you think it's smarter to go with RangeSlicer instead of the usual scaling method or a filter? Would you have some tips for selecting a good slice and hyst?

data.csv

Best,
Manuel

Build CI failed

Happened to notice you updated this library on my feed, and saw that the latest build failed. Happy to dig into it and fix it, if you'd like - I'm trying to find common issues and their solutions so I can eventually document them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.