Simple data smoothing for Arduino

Поділитися
Вставка
  • Опубліковано 31 бер 2021
  • Using averages and loops
  • Розваги

КОМЕНТАРІ • 19

  • @cloviscareca
    @cloviscareca 2 роки тому +6

    Just be aware of integer overflow. An int can only store up to # 32k.
    If you wanna make more samples, use a long data type inside the looping for() in data average variable.

  • @prasadadavi6618
    @prasadadavi6618 Рік тому

    Thank you. I was actually looking for a way to smooth out the signal from MPU 6050. Thanks again 🙏

  • @delugeia
    @delugeia Рік тому +3

    You could also have a trend average... take 75% (or something) of the past and 25% (100% - past) of the last reading. Set the initial value to the first reading so you don't start at zero. You can change the percentages to change how much "spike" you want. E.g.
    static long sensorAverage = analogRead(PIN);
    sensorAverage = 0.75 * sensorAverage + 0.25 * analogRead(PIN);

  • @helander123
    @helander123 4 місяці тому

    Thank you for your video! This was very helpful for my project!

  • @KW-ei3pi
    @KW-ei3pi 3 місяці тому

    Excellent information. Thank you.
    I think this will help me with coding linear acceleration for a stepper motor.

  • @redhaali6847
    @redhaali6847 2 роки тому

    thanks this was simple and helpfull

  • @estebanfm7940
    @estebanfm7940 Рік тому

    thank u sooo muchh!!!

  • @AnthonyBerg
    @AnthonyBerg Рік тому

    Thaaaaaaaankkkkkkk yoooooooouuuuuuu!

  • @irfan00750
    @irfan00750 2 роки тому

    thanks!

  • @thelazycat_
    @thelazycat_ 2 роки тому +1

    I only get once every 10 readings a number, and it is not the avg of the reading. have the same code so don't know what is wrong?

  • @cryptoBTCzone
    @cryptoBTCzone 2 роки тому +1

    Thanks for the video,
    Kindly assist with arduino code to do this linear regression equation: y=(8*10^-5)x^2+0.1873x+46.131.
    x is the analog output of the sensor to give an output y, but x is the average of 200 analog samples(x)

  • @abdullahalsaid9543
    @abdullahalsaid9543 2 роки тому

    nice

  • @mrkunalgoswami2010
    @mrkunalgoswami2010 2 роки тому

    how to get mean of that signal ?

  • @rohitverma905
    @rohitverma905 2 роки тому +2

    What to do for digital input??

  • @grzesiekxitami3264
    @grzesiekxitami3264 2 роки тому

    update( new ) {
    static A[ N ] ={ 0 }
    static sum = 0
    static p = 0
    sum = sum - A[ p ] + new
    A[ p ] = new
    p = (p + 1) % N
    return sum / N }

    • @kabzebrowski
      @kabzebrowski 2 місяці тому

      is this what I'm trying to code (and failing)? let's say we want 10 readings to avg from. we keep a number 'sum' on which we add the newest readings to, remove the 10th/oldest readings, then 'sum/10' will give a new avg'd value to output. is that it?

  • @KIXEMITNOG
    @KIXEMITNOG 2 роки тому

    1 April

  • @nata_rian
    @nata_rian Рік тому

    code please sir