Connecting Rotary Incremental Encoder with arduino

Поделиться
HTML-код
  • Опубликовано: 5 сен 2024
  • Hello guys in this video I'll show you how to connect Incremental rotary encoder with arduino to get raw data
    complete tutorial : electricdiylab...
    My encoder :- robu.in/produc...
    Code :- drive.google.c...
    💻visit for more projects :-
    👉electricdiylab....
    👉FB page :- / innovativemr This video is made for entertainment purposes only. Please use judgment, care, and precaution if you plan to replicate. WhatsApp for custom projects +91 7600079068

Комментарии • 145

  • @poSombre
    @poSombre 5 лет назад +8

    It was so helpful.
    I have a scholar project with some partners, so we tried to connect and Encoder with a PLC Siemens s71200, but it wasn't working so we thought that the Encoder was the reason, but with your tutorial i tested it and it was working, so you save me some money and time.
    So much tanks!!!

    • @beladjinedjameleddine6837
      @beladjinedjameleddine6837 4 года назад +1

      please did you find the code ??? because I can't find it in the link given in the description, so would you please send it to me to this mailbox cause I need it very urgent.
      and thank you in advanced

  • @MrJovanotti
    @MrJovanotti 3 года назад +8

    Hello Sir,
    Can you please re upload the code?
    It looks like the link in the description, is no longer valid.
    Tnak you.

  • @MultiNasih
    @MultiNasih 3 года назад +1

    very good and informative video, thank you sirrrrrr

  • @jaimezuleta8125
    @jaimezuleta8125 3 года назад

    Excellent Work. Greetings from Venezuela.

  • @flcreations
    @flcreations 3 года назад +3

    Q: how precise is this thing? I mean if you notice your original "zero" angle, then do a dozen of rotations in some direction; when you rotate back to 0, are you still on your "zero"? Thanks!

    • @olevester
      @olevester Год назад

      yes

    • @Raju-ut6bj
      @Raju-ut6bj Год назад

      Yes , if you use low ppr encoder.
      No, if you use high ppr encoder.
      This cheap kind of encoder will never back to zero in any condition. Use kubler or omron encoder .

  • @MrDante195
    @MrDante195 3 года назад

    Thanks brother it helps me alot.

  • @Scott.Farkus
    @Scott.Farkus 4 года назад +3

    Sorry, the file you have requested does not exist.

  • @modellerdesign
    @modellerdesign 4 года назад +3

    You should also have 50-220ohm pull up resistors from 5v to AB channels connected additionally, with many encoders to work properly.

  • @watahyahknow
    @watahyahknow 4 года назад

    i need this encoder to rotate a stepper motor in an offset ratio (like with a gearbox) that i can adjust allmost infenitely ) how do i do this ?
    i need it to drive a hone up and down in the bore at an exact crosshatch
    the encoder will be fitted to the hone motor and as soon as that spins it should start turning the steppermotor driving the hone up and down at the right distance (movement up down ) to degree of rotation /full rotation (hone spinning in the bore )
    it basicly needs to put the stones on the hone in the same groove in the cilinderwall the whole time while it spinning at 100 rpm like its on rails

  • @Microfiom35
    @Microfiom35 Год назад

    Hi I have a question how to control a stepper motor by encoder ?

  • @klausschneider6421
    @klausschneider6421 3 года назад

    Meine respektierung! Gut gemacht!

  • @maiconjione2797
    @maiconjione2797 Год назад

    Congratulations on the video. Would it be possible to help me with a doubt? How can I convert this information into millimeters? like a digital ruler?

  • @amrindersingh6618
    @amrindersingh6618 5 лет назад +1

    Hello👋, If your encoder is having 400ppr than how it is able to give reading 1900+ within one revolution???

  • @abdallahdjelal1145
    @abdallahdjelal1145 5 лет назад +1

    Top...great work

  • @SergeyRoyz
    @SergeyRoyz 5 лет назад

    Could you tell which screws did they send you? I have a similar product but with no screws and M3 seems do not match. Thanks!

  • @rahulpatil5948
    @rahulpatil5948 2 года назад

    sir how to send rotary encoder data to thingspeak.. sir please make a video

  • @racingaddict3719
    @racingaddict3719 Год назад

    Great vídeo! Does that code work with arduino Leonardo instead of arduino uno?

  • @ahmetselim1166
    @ahmetselim1166 2 года назад

    did you use resistors

  • @electronic7979
    @electronic7979 5 лет назад

    Useful video 👍

  • @PunxTV123
    @PunxTV123 2 года назад

    whats the use on the resistor you bought?

  • @saminsiddiquee2059
    @saminsiddiquee2059 3 года назад

    good job. clear

  • @erkamarslan3227
    @erkamarslan3227 3 года назад +1

    Is it possible to have a design that will allow the incremental encoder to act like an absolute encoder?

  • @y0Milan
    @y0Milan 3 года назад

    My encoder count value is increasing wether I turn it clockwise or anticlockwise, any advice please?

  • @liviamaharaniseptiani
    @liviamaharaniseptiani 3 года назад +1

    Hello, do you know how to calibrate incremental encoder for velocity measurement?

    • @olevester
      @olevester Год назад

      u can use the time function (for Arduino 'millis();')for a sample of time and sample difference for the crude value of velocity

  • @AhmadEBakry
    @AhmadEBakry 2 года назад

    My encoder is sending data to the Arduino while i am no rotating the shaft, can you help me please?

  • @AORD72
    @AORD72 2 года назад

    Many thanks.

  • @mohdarshad1321
    @mohdarshad1321 5 лет назад

    Please upload a video on under ground wire fault detection

  • @muratcanbarut64
    @muratcanbarut64 3 года назад

    hello, how can we reset the screen can we put a button = and where ? can we put a screen ? thank you so much.

  • @thefirstoct
    @thefirstoct 4 года назад +9

    Could you send me your codes? I cannot open your Google drive.
    Thanks.

    • @BilalKhan-do9il
      @BilalKhan-do9il 3 года назад

      You wil get it on robu.in under tutorial section! Just search optical encoder with arduino over there

  • @uchungnguyen1474
    @uchungnguyen1474 4 года назад

    why you connected to d pins? its supposed to connect to analog pins, i'snt it?

  • @craftzars
    @craftzars 4 года назад +1

    maybe you know where i can find code how to control stepper motor with this encoder?

    • @hornbill502
      @hornbill502 3 года назад

      Are you find the code now?

    • @craftzars
      @craftzars 3 года назад

      @@hornbill502 nop, put project in shelf for later. Funny how you ask, because exactly 1 week ago got need for this project again. This time i will pay some programmer on fiver to do job, because i have no time for search/learn this stuff.

    • @hornbill502
      @hornbill502 3 года назад

      @@craftzars because i have same problm with you, i can't find the code of this stuff

    • @craftzars
      @craftzars 3 года назад

      @@hornbill502 hi, do you found something?

  • @farhanbadru3671
    @farhanbadru3671 3 года назад

    can it use for keyboard arrow commad?

  • @lyricalmusicstation2498
    @lyricalmusicstation2498 5 лет назад

    Nice bhaiya

  • @ghostedsum9870
    @ghostedsum9870 2 года назад

    Hey, i have an omron incoder (E6B2-CWZ5B) with a 3 wires ( A B Z) what is Z used for and how do i connect it

  • @yassinelemallem6712
    @yassinelemallem6712 3 года назад

    Please how to make net fishing with andruino

  • @ashleyhouse9690
    @ashleyhouse9690 4 года назад

    Code not available now and not on your website either. Would have been at least something if you could have shown the whole sketch scrolling down in the video.

  • @NedSar85
    @NedSar85 3 года назад

    HOw does it gets installed in a motor?

  • @leili4315
    @leili4315 5 лет назад

    Its great,I love it,would u show me the else program?thanks

  • @pratikanandpara8594
    @pratikanandpara8594 3 года назад

    is it possible with Raspberry pi with rotary encoder?

  • @vikaspanse2105
    @vikaspanse2105 6 месяцев назад

    Thank you

  • @iltonrotta
    @iltonrotta 4 года назад

    If I want to use this same encoder to measure lenth of a piece, what is the conversion /configuration to show me in meters ? thank you

    • @cmblcdoe6669
      @cmblcdoe6669 4 года назад +2

      Trivial. Your encoder will be attached to a wheel that will turn as the measurement is taking place. The encoder will only give you a count of pulses as it revolves. If your encoder is a 600 pulses per revolution, and the encoder is attached to a 3" diameter wheel, it's a trivial matter to calculate the distance moved per pulse in whatever units you want to know.

  • @michalgazdik2957
    @michalgazdik2957 3 года назад

    do you have the code to connect to the lcd display with this type of encoder?

  • @mazatrolmultiplex1113
    @mazatrolmultiplex1113 3 года назад

    Why the number is not in order sometimes the same sometimes skipping

  • @galvanaut7119
    @galvanaut7119 3 года назад +1

    What are the resistors for?

    • @Raju-ut6bj
      @Raju-ut6bj Год назад +1

      Pull up . Removing floating voltage which cause debounce.

  • @madhavnarayan6297
    @madhavnarayan6297 5 лет назад

    Any idea of how to count number of rotation , as its not working on high rpm.

  • @vipinpachouri4766
    @vipinpachouri4766 2 года назад

    How to do this without using interrupt pins?

  • @tardraker4631
    @tardraker4631 4 года назад

    I have a problem, my encoder only goes up but does not go down, why is that happening?

  • @nbdt9406
    @nbdt9406 3 года назад

    Hello, Mr Innovative,
    I uploaded this code on my arduino uno and it works perfectly!
    But when I uploaded it on my arduino mega 2560, it didn't work at all...
    I saw the values rising from 0-10000 in 2 seconds, there might be a big problem on the arduino mega..
    Can you help me??
    Thx

  • @tamer181818
    @tamer181818 5 лет назад

    did you had the chance to test it with higher rpm (motor....1500 rmp)? do you think we can use it to measure motor speed?

  • @farizakhdan6445
    @farizakhdan6445 3 года назад

    Amazing! altho i am wondering how do you convert those data to degree

  • @Cassinhodc
    @Cassinhodc 2 года назад

    Hello Friend. can you tell me why my rotary encoder is only counting from 0 to 127.... ?

  • @balajisekar2071
    @balajisekar2071 3 года назад

    How to connect two or more encoder to Arduino

  • @jerryhutchinson8367
    @jerryhutchinson8367 2 года назад

    tried to get code but it doesnt exist can you help ? really nice project bud

  • @serg_tolstiy87
    @serg_tolstiy87 5 месяцев назад

    Спасибо!

  • @SajjadHematiNourani
    @SajjadHematiNourani 2 года назад

    how can I do this in raspberry pi?

  • @ButilkaRomm
    @ButilkaRomm 4 года назад

    Hi, But would it work if you connect it to a high RPM motor ?

    • @cmblcdoe6669
      @cmblcdoe6669 4 года назад

      It depends on your definition of "high". you can write some test code to calculate the maximum speed your microcontroller can handle. If you're also trying to drive a stepper motor from the information gained from the encoder, you'll probably have to handle acceleration and deceleration or the stepper motor will "hang" due to missed steps.

  • @muratcanbarut64
    @muratcanbarut64 4 года назад

    super thanx

  • @islamdib9663
    @islamdib9663 3 года назад

    le fichier que vous avez demandé n'existe pas.
    le code n'existe pas, es ce que vous pouvez le partager à nouveau

  • @deejayrcaine
    @deejayrcaine 4 года назад

    Hi, thank you for this tutorial.
    Your google drive file with the code doesn't exist anymore, can you upload it please ?

    • @billwilde8725
      @billwilde8725 4 года назад +2

      The code is listed in the first link he gives under 'My encoder'

  • @38delphy
    @38delphy 5 лет назад

    Excellent video and very good tutorial.
    Can you make a video of this project to order an engine step by step?
    Thank you.

  • @highfacility9200
    @highfacility9200 3 года назад

    Oh he has secret code :D

  • @hashimiqbal6822
    @hashimiqbal6822 5 лет назад +1

    how would u add more than one to same board

    • @caffeinatedinsanity2324
      @caffeinatedinsanity2324 4 года назад

      You could use pin change interrupts. However they're bit harder to work with.

  • @wasifislam5191
    @wasifislam5191 5 лет назад

    I am using 1024ppr encoder and it is not working in high speed even for 100 r.p.m

  • @deeepakkushwah2503
    @deeepakkushwah2503 3 года назад

    Can you please help me to make a code for dmx stapper motor with encoder

  • @user-qr7rh9yo1s
    @user-qr7rh9yo1s 3 года назад +5

    #define ENC_A 2 // encoder a
    #define ENC_B 3 // encoder b
    #define BTN_A 5 // key reset
    volatile int encCounter;
    volatile boolean flag, resetFlag, keyPressed;
    volatile byte curState, prevState;
    volatile float GRD = 0;
    void setup() {
    Serial.begin(115200);
    //super speed, 1800 tic on round
    attachInterrupt(0, int0, CHANGE);
    attachInterrupt(1, int1, CHANGE);
    pinMode(BTN_A, INPUT_PULLUP);
    digitalWrite(BTN_A, HIGH);
    prnlcd();
    }
    void int0() {
    encTick();
    }
    void int1() {
    encTick();
    }
    // reset algoritm for Ярослава Куруса
    void encTick() {
    if (abs(encCounter) == 1800) encCounter = 0;
    curState = digitalRead(ENC_A) | digitalRead(ENC_B)

    • @user-os1xg1rh4c
      @user-os1xg1rh4c 2 года назад

      Сергей, а есть что-нибудь под esp8266 ? arduino дохнет при больших оборотах.

    • @user-qr7rh9yo1s
      @user-qr7rh9yo1s 2 года назад

      @@user-os1xg1rh4c Под stm32 есть, я использую stm32f103, два енкодера на 3600 импульсов на оборот, нормально работают.

  • @DarshanRayate1
    @DarshanRayate1 5 лет назад

    👍🙂 where to use it?

  • @dreamsolution
    @dreamsolution 5 лет назад

    thank you~

  • @indianmaker1805
    @indianmaker1805 2 года назад

    where is stepper motor

  • @kafklatsch3198
    @kafklatsch3198 4 года назад

    this is not really incremental, it appears to be absolute. I would like to see an incremental such that it could rotate many times and just shows that information. it would not matter where the incremental encoder was positioned when it started, it would still register the motion when sensed. I don't think that can happen with the video here. it looks limited to a single revolution and absolute position

    • @rossherman4515
      @rossherman4515 4 года назад

      This code will just count up for as long as the encoder is turned in one direction, and will count down when going in the other direction.

    • @kafklatsch3198
      @kafklatsch3198 4 года назад

      Ross Herman if you turn it off and back on will it start from zero and count up or down from the new zero point?.. if so then you are 100% correct

    • @rossherman4515
      @rossherman4515 4 года назад

      Yes if you switch off and then on it will start at zero again. That said, I can't get the code to work that he shared. My encoder is a 1024ppr but that should not change the function.

  • @grindel80
    @grindel80 5 лет назад

    What is the use for This device, sir?

  • @mouneeshellur8156
    @mouneeshellur8156 2 года назад

    can u keep the code of the encoder

  • @josemariaesandra
    @josemariaesandra Год назад

    No more CODE. The CODE is missing.

  • @mouneeshellur8156
    @mouneeshellur8156 2 года назад

    can u send the code of encoder

  • @BlackPaoPao
    @BlackPaoPao 4 года назад

    Where are 4 Resistors 4,7kOhm?

  • @abdelrhmanel-gharabawy8740
    @abdelrhmanel-gharabawy8740 3 года назад

    i need the code please

  • @22EsoxLucius
    @22EsoxLucius 5 лет назад

    Can this be used as a spinner for arcades? If it can, whether and how it can connect to RaspberryPie? Thanks in advance!

  • @nikosgeorgakis6759
    @nikosgeorgakis6759 4 года назад

    Hello! How many encoders can you connect on this arduino?

  • @SuperEye2eye
    @SuperEye2eye 4 года назад

    does this reset position every time you power it up? could be used to know the position of a stepper reliably every time you power up the robot? or do you need to calibrate the position then figure it out from there each time it starts up. thanks

    • @MrInnovative
      @MrInnovative  4 года назад

      Position value get reset at every startup

  • @user-pp9gs8sx7g
    @user-pp9gs8sx7g 4 года назад

    Code not have ,,,

  • @NelsonGonzalez96
    @NelsonGonzalez96 4 года назад

    somebody can help me? i need the code, and the link is down

  • @fatihserbes778
    @fatihserbes778 4 года назад

    code is gone.

  • @muratcanbarut64
    @muratcanbarut64 4 года назад +1

    hello code link collapsed !!!! thank you

    • @noahgiesel9030
      @noahgiesel9030 4 года назад +1

      chech the "My Encoder " link, scroll down the page ! the code is there

    • @muratcanbarut64
      @muratcanbarut64 4 года назад +1

      thank you

  • @sabrinedahak4483
    @sabrinedahak4483 5 лет назад

    what are the values that we get ?

    • @shibshankarpadhy783
      @shibshankarpadhy783 4 года назад

      did you get the answer??
      i have to convert these values to degrees...

    • @cmblcdoe6669
      @cmblcdoe6669 4 года назад

      I am guessing you don't really know what an encoder does. It has two channels "wires" that act as output. Voltage on these two output wires will pulse on and off, but the two channels are offset in phase. This offset allows you to detect which direction the encoder is turning. For instance, say you have a 300 ppr (pulses per revolution) encoder. Normal operation would be to monitor on of the output channels, let's say 'Channel (wire) A' and attach it to one of the interrupt pins of the arduino (D2 for instance). You would not do like this video and attach the interrupt to "CHANGE", but instead use "FALLING". When the interrupt triggers because channel 'A' went from HIGH to LOW (FALLING) you then check the status of the other channel. Assume the encoder is turning clockwise. The falling of the signal on channel 'A' gives you one of the 300 pulses in the revolution. IOW, it just turned 1/300th of a circle. At the time of falling of channel 'A', the status of channel 'B' (HIGH or LOW) will tell you whether it's turning clockwise or counterclockwise. So that would tell you whether your pulse count should be incremented or decremented. The channel 'B' in this case does not need to be on an interrupt pin (arduino uno only has 2 interrupt pins) since it's checked only when channel 'A' goes LOW. This means using the 300 PPR resolution in the way it was MEANT to be used allows you to use up to two encoders on an arduino uno, assuming you're going to use interrupts to detect a signal change. By using different states of the channel 'A' and combined with the different states of channel 'B', you can quadruple the resolution of a 300 PPR encoder to make it effectively a 1200 PPR encoder. But the coding gets more involved and takes (somewhat) longer to execute so that plays into what speed the encoder turns that you're still able to detect and decipher pulses and direction.

  • @Lolerburger
    @Lolerburger 2 года назад

    Did you seriously make a video of you putting some wires in an arduino and then turning a knob with no explainations whatsoever? Why dude?

  • @Ferferite
    @Ferferite 5 лет назад +1

    Hey there,do you remember me?I emailed you a while ago to help me with the cnc machine.I will want to rebuild it using a 3D printer.I am 12 years old.Thanks

  • @aaaooaao9949
    @aaaooaao9949 4 года назад

    hi - your google-drive is down - can you re-upload the sketch?

    • @noahgiesel9030
      @noahgiesel9030 4 года назад

      chech the "My Encoder " link, scroll down the page ! the code is there

    • @aaaooaao9949
      @aaaooaao9949 4 года назад

      @@noahgiesel9030 thank you very much. This looks similar to my idea, both phases by interrupt to the same ISR :)
      I had used direct port accesses myself, which saves a lot of time.
      But then you are not so flexible anymore.
      (e.g. phasea=PortB>>1&0x01; )

    • @noahgiesel9030
      @noahgiesel9030 4 года назад

      @@aaaooaao9949 I was looking myself to build a DIY steering wheel. What is the difference between a potentiometer vs rotary encoder? Can I use just a potentiometer?

    • @aaaooaao9949
      @aaaooaao9949 4 года назад

      @@noahgiesel9030 Not really.
      The potentiometer has a stop somewhere, both mechanically and electrically.
      With the encoder you have no limitation, the direction of rotation results from the offset of the two signals.
      My experiments - 600/r, 1500r/min (maximum spindle speed for me) - results in 60000 edges (600/r, even with 4 edges, x 1500 r/min : 60 seconds per minute) per second - there is hardly time for 'the rest', at least with an AVR-Arduino.
      The pure counting of the edges I can do without errors - but I'm not further yet.
      Translated with www.DeepL.com/Translator (free version)

    • @noahgiesel9030
      @noahgiesel9030 4 года назад

      @@aaaooaao9949 so I should take the encoder. Thanks

  • @gorevyoneticisi548
    @gorevyoneticisi548 4 года назад

    clone arduino it works

  • @abelguillen8285
    @abelguillen8285 4 года назад

    Hey can you upload the code, pretty please

    • @noahgiesel9030
      @noahgiesel9030 4 года назад

      chech the "My Encoder " link, scroll down the page ! the code is there

  • @umut1170
    @umut1170 4 года назад

    He made changes to the code in 'My encoder'. Could you please share the final version of the code, I would be very grateful

    • @umut1170
      @umut1170 4 года назад

      Ok I found here electricdiylab.com/

  • @FartingUnicorn
    @FartingUnicorn 4 года назад

    Hello my friends! google drive writw- "im delete this file", share code again please, and thx !

    • @MrInnovative
      @MrInnovative  4 года назад

      have you visited this link code is already there.
      electricdiylab.com/how-to-connect-optical-rotary-encoder-with-arduino/

    • @hakimzulkifli8055
      @hakimzulkifli8055 4 года назад

      @@MrInnovative hello bro...the code in that http is different bro...please...please..update your google drive..thank you very very much..need to present my project next week...your help would means a lot to me..thank you..

  • @sergiomanuelhernandezlopez6108
    @sergiomanuelhernandezlopez6108 6 месяцев назад

    soy gay pero no le digan a nadie

  • @imwhatim7259
    @imwhatim7259 5 лет назад

    W T F..... . . . .. . I though its a stepper motor