Arduino with I2C LCD and Rotary Encoder

Sdílet
Vložit
  • čas přidán 8. 07. 2024
  • This tutorial shows how to use an I2C 16x2 Character LCD and a KY-040 Rotary Encoder for local control and readout with an Arduino Uno. The parts cost less than $10 and can be assembled with no soldering. I believe that this makes it the simplest, cheapest, and easiest way to create a local user interface for an Arduino project.
    Feel free to skip ahead to the section that is of most interest to you.
    1:04 - Purchasing the Parts
    4:12 - Assembly of the Hardware
    7:38 - Walkthrough of the Arduino Sketch
    11:44 - Demonstration
    The Arduino sketch shown in this video can be found at:
    github.com/jpsrmiller/rotary-...
    For a written version of these instructions, refer to:
    buildmusic.net/tutorials/user...
    The Arduino sketch uses the following external libraries:
    OneButton: github.com/mathertel/OneButton
    Liquid Crystal I2C: github.com/fdebrabander/Ardui...
    The sketch also utilizes code from Simon Merrett’s instructable “Improved Arduino Rotary Encoder Reading”
    www.instructables.com/id/Impr...
    Parts for this project were purchased from Ali Express (www.aliexpress.com/) and Adafruit (www.adafruit.com/).
    Check out my other Arduino projects that use the I2C LCD and Rotary Encoder as described in this video:
    Toastmasters Automatic Timing Light - autotiminglight.com/
    Build Your Music - Robotic Xylophone - buildmusic.net/

