Arduino OLED Clock Project (tutorial for beginners, u8g2, Arduino UNO, OLED display, SH1107,SSD1306)
HTML-код
- Опубликовано: 29 сен 2024
- Do you like the video? Please consider buying me a coffee, thank you! www.buymeacoff...
Source Files: github.com/upi...
PCBWay - www.pcbway.com...
WOKWI - wokwi.com/proj...
------------------------------------------------------------------------------
In this tutorial, I will show you how to create simple analog clock with Arduino UNO and OLED display with 128x128px resolution, using the u8g2 library and WOKWI online emulator. The display uses SH1107 chip, but we will be using the SSD1306 128x64 OLED display for testing inside the WOKWI.
------------------------------------------------------------------------------
Links from the video:
128x128 SH1107 OLED Display: s.click.aliexp...
128x64 SSD1306 OLED Display: s.click.aliexp...
Arduino UNO: s.click.aliexp...
Arduino breadboard prototyping shield: s.click.aliexp...
Photopea (online Photoshop-like tool): www.photopea.com/
u8g2 documentation: github.com/oli...
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!
------------------------------------------------------------------------------
Do you like the video? Please consider buying me a coffee, thank you! www.buymeacoffee.com/upir
I'm a visual learner and only have limited c++ experience. This is a very clear and detailed explaination without drifting off the task. I find this easy to follow and also learning about the libraries at the same time :-) Subbed!
Thank you for your nice words, I’m glad it was helpful! Please feel free to also check my other videos and good luck with your projects.
I think I understand how to use Modulus in code now. Thank you.😀
It can also be used to set the seconds back to 0 every time it hits 60. If you set the seconds to seconds % 60, if the seconds are 60 it will be set to 0, so you can save yourself an if statement. 19:00
I’m glad it was helpful! As for the other comment, yes, you can do that for seconds, but you would still need the if statement to increment minutes and hours..
I don't know if I've ever seen anything so well explained! Greetings and thanks!
Thank you for your nice comment, I´m glad it was helpful and good luck with your projects!
Since it‘s just black and white, I‘d draw the hands in black using previous time (to erase it), then in white again. That would avoid drawing the background each time.
Yes, that should be possible, but sometimes the hands are displayed over tickmarks, so you would have to also keep track of that and “repair” any damaged tickmarks. I mean all of this is possible, but it would probably not affect performance that much.
@@upir_upir So now you got me curious: what direction would you think of when optimizing performance in this specific scenario?
@@gerhardachrainer6116 The u8g2 library supports partial redraw/update of the screen, so I would start there. Also switch the IIC display for a SPI version, that would speed things up as well. And if nothing works, switch to UNO R4, any other faster Arduino clone or ESP32.
Yep, draw the second hand in black, before redrawing it in white in the new position.
Then redraw in white the minute & hour hand to repair any damage.
(if using different colour for second hand, redraw it again, as it should be above other hands)
Only need to draw minute & hour hand in black, then new position in white, once per minute.
Make the hands shorter than the clock markings, so they do not need to be re-drawn.
You will find the clock hands look much smoother.
great job :)
Thank you, I’m glad you like it!
Hello. Thank you for sharing.
Can you please do a howto for a "Waveshare 2.9 inch E-Ink E-Paper Display - 3 Colors" using a Nano or Uno?
Thank you.
You are welcome. I can take a look. Is there any particular project that you would like to use this display for?
Nice
Thank you!
I made a digital clock using a similar 1.5 inch display (maybe the same one) and the burn-in was terrible. After only a few months it became unusable, maybe take the brightness down? Cheers.
That’s interesting. I will keep it running and see how it looks in a few months. I have other oled displays on for weeks and I don’t see any burnout pixels yet.
Nice, why don't you use images for dial and needles?
You can. There are multiple ways how to achieve the same result..
Without the RTC (1307/3231) module installed, will the Arduino ino’s time in seconds be accurate? Will the time remain the same when you turn off the power and turn it back on again?
It will most likely not be accurate. If you don´t want to use an external RTC, you can use microcotroller that has already RTC build-in, for example Arduino UNO R4.
If the power is cut off to the Arduino, will the time reset, will it start up from the last time in the memory, or will it auto adjust to the correct time? I'm guessing it's one of the first two?
It will start most likely back from zero. That´s the reason for having this coin battery that keeps the realtime clock module alive.
soo... have you used this 128x128 display for any project?
i don`t. 128X64 is way cheaper. For that money you can buy 1 pcs "128x64" + "1.8" LCD Display TFT Screen Module SPI Interface 128*160"
Can I use the code with SSD1327?
Yes, the u8g2 library should support this display.
17:24 wouldn't it be easier if you just draw a rectangle instead of two triangles? You know the 4 points already.
It would, but there is no function to draw rotated rectangle in the library.
@@upir_upir ah, I didn't know that
سربي سربي لكار يدا عليا
Do some video for drawing on 3.5 inch displays, lets say some car gauges :-)
Which exact display do you have in mind?
Ndee radore
What?
Good work thax. How i can contact you. I have few dbt pls
Sure, the email is on the about page of this channel, but sometime it only shows on desktop, and not on mobile version.
A very good project - But please slow down your explanation you are very fast it's hard to see what you are trying to explain
😂, he is very fast, you can slow down the video too, he need to cover a lot in those tutorials.
Thank you for your comment. Could you perhaps use the playback speed to slow it down?
Wow! I learned lots of new things from this video. Really great. Please keep creating.
Happy to hear that! I´m glad it was helpful, and I will surely try to record more...
nice
Thanks!
Great again!
What if Wokwi had 128x128 SH1107 ?
Well, that would be really great and it would also mean that for many of my future projects would be my preferred display 🙂 however, it would be enough to have support for any 128x128 display supported by u8g2 library, because at that point, switching the initialization should be simple.
@@upir_upir Thanks for the feedback! It's possible to add new displays (like the SH1107) using the Custom Chips API. Are you interested in trying it?
There's a complete example of an IL9163 SPI display implementation in the Chips API documentation.
@@Wokwi That all sounds great, but I´m worried that I don´t have enough knowledge yet for something like that. Has anyone created any custom display for WOKWI already?
@@upir_upir Yes, there are three examples so far: SSD1306, ILI9163, WS29V2 (2.9" epaper) display. RUclips won't allow links here, but you can find the first two in the documentation site under "Chips Api" -> "Getting Started". There's a "Chip Examples" section with "Displays" category.
Thank you for your reply, I did take a look and the documentation is really great, especially with all the custom chips already made. That said, unfortunately right now, it’s beyond my knowledge. But maybe someone else would be about to add that bigger display, that would be great.
try rotary radar display, it will be awesome
That´s an interesting idea. Do you have any examples of how that might look like?
@@upir_upir just like green screen sonar radar in submarine movies :) most important thing is scanning & spinning something like second hand... someday i will build rf radar for sailboat
That was a real class. Bravo!
That´s great to hear, thank you for your nice comment!
Nice ❤🎉
Thank you!
Awesomeeee ♥♥
Thank you, I’m glad you like it!
dost propracovane ! :D
Diky diky!