Rotary Encoder Tutorial with Arduino Code

All code up on site and encoder used:
http://www.kevindarrah.com/?page_id=1348

Duration : 0:26:5



Posted

in

by

Comments

25 responses to “Rotary Encoder Tutorial with Arduino Code”

  1. kdarrah1234 Avatar
    kdarrah1234

    ha,? oops! thanks!
    ha,? oops! thanks!

  2. Chowmix12 Avatar
    Chowmix12

    at? 11:20, you …
    at? 11:20, you rewrote the same exact thing -_-
    Nice tutorial though, thanks!

  3. kdarrah1234 Avatar
    kdarrah1234

    yes, or figure out …
    yes, or figure out a way to ‘lock’ the encoder when the power is off. That way you can simply write the last position into the EEPROM, and read it back on power up.? ABsolute encoders can be expensive…

  4. zinkws Avatar
    zinkws

    BUT @24:29…. you …
    BUT @24:29…. you said that with incremental? encoderes, you can not know the absolute position of something. In my particular case. I need it but only payed atention to this detail on this part of the video.

    So, what do you recomend to solve this? Absolute encoders?

    bye…

  5. zinkws Avatar
    zinkws

    Very? nice …
    Very? nice presentation. I really enjoy this video. The aproach that you used in your code is very good. I am porting it right now to another C compiler because I play with PICs, not the arduino.

    But I have one question. First the scenario: I have a box with water inside. This box have a wheel that spin write (just a line) on a paper the level of the fluid inside.

    So I need to digitalize this box/machine. First I thought about encoders and came here and watch your video. OK…..

    BUT @24:29….

  6. kdarrah1234 Avatar
    kdarrah1234

    hmmm, I would use …
    hmmm, I would use mills() or micros() to to measure pulse widths to get velocity, and maybe even? average the velocity… you just need to mark the time from mills() and the next transition time, and bingo! you’re done! Glad the code worked for you!

  7. RTSproductions1 Avatar
    RTSproductions1

    I used your code …
    I used your code with a DC motor with quadrature encoder.

    It works! I get pulses and also implimented some code to get time.

    The problem I’m having is when I try to impliment code to calculate velocity….I get zero result or stops the code from functioning.

    Is there a way to send you my code for some help understanding what? I’m doing wrong?

    Thanks

  8. nyehnyi Avatar
    nyehnyi

    NICE? VOICE
    NICE? VOICE

  9. kdarrah1234 Avatar
    kdarrah1234

    yea, that? would’ve …
    yea, that? would’ve been cool to do for the video!

  10. bagatelox Avatar
    bagatelox

    It’s funny to …
    It’s funny to discover how encoder works by using two multimeters with continuity beeps. You? hear one multimeter after other making beeps in one direction, and the reverse in the other direction.

  11. superfunny1972 Avatar
    superfunny1972

    Thank? you!
    Thank? you!

  12. kdarrah1234 Avatar
    kdarrah1234

    interesting? …
    interesting? concept! thanks for the info

  13. sebucristi Avatar
    sebucristi

    2 interrupts are …
    2 interrupts are the limit, but theoretically you could add more to the arduino. the chip supports more. You? also could add pin a of one encoder ti int0 and the pin a of the second encoder to int1, so if int is changes you check pin b on the encoder and then you know in which direction you go. This would also need a debounce circuit.

  14. kdarrah1234 Avatar
    kdarrah1234

    awesome question!!? …
    awesome question!!? I would make some kind of selection circuit that listens for one of the encoders to rotate, then start a timer to ‘wait’ for that encoder to finish, then resume listening to them all. it would be a fairly complex scheme, guess thats a limitation of the arduino… only 2 interrupts

  15. sebucristi Avatar
    sebucristi

    Hi, very …
    Hi, very informative. What if i need 2 or 3 encoders? How do i write the code for? the interrupts in arduino? Thank you.

  16. R2D2internet Avatar
    R2D2internet

    Thanks! Very …
    Thanks! Very useful? and really well explained!

    But I think that .01 uF is 103, not 102 🙂

    and by the way, there’s a constant for pi in processing

  17. kdarrah1234 Avatar
    kdarrah1234

    thanks!! more? …
    thanks!! more? coming….

  18. shebotnov Avatar
    shebotnov

    wow very …
    wow very informative. Its like watching a very interesting lecture. Thanks. Do more? vids =)

  19. kdarrah1234 Avatar
    kdarrah1234

    yes!! glad it? …
    yes!! glad it? helped!

  20. pcuser80 Avatar
    pcuser80

    Perfect video? …
    Perfect video? Thanks, i learnt a lot…..

  21. WeAreTwoDoorsDown Avatar
    WeAreTwoDoorsDown

    Yeah… In reality …
    Yeah… In reality, it’s? not even very usefull…

  22. kdarrah1234 Avatar
    kdarrah1234

    yep, I still can’t …
    yep, I still can’t believe I? bought it…

  23. WeAreTwoDoorsDown Avatar
    WeAreTwoDoorsDown

    95? bucks for that …
    95? bucks for that thing… yeah, you’re mode dedicated than me.

  24. kdarrah1234 Avatar
    kdarrah1234

    haha, I know. …
    haha, I know. sometimes it takes that long for me to get inspired to do anything, or in this case, I was waiting for my shopping cart at sparkfun to get filled up before checking out… always hate spending all that money for shipping on a part that cost? 5 cents… I guess the geiger tube pushed it over

  25. kdarrah1234 Avatar
    kdarrah1234

    thanks!! there’s …
    thanks!! there’s more on the? way…

Leave a Reply