Komentáře • 35

  • @eddiejones8709
    @eddiejones8709 Před 3 lety +1

    Thanks for the video. Being a beginner at this your video really helps me better understand the sketch terms and building.

  • @chbonnici
    @chbonnici Před 2 lety

    Very good ,clear, and sensible explanation. Well done and thank you. This is learning at its best.

  • @joshgapp1677
    @joshgapp1677 Před 4 lety +2

    Love it John. Nice mix of humor along with very thorough and easy to follow instruction.

  • @realcomsolucoes7403
    @realcomsolucoes7403 Před rokem

    Thanks for your time giving us a good tip.

  • @thomasbecker-szurszewski1371

    Nice demo John glad you helped me out

  • @robdavidowitz6428
    @robdavidowitz6428 Před rokem

    Crystal clear tutorial
    Your explanations are SO clear and usefull.
    Thanks👌

  • @julioalbertodanoviz3854

    Excellent teaching method. Thanks.

  • @Wrighmachining
    @Wrighmachining Před 5 měsíci

    Hey John pretty well laid out thank you. The code was pretty comprehensive as well for myself trying to learn and modify code to fit what I need.
    Keep up the good work !

  • @christosstylianou9023

    Thank you John, your video was very helpful

  • @luisfernandoalvarez5500

    Mil gracias. Un abrazo desde Colombia

  • @umitozdemir1386
    @umitozdemir1386 Před rokem

    It was very helpful. clear explenation. Thanks a lot.

  • @christiankarlfrey766
    @christiankarlfrey766 Před 2 lety

    Thanks for the video, very useful!

  • @hosseinashkboos5188
    @hosseinashkboos5188 Před 2 lety

    Great Job. Thank you.

  • @mauricioruiz6600
    @mauricioruiz6600 Před rokem

    Saludos desde Ecuador 🇪🇨, éxito

  • @shivanikc804
    @shivanikc804 Před rokem

    hanks lot Sir.. You helping us..

  • @najeeullah97
    @najeeullah97 Před rokem

    YOU DESERVE MILLIONS OF SUBSRICBERS

  • @dmitry_poliakov_ph
    @dmitry_poliakov_ph Před 3 lety

    спасибо. доступно, позновательно

  • @Drxxx
    @Drxxx Před 2 lety

    good tutorial!

  • @luisfernandoalvarez5500

    Thanks a lot

  • @garysplace1431
    @garysplace1431 Před 2 lety +3

    Hi, I had an issue with the encoder not incrementing and was wondering if you had any ideas for me on that issue. The push button works fine but when I turn the knob nothing happens.

  • @pradeeplaptop
    @pradeeplaptop Před rokem

    Excellent explanation thanks I want make LCD menu for operate stepper motor with given speed and steps. thanks for your help.

  • @echosoundlight
    @echosoundlight Před 2 lety

    Thank for your video, can Rotary Encoder be connect to M5stack core 2 or Mstick C

  • @sumeshak3477
    @sumeshak3477 Před 3 lety

    Hi can you please explain how to modify this program for OLED display?

  • @dilipsuthar1836
    @dilipsuthar1836 Před 2 lety

    Hi John
    I m new to Aurdino, saw ur vdo its very informative. want to have some more information on ur above vdo. Can we do preset counter using the above material. That is we set some count on LCD and when we rotate the encoder in reverse direction and as soon the counts reaches to "0" (zero) we can generate a flag which will operate a relay.
    Can u help me in this above project with its sketch and bill of material.

  • @Minizom
    @Minizom Před 2 lety +2

    Has anyone attempted with an Arduino mega, even adapting the code doesn't seem to work

  • @alexptvz1076
    @alexptvz1076 Před rokem

    man its very clean code and and very structured video. I repeat the same steps, but sometimes when I turn encoder value on LCD not been changed, it's like freezing for little time or some like this. Maybe you have an idea why it happens?

  • @brraam007
    @brraam007 Před 3 lety

    for me the lcd.begin(); does not work, but if i use lcd.init(); it does do you know why?
    very nice video btw.

  • @sarojpradhan4267
    @sarojpradhan4267 Před 3 lety

    HI John
    I built this project and worked fine.
    Now i want to realise menu system with the help from your code,
    where rotaryleft and rotaryright function will navigate up and down through menu items and encoder click event will select the menuitem.
    i tried one menu system using simple menu library.my problem is every function called in rotaryclick subroutine works perfectly but if i call same functions in rotaryleft and rotaryright subroutine it doesnot work. any idea?

  • @lexasolopow
    @lexasolopow Před 2 lety

    Music box was enough complicated as your examples.

  • @robdavidowitz6428
    @robdavidowitz6428 Před rokem

    John,
    I have copied and pasted this sketch
    Changed I2C adress to 0*27 and set the display 2 2*16
    On compiling, I get the following error:
    C:\Users\ABCD\AppData\Local\Temp\.arduinoIDE-unsaved2023030-18628-fhzkzm.s5a15\sketch_jan30d\sketch_jan30d.ino: In function 'void initializeLcd()':
    C:\Users\ABCD\AppData\Local\Temp\.arduinoIDE-unsaved2023030-18628-fhzkzm.s5a15\sketch_jan30d\sketch_jan30d.ino:197:12: error: no matching function for call to 'LiquidCrystal_I2C::begin()'
    lcd.begin();
    ^
    In file included from C:\Users\ABCD\AppData\Local\Temp\.arduinoIDE-unsaved2023030-18628-fhzkzm.s5a15\sketch_jan30d\sketch_jan30d.ino:42:0:
    c:\Data\Dropbox\Arduino\Projects\Sous_Vide_001\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:8: note: candidate: void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t)
    void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS );
    ^~~~~
    c:\Data\Dropbox\Arduino\Projects\Sous_Vide_001\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:8: note: candidate expects 3 arguments, 0 provided
    exit status 1
    Compilation error: no matching function for call to 'LiquidCrystal_I2C::begin()'
    The compile stops at the lcd.begin() below
    void initializeLcd()
    {
    lcd.begin();
    lcd.backlight();
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(F("Test LCD & Rotry"));
    }
    Can you please assist.
    Rob

  • @JoseRamos-su3ep
    @JoseRamos-su3ep Před 2 lety

    Any chance your available for help?

  • @ChandranshuDwivedi
    @ChandranshuDwivedi Před 2 lety

    aliexpress is banned in India.