This one change made Arduino run at 27.5361 FPS

preview_player
Показать описание

Useful links from the video:

Today I will show you how to take what we have from the last time and make it run much faster! How fast? Last time we were approaching around 10FPS, but with all the changes done today, the animations are running at almost 30FPS. Same as the last time, this project uses Arduino UNO with 128x64 OLED Display with SSD1306 driver chip, connected via SPI connection and using the u8g library to draw pixels. The 10k potentiometer is connected to A0 analog input and the value is used to draw the correct tickmarks and labels on the display.

Coincidently, this project looks great on yellow/blue OLED display. On this display, the first 16 pixels are yellow, while the rest of the screen is blue. The selected design works perfectly because the big top value on top only covers the first 15 pixels. I actually think that line 16 is not visible on the display, but we are not drawing anything on that line!

Compared to the previous version, I´m also using the much bigger knob. Same as the last time, this is a solid metal aluminum knob - link above. There are similar knobs that are plastic with a metal coating, but those look and feel cheap. The selected knob is very heavy and nice to touch. We also don´t have much problem with the placement. This big knob covers almost half of the screen without too much trying.

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, reading the video description and I hope to see you next time. Good luck with your projects!

-----------------------------------------------------------------------------------------------------------------------------

#wokwi #oled #arduino

Keywords related to this video:
Arduino UNO, Arduino, OLED, u8g, u8g2, SSD1306, SSD1309, Arduino Display, Arduino Free Code, Wokwi emulator, Gauge, Meter, Knob, Potentiometer, Arduino, esp32, arduino project, arduino OLED display, Arduino display, Arduino OLED, OLED Arduino, ssd1306 OLED display, ssd1309 OLED display, arduino ideas, new project ideas, Arduino 2022, arduino oled 128x64, arduino project 2022, arduino project ideas, Arduino tutorial, microcontroller, ssd1306 Arduino, arduino projects for engineering students, arduino based projects, microcontroller projects, cool projects, mini project using arduino, arduino mini projects, electronics projects using arduino, how to make arduino project, arduino uno projects for beginners, projects with arduino, projects using arduino, project using arduino, arduino based projects for final year
Рекомендации по теме
Комментарии
Автор

@upir In order to avoid the "blurring" happening when resizing down the image 13:22,
just change the interpolation to "Nearest neighbor" instead of the default value "Bilinear".
You'll get a crisp resize without pixel loss this way. :)

jmdeejay
Автор

A couple more optimizations that you can try:
1. It looks like you write nothing to the last page of vram, so you should be able to skip it entirely (i.e. change your while loop to end on page 6)
2. You can unroll your loop to avoid any if-statements and reduce costly branches.

Edit: I just tested both of these optimizations out on WOKWI and got very promising results. 23 FPS MINIMUM on the simulator. I'd test it out myself for real, but I don't have the hardware. I'm assuming that would net you >30 FPS consistently on real hardware.

Here's a wowki project with the optimizations applied: 330316460209472082

LimitedWard
Автор

Great optimizations! I'm wondering if using the three-parameter call to the SPI initializer might be even faster; the version you're using may use software SPI under the hood in u8glib. Here's the 3-parameter one: U8GLIB_SSD1306_128X64(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)

ericoesterle
Автор

Awesome! That speed and UI is great! First time I've seen that simulator too. Might have to try that for my next project.

syber-space
Автор

Wow! The Quality of this Tutorial/code review is on another level, thanks! Please do more!

philsponsel
Автор

This ongoing project is pretty awesome and inspired me to get going with some creativity in my own project. Thanks for the videos!

ShamanthS
Автор

Congrats on your project making it on the official arduino company weekly newsletter. This is the first time I can say I built something before it came out in the newsletter

toddroles
Автор

Hey, I just want to say thank for sharing this knowledge for free. I'm a mechanical engineering student with an interest in electronics; needless to say, I don't have enough time to organically learn this stuff through traditionally "read a book, then learn from your mistakes."
Without people like yourself, I would have never of bought my first microcontroller and programmed my first OLED.
Once again, Thank you.

g_rr_tt
Автор

You made me subscribe for the first time! Respect for all your great videos 👍👌

saeedrakhshani-sx
Автор

oh my god this channel is fantastic!!! i cannot wait for more content!

retronexusnet
Автор

Thank you for sharing. I just discovered your channel and it's super helpful and gives nice inspiration. For someone like me, who never "learned" programming in a traditional way and just learns it by trial and error and the growing experience from each hobby project I do it was also a great example on using arrays. 👍

Leif_YT
Автор

Looks really nice ! The bigger knob works great too (no indicator helps).

davelordy
Автор

Learn something today, happy. Very nice.

VoeViking
Автор

Nice Project, I really like the look of it.
I'd recommend to buffer the displayed value and only update it / rerender when the measured value deviates by a value of more than 0.1 or 0.2.
This way you should be able to get rid of the jitter.

miege
Автор

Stunning. I will keep your project in mind if I need a nub in my project with display 🔥🔥🇩🇪

BooBar
Автор

Works very nice, like it, respect :o)

jankomuzykant
Автор

I love this effect, would look sweet on a high end stereo! These little oleds burn in hard though if you leave them on all the time. I used them for thermometer displays and they all turned into garbled messed after a year

Diamonddrake
Автор

The repeated drawing for each page is a compromise to save RAM, but the entire buffer is only 1KB, so if you don't need that RAM for anything else you can change the number of pages and only draw once (or twice to reduce RAM use to 512B).

It also looks like you're using `int` a lot, which is 16-bit on AVR. For any values that can be 0-255 or -127-128 you'll halve the number of instructions for any operations on those by using an 8-bit type (uint8_t or int8_t), since the CPU can only work on 8 bits at once.

Using floats on AVR is also a big slow down, but trickier to substitute here in a beginner friendly way

StephenHoldaway
Автор

Great optimization, thanks for the video!

НикиГенов-ьф
Автор

@upir - fantastic tutorial!
You’ve inspire me to create universal modbus - transmitter simulator (:

rraftek