U8g vs. U8g2 Arduino Graphics Libraries (Tutorial - OLED and LCD screens with Arduino UNO)

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 มี.ค. 2023
  • Do you like the video? Please consider buying me a coffee ☕, thank you! www.buymeacoffee.com/upir
    Source Files: github.com/upiir/arduino_oled...
    PCBWay - www.pcbway.com/setinvite.aspx...
    WOKWI - wokwi.com/projects/3587258626...
    ------------------------------------------------------------------------------
    In this tutorial, I will show you how to convert a project using the U8g library to use the newer U8g2 library instead. We will be using the menu project from the previous video ( • Arduino OLED Menu Tuto... ), and also various LCD displays.
    ------------------------------------------------------------------------------
    Links from the video:
    WOKWI start project progress bar - wokwi.com/projects/3008679867...
    128x64 SSD1306 OLED Display: s.click.aliexpress.com/e/_DCK...
    Transparent OLED display: s.click.aliexpress.com/e/_Dns...
    Arduino UNO: s.click.aliexpress.com/e/_AXDw1h
    Arduino UNO MINI: store.arduino.cc/products/uno...
    Big OLED Display: s.click.aliexpress.com/e/_ADL0T9
    Arduino breadboard prototyping shield: s.click.aliexpress.com/e/_ApbCwx
    u8g fonts (fonts available for u8g library): nodemcu-build.com/u8g-fonts.php
    u8g documentation: github.com/olikraus/u8glib/wi...
    Photopea (online Photoshop-like tool): www.photopea.com/
    image2cpp (convert images into C code): javl.github.io/image2cpp/
    Push buttons with caps - s.click.aliexpress.com/e/_DmX...
    LCD displays: s.click.aliexpress.com/e/_DBg...
    u8g2 documentation: github.com/olikraus/u8g2/wiki...
    Image Magick: imagemagick.org/index.php
    LCD Image converter: lcd-image-converter.riuson.co...
    Related videos:
    Arduino Parking Sensor - • DIY Parking Sensor wit...
    Turbo pressure gauge with Arduino and OLED display - • Turbo pressure gauge w...
    Arduino Car Cluster with OLED Display - • Arduino Car Cluster wi...
    Knob over OLED Display - • Knob over OLED Display...
    Arduino + OLED = 3D ? - • Arduino + OLED = 3D ?
    Arduino OLED Gauge - • Arduino OLED Gauge
    Smaller & Faster Arduino - • Smaller & Faster Arduino?
    ------------------------------------------------------------------------------
    PCBWay is a service for manufacturing custom PCBs. If you click the link above, you will get a coupon for $5, which is exactly the price of 10 pieces of custom PCBs. In that case, you will only pay for shipping. Do you have any experience doing this? Please let me know in the comment section!
    ------------------------------------------------------------------------------
    Hashtags:
    #OLED #arduino
    ------------------------------------------------------------------------------
    Do you have any questions? Suggestions for the next video? Please put those down in the comment section. I try to answer as many questions as I can. Thank you for watching and reading the video description, and I hope to see you next time. Good luck with your projects!
    ------------------------------------------------------------------------------

ความคิดเห็น • 97

  • @upir_upir
    @upir_upir  3 หลายเดือนก่อน +1

    Do you like the video? Please consider buying me a coffee ☕, thank you! www.buymeacoffee.com/upir

  • @danielmelendrez1616
    @danielmelendrez1616 ปีที่แล้ว +7

    Fantastic work. Your video dropped heaven-sent since I am working on a small project based on your rotating cube video and it reinforced some concepts on the u8g2 library. Thanks

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      Perfect, that’s great that the timing worked out nicely. Good luck with your project and please feel free to share your creations, I would love to see it.

  • @SuddenlyPineapple
    @SuddenlyPineapple ปีที่แล้ว +5

    Thanks man, I've been doing almost every step which you showed in this video manually since I've saw your first video with Turbo Gauge. This is verry nice tutorial for automating this conversions. Also it's worth to mention, that u8g2 lib works for almost every 128x64 screen and solves problems with sudden freeze on cheaper one models, thats probably why you've done this tutorial as I can guess ;) Verry nice work, can't wait when you connect it to MCP2515 and show some real data on this littile cuties 😎🤞

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      Thank you for your nice comment, Wojciech! I´m gald it was helpful, and to answer your question, yes, I would like to show some real data soon :) Good luck with your project. Is there something you can share with the world?

  • @andymouse
    @andymouse ปีที่แล้ว +2

    You vdeos quite frankly continue to grow in 'Awesomeness'....cheers!

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      Thank you kindly for your nice comment(s). I´m glad you are enjoying my videos. If you have any ideas for future topics, I´m all ears!

  • @nyfaz
    @nyfaz ปีที่แล้ว +3

    Thank you again for sharing your informations :)
    Greetings from Germany.

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      Danke schön! I´m glad you like it, and good luck with your projects! Greeting from not-so-far-away-from-germany.

  • @tfninjadoom
    @tfninjadoom ปีที่แล้ว +2

    incredible video, thank you so much

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      You are welcome, thank you for your comment!

  • @Cichlor
    @Cichlor ปีที่แล้ว +2

    Great Work - Again Thank you!

  • @ucglib530
    @ucglib530 ปีที่แล้ว +7

    Amazing Video. Great description of the page mode. Small remark: LCDs are slower because of the SW I2C mode used in the video. HW I2C mode is much faster and is also possible with the LCDs.

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      Thank you for your nice comment and clarifying the slowness. I didn´t think that SW vs HW I2C would make such a difference, but I will surely try it with HW I2C to see the full potential. One question - do you know why you have to specifically set the I2C address for those particular LCDs, and not for other? Thank you!

    • @ucglib530
      @ucglib530 ปีที่แล้ว +3

      @@upir_upir U8g2 defaults to the lowest I2C address allowed by display controller. Usually multiple I2C are possible with the display controller. Often the I2C address can be configured on the display PCB. Nevertheless the display manufacturer sometimes decides to use a different I2C address as a default configuration. In this case you either need to resolder a solder bridge on the PCB or provide the correct I2C address to U8g2.

    • @upir_upir
      @upir_upir  ปีที่แล้ว +3

      @@ucglib530 Thank you for the clarification; it all makes perfect sense once you know it. One last question, am I talking to the almighty Oli Kraus?

    • @ucglib530
      @ucglib530 ปีที่แล้ว +4

      @@upir_upir ah, well yes, I had been too lazy to rename my youtube account 🤪

    • @upir_upir
      @upir_upir  ปีที่แล้ว +3

      @@ucglib530 ok, please to meet you! Most of my projects wouldn’t be possible without your amazing library.

  • @upir_upir
    @upir_upir  ปีที่แล้ว +3

    The previous video 𝐀𝐫𝐝𝐮𝐢𝐧𝐨 𝐎𝐋𝐄𝐃 𝐌𝐞𝐧𝐮 𝐓𝐮𝐭𝐨𝐫𝐢𝐚𝐥 is here - th-cam.com/video/HVHVkKt-ldc/w-d-xo.html

  • @thisnthat3530
    @thisnthat3530 5 หลายเดือนก่อน +2

    If you hold the shift key while right-clicking in the file window (blank area of it) there is an additional item in the context menu, either "Open Command Prompt Here" or "Open Powershell window here" depending on version of Windows and/or a specific setting. Either way you get a command prompt already pointing to the correct folder.

    • @upir_upir
      @upir_upir  5 หลายเดือนก่อน

      Thank you for letting me know, it´s definitely great to know and I´m sure other viewers would appreciate this information.

  • @colinsmith6340
    @colinsmith6340 ปีที่แล้ว +1

    u8g is a fantastic lib. I used to use it with the generic 128x64 graphic LCDs that are all over ebay before i moved across to touch screen TFTs.

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      I fully agree. It´s well designed library and I enjoy using it. Out of curiosity, which touch screen TFTs are you using?

  • @eisbarfan7716
    @eisbarfan7716 ปีที่แล้ว +2

    Great video, thanks

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      You are welcome. Glad you liked it!

  • @jeremiaspenas1802
    @jeremiaspenas1802 10 หลายเดือนก่อน +1

    Hi! great videos, they are really cool. I would like to use the circular gauge that you use for mph and rpm. I saw in one of your earlier videos that it can be animated, showing the progress, but did not find code for that. Do you have it, or any resource i can check in how to do that? Thanks!

    • @upir_upir
      @upir_upir  9 หลายเดือนก่อน

      Thank you, I’m glad you like it! Sure, please send me an e-mail and I will send you the source code.

  • @gtxsatria2010
    @gtxsatria2010 ปีที่แล้ว +2

    tkank Mr was make video again

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      Thank you, I’m glad you like it!

    • @gtxsatria2010
      @gtxsatria2010 ปีที่แล้ว

      @@upir_upir tentu saja , saya sangat senang dengan video yang anda buat. biarpun saya pemula dan memang rumit saya memahaminya tapi biarkan waktu yang menjawab. kalau boleh buat video tentang
      1. menu screen "detektor magnet induksi"
      2. select buttong sub menu 1 "frequency value"
      3. select button again sub menu 2 " Sens Value"
      4. selectbuttons again sub menu 3 "Wavelength"
      5. select button again sub menu 4 " Filter Divider"

  • @nickname0ff
    @nickname0ff ปีที่แล้ว +1

    Great!

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      Thank you, Denis.

  • @atheist_happie
    @atheist_happie 4 หลายเดือนก่อน +1

    Pro tip if you're using the u8g2 library make sure to ✔️ "swap" and convert image no more flipped parts of pictures

    • @upir_upir
      @upir_upir  4 หลายเดือนก่อน +1

      Yep, this video was recorded before this option was there…

    • @atheist_happie
      @atheist_happie 4 หลายเดือนก่อน

      @@upir_upir ohh i see... i tried this today and it's worked for me 😍
      I'll surely make my potentiometer pimp like you did thank you 🙂

  • @matthewStapleton
    @matthewStapleton 5 หลายเดือนก่อน +1

    Great video

    • @upir_upir
      @upir_upir  5 หลายเดือนก่อน

      Thank you! I´m glad you like it.

  • @ThalysCosta
    @ThalysCosta ปีที่แล้ว +1

    Hello, I have a question, were you able to connect an ODB2 adapter via bluetooth to get this information from the ECU? If you can give me some tips, thanks!

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      I haven´t tried that yet, but it´s on my to-do list. Hopefully soon!

    • @ThalysCosta
      @ThalysCosta ปีที่แล้ว +1

      @@upir_upir Cool! I'm trying to do it but it's not working

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      @@ThalysCosta What about perhaps starting with some dedicated OBD2 Arduino compatible board first?

  • @martinsommer6168
    @martinsommer6168 10 หลายเดือนก่อน +1

    How do you avoid screen flickering? I always have the problem with the delay/refresh in the loop for the input.

    • @upir_upir
      @upir_upir  10 หลายเดือนก่อน

      Could you be more specific? What flickering? The flickering that might be visible on the video is only due to camera synchronization, and it’s not visible in real life.

  • @haideralikhan5947
    @haideralikhan5947 4 หลายเดือนก่อน +1

    @upir any chance you know why sometimes the display stops refreshing while using the old u8g library but there is no issue with the new u8g2 library?

    • @upir_upir
      @upir_upir  4 หลายเดือนก่อน

      Can you check the initialization routines of those libraries if those are the same? Or a better question, is there a reason to stick with the U8g instead of the newer u8g2?

    • @haideralikhan5947
      @haideralikhan5947 4 หลายเดือนก่อน +1

      @@upir_upir no reason to stick with the old library, I just want to find the reason it doesn't work to be a better engineer. It's not in the initialisation routine. It's a hit or miss, some displays work fine others don't depending on the manufacturer

    • @upir_upir
      @upir_upir  4 หลายเดือนก่อน +1

      @haideralikhan5947 are you 100% sure it’s SSD1306? Sometimes the sellers lists those but in fact it’s a different chip - like the SSD1309 or Sh1106. If it’s IIC version, try putting pull-up resistors for data and clock, some modules have those and some don’t. The safest option is to of course buy modules from known brands like Adafruit or Pimoroni, but obviously they are more expensive. Hope this was at least a little bit helpful.

    • @haideralikhan5947
      @haideralikhan5947 4 หลายเดือนก่อน +1

      @@upir_upir absolutely right, I have put 2 pull-up resistor and the screen doesn't freeze anymore. Cannot I never thought about that.
      - option 1: keep using the old library which consumes less memory and is also a bit faster. Add 2 more resistors increasing cost.
      -option 2: use the new library that has loads of new features, doesn't need pull up resistors it's just a bit slower.
      I am definitely going to choose the second option. Thanks a lot for the help, the pull-up resistor were a really nice shout

    • @upir_upir
      @upir_upir  4 หลายเดือนก่อน

      @haideralikhan5947 cool, I’m glad it was helpful. I still don’t quite understand why the newer version of the library works and the older one don’t. Perhaps they default to different speed?

  • @76Raby
    @76Raby ปีที่แล้ว +1

    Která z knihoven zabere méně paměti (ponechám-li program jinak stejný).
    Which library is les memory hungry assuming the same program

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      With this particular sketch, the memory usage is as follows, so the older library is slightly smaller.
      U8G (older):
      Sketch uses 27662 bytes (85%) of program storage space. Maximum is 32256 bytes.
      Global variables use 463 bytes (22%) of dynamic memory, leaving 1585 bytes for local variables. Maximum is 2048 bytes.
      U8G2 (newer):
      Sketch uses 31318 bytes (97%) of program storage space. Maximum is 32256 bytes.
      Global variables use 869 bytes (42%) of dynamic memory, leaving 1179 bytes for local variables. Maximum is 2048 bytes.

  • @elijahshepley7434
    @elijahshepley7434 11 หลายเดือนก่อน +1

    Hello
    I am trying to make a tachometer for my car and i was working if there is any way to connect this gauge to my cars obd2 port
    Thanks

    • @upir_upir
      @upir_upir  11 หลายเดือนก่อน

      Yes, that´s possible. The easiest path would be a dedicated Arduino shield, I know that for example DFRobot makes one, but I´m sure other brands have shields as well. I do plan to record a dedicated video about how to do that soon.

    • @elijahshepley7434
      @elijahshepley7434 11 หลายเดือนก่อน

      @@upir_upir oh cool
      Thankyou

  • @ACID2BREAKS
    @ACID2BREAKS ปีที่แล้ว +2

    I am a bit lost, may be you can help me? I tried to adapt procedure for getting the arduino code with image2cpp. The OLED only shows crazy stuff as you have showed at 5:34, is there a way to avoid such mess up upfront?

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      For U8G2 library, you cannot generate images using image2cpp, since it does not suport the XBM format (yet). You need to use other tools, like the mentioned LCD Image converter or Image Magick. Hope it makes sense. I also hope that someone will update image2cpp to support XBM format.

    • @ACID2BREAKS
      @ACID2BREAKS ปีที่แล้ว +1

      @@upir_upir thank you for your fast reply :). I did found (through the deeps of arduino forum and the internet) a way around as you described. Create a .jpg file of Photopea load it into gimp and export it as GLIP Pixmap and paste the code into sketch.

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      It’s also described in the video 😳

    • @ACID2BREAKS
      @ACID2BREAKS ปีที่แล้ว +1

      @@upir_upir oh damn it. Too much coding to less hearing 😂🙈

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      No worries, I’m glad you have sorted it out 🙂

  • @nkronert
    @nkronert 10 หลายเดือนก่อน +1

    What a bummer that they changed the bit order as well as made the image interpretation inverted. Are there no flags to tell the library to be backwards compatible?

    • @upir_upir
      @upir_upir  10 หลายเดือนก่อน

      I don´t think there are any flags, but at least the image2cpp now has an option to export image to u8g2 library with just one checkbox.

    • @nkronert
      @nkronert 10 หลายเดือนก่อน

      @@upir_upir I just checked the library sources. To me it looks like a backward compatibility could be easily introduced in the function u8g2_DrawHXBM in u8g2_bitmap.c, but this is obviously something to discuss with the library's author.

  • @GANCFLEX
    @GANCFLEX ปีที่แล้ว +2

    for bitmaps you can use flash as well

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      What do you mean by that? I´m sorry but I don´t fully undestand.

    • @GANCFLEX
      @GANCFLEX ปีที่แล้ว

      @@upir_upir forget it, i wrote a bullshit

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      No problem, happens to everyone sometime 🙂

    • @GANCFLEX
      @GANCFLEX ปีที่แล้ว +1

      @@upir_upir gotta one question, are you form czech republic?

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      Yes, I am. Are you as well?

  • @gleteam2330
    @gleteam2330 ปีที่แล้ว +2

    Can I buy a screen ready to work I’m not familiar with coding

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      What are you trying to achieve? You don´t need to know how to code if you know how to copy and paste code :) (yes, that´s my approach)

  • @ohseiyagaming2503
    @ohseiyagaming2503 11 หลายเดือนก่อน +1

    Sir, good day. Can you make sample ui for M5stack Core2? Thanks. More power.

    • @upir_upir
      @upir_upir  11 หลายเดือนก่อน

      I can certainly take a look, it looks like an interesting device!

  • @nsonelectronicslabs9776
    @nsonelectronicslabs9776 5 หลายเดือนก่อน +2

    please do this code using esp32 and graphics lcd i2c

    • @upir_upir
      @upir_upir  5 หลายเดือนก่อน +1

      Yes, I do plan to record videos using ESP32, stay tuned..

    • @nsonelectronicslabs9776
      @nsonelectronicslabs9776 5 หลายเดือนก่อน

      @@upir_upir then how do i draw bitmap on the bigger lcd please ?

  • @akangrangkas4334
    @akangrangkas4334 ปีที่แล้ว +1

    I need tutorial, grafik bandwidth WiFi, arduino?

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      Could you please be more specific? I´m not 100% sure I understand what you are looking for..

    • @akangrangkas4334
      @akangrangkas4334 ปีที่แล้ว

      sorry if the comments above are not clear, I'm from Indonesia. I've been looking for a sharing tutorial on how to display internet bandwidth graphics on the display using Arduino Uno but it's not there, can you make the tutorial 🙏🙏

  • @akshaypalkar7097
    @akshaypalkar7097 ปีที่แล้ว +1

    is this library compatible with esp8266?

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      Yes for the u8g2. Not for the older one (u8g).

    • @akshaypalkar7097
      @akshaypalkar7097 ปีที่แล้ว +1

      @@upir_upir tried and working

    • @upir_upir
      @upir_upir  ปีที่แล้ว +1

      Good to know! Thank you for the update

  • @Abc-sl1nf
    @Abc-sl1nf ปีที่แล้ว +1

    That's too much work. Nextion?

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      Yes, Nextion is always an option if you don´t like coding.

  • @user-kd7wu2lr1t
    @user-kd7wu2lr1t 5 หลายเดือนก่อน +1

    I need further assistance, especially on increasing the refresh frame rate, it is kinda slow if i used the GraphicsTest.ino .
    i used the display which is same as yours on 0:10 .
    i used the U8G2_ST7567_ENH_DG128064I_F_SW_I2C u8g2(U8G2_R2, SCL, SDA, /* reset=*/U8X8_PIN_NONE); constructor

    • @upir_upir
      @upir_upir  5 หลายเดือนก่อน

      Try using the HW I2C constructor, that should help.

  • @MASSKA
    @MASSKA ปีที่แล้ว +1

    where to buy these displays

    • @upir_upir
      @upir_upir  ปีที่แล้ว

      All the links are in the description of the video.