Raspberry Pi Pico W LESSON 25: Getting Started with OLED 1306 in Micropython

Поделиться
HTML-код
  • Опубликовано: 4 янв 2025

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

  • @jbelmont72
    @jbelmont72 Год назад +3

    For those of you running into error messages. the below may help.
    I solved this error message by running the I2C scanner, found my OLED is on 0x3d.
    I didn't know how to specify the address which I guess in the example finds it by default.
    What worked for me is:
    oled = SSD1306_I2C(128,64,i2c,addr = 0x3d)
    I hope this spares others the pain I had. I thank you all for your help. Much appreciated.
    This is the error I was getting. Searching the internet, I see others had the same problems and all the posts I read just ended without satisfactory resolution.
    MPY: soft reboot
    Traceback (most recent call last):
    File "", line 24, in
    File "/lib/ssd1306.py", line 110, in __init__
    File "/lib/ssd1306.py", line 36, in __init__
    File "/lib/ssd1306.py", line 71, in init_display
    File "/lib/ssd1306.py", line 115, in write_cmd
    OSError: [Errno 5] EIO

    • @RCWalletVacuum
      @RCWalletVacuum 9 месяцев назад

      Thanks for posting this very helpful solution!

  • @shadowbrookmedia
    @shadowbrookmedia Год назад +6

    Hi Paul, just quick note of thanks and encouragement. I am a retired EE trying to learn a few new tricks. I don;t normally like video tutorials - not how I learned for many years. Too many host with heavy British or Packi accents. I'm from the deep south and basically speak the King's English (the King is Elvis) We speak very slowly down here and most people don't know, we listen very slowly as well. As I age my hearing is flattening out making some dialogues difficult to follow. Yours is spot on for me!! A year or so or go I had two massive strokes. (according to brain scans - I had no idea) No motive issues - all damage inside my head - the attention span dropped dramatically and memory issues surfaced. Was writing Python code for medical products -but had to quit - added too much stress to trying to work and keep a schedule. Now that I'm coming back with the Arduino things are clearing up and making sense again. Your patient approach is very helpful. Keep it up and thanks again

  • @rickbonari4493
    @rickbonari4493 Год назад +1

    I am legend. Figured out how to do this and like you I love these little displays. They have alot of capabilities to enhance projects and are fun to experiment with to boot. I don't post anything to youtube but I can assure you I was able to do this. Had to do some research. Thanks for a great series on pico w. No one on the internet can match your knowledge and teaching capabilites and explain things in a clear and concise way like you do !!!! Thanks again. You are the very BEST !!!!!

  • @edSabio572
    @edSabio572 5 месяцев назад +1

    Hi Paul! Just revisiting your lesson for lesson 78. The second time around found things missed the first time...Thanks Again!

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

    Hope Ant had had a sip of ice coffee too.. This video helped me a lot. spend a day testing other samples could not make it work till this lesson. Thanks.

  • @Ed-fv9rl
    @Ed-fv9rl Год назад

    Thanks Paul! This was my longest lesson but most productive. Had to download the ssd1306 directly, without the tools menu and used pin 0 and 1 to make it work. Still here.

  • @masman1st
    @masman1st 5 месяцев назад +1

    Been doing these with the Pico W Sunfounder kit. "They are great by the way!" Recently purchased some ESP32 wroom dev boards, so thought I would give them a try. They are not as ready to go as the Pico W out of the box. But after a little research I was able to do this on the ESP32 in Thonny with the same script for the Pico W. Gitty Up!

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

    bravo Great Lesson. Thank You for taking the time to show the basic functions of the display/library.

  • @Bob-zg2zf
    @Bob-zg2zf Год назад

    So beautiful. The scenery. I mean The River Nile.

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

    I AM LEGEND! I like the SSD1306 display. When I received mine I studied enough to learn its basic operation. My 50 pixel circle is missing a top and bottom, but my 25 pixel version fits the screen fine (although somewhat oval). Thanks Paul for showing us how to use this little display.

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

    great video Paul!

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

    Thanks Paul! That was really cool.

  • @keithlohmeyer
    @keithlohmeyer Год назад +1

    Here is my deep dive into ways to plot a circle. ruclips.net/video/3VroWb0Zr3g/видео.html
    I show 6 different algorithms and time each to see which is fastest.

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

      Very interesting. Lots of ways to skin this cat.

  • @louistoweill4232
    @louistoweill4232 8 месяцев назад

    I replaced the OLED display with a new one and the circuit worked this time.

  • @todd3c
    @todd3c 10 месяцев назад +1

    I have 2 dds1306(s). how do I change the address of the 2nd one so I can define both and have 2 different displays going? thank you.

  • @videonewschannel1212
    @videonewschannel1212 9 месяцев назад

    Here is a solution to the non-working OLED issue many have been experiencing. After finding out that my uctronics OLED display works fine on the Arduino platform and is not discoverable (I2c.scan() returns null) on the pico w platform, I thought perhaps it is a voltage issue since Arduino runs 5V and pico 3.3V.
    Problem solved by powering your OLED Vcc with 5V from any 5V source (eg. arduino board or breadboard power supply). Just remember to tie the grounds together (Pico w and other source).
    This also allows you to use any of the I2C channels (0,1) ...
    Bottom line its either a hardware issue specific to the UCtronics OLED which is sold on Amazon or the pico 3.3V is not quite 3.3V. The UCtronics OLED device documentation states it works 3.3 to 5V but apparently not.
    Thanks Paul for your suggestion of I2C.scan()

  • @davidkahan
    @davidkahan 27 дней назад

    worked ! even without the ant :-)

  • @EskandarSaraie
    @EskandarSaraie 9 месяцев назад

    Traceback (most recent call last):
    File "", line 1, in
    ImportError: no module named 'ssd1306'

  • @larryplatzek9017
    @larryplatzek9017 Год назад +2

    Loading ssd1306 does not work for me 12-07-23. Things must have changed, can anyone tell me the correct way to install? Thank you!

    • @todd3c
      @todd3c 10 месяцев назад

      I just copied it and saved it as ssd1306.py

    • @EskandarSaraie
      @EskandarSaraie 9 месяцев назад

      I got the same problem. not being able to download ssd1306. did you find any solution?

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

    Hello Paul! I have a couple of lcd displays lying around, could they work for this future lesson or should I get an oled screen instead?

    • @paulmcwhorter
      @paulmcwhorter  Год назад +2

      I would really suggest get the OLED. It has major advantages over the LCD and is only about $5

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

      @@paulmcwhorter Thanks, I'll get one

  • @louistoweill4232
    @louistoweill4232 8 месяцев назад

    Even though I think I followed all the steps exactly, my OLED display does not work and I do not know how to run the I2C scanner if that might help.

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

    Great lesson!
    What happened to that ant? 😂

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

    Looks like I messed up during my bought and got an SH1106 1.3" screen, gotta make it work with a different driver, cause my SSD1306 is really small, just 0.69"...

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

    hello Paul. Do you have any courses about Django?

  • @ctlancearrowlarson8237
    @ctlancearrowlarson8237 Год назад +1

    When I go to the package manager, and search ssd1306, I get this message. Could not find the package info from PyPl. Error code:

    • @paulmcwhorter
      @paulmcwhorter  Год назад +2

      Your computer appears to be objecting to the security certificate of micropython. Find the library on github, ssd1306.py. Copy it and paste it into thonny. Then save the file to ssd1306.py on your pico. It should then be there for you to use.

    • @EskandarSaraie
      @EskandarSaraie 9 месяцев назад

      "ImportError: no module named 'ssd1306'" does show up after copy and pasting it into thonny.

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

    Hey Paul. A very off topic question. You appear to live in a dark sky area. Do you check out the stars, milky way, planets,nebula?

    • @paulmcwhorter
      @paulmcwhorter  Год назад +2

      I had a telescope as a kid, but it never turned into a passion for me. So no, no atronomy going on here.

  • @EskandarSaraie
    @EskandarSaraie 9 месяцев назад

    installing it come up with version 0.1.0 version only and error while loading it!

  • @davidh1187
    @davidh1187 9 месяцев назад

    My OLED does not work with channel 1 Pins 2 and 3 (throws lots of ssd1306.py errors) but it does work channel 1 pins 6 and 7 as well as channel 0 pins 0 and 1

  • @ErlankBru
    @ErlankBru Месяц назад

    Got this smaller screen to work after it seemed my 128×64 display failed me.
    This is not the homework yet. I will try to start post my homework more often than never.🤭
    Here is the link:
    ruclips.net/video/7AvUwl-ElIk/видео.htmlsi=pJKICxZewNxups46

  • @EskandarSaraie
    @EskandarSaraie 9 месяцев назад

    ssd1306 does not work by following your instructions, any help?

    • @robertbowman6599
      @robertbowman6599 9 месяцев назад

      The installation failed in Thonny. I prefer VS Code. I created a venv in my work directory
      python3.10 -m venv pico_code
      cd pico_code
      . bin/activate
      python3.10 -m pip install pipkin
      then with neither thonny or code connected
      pipkin install micropython-ssd1306.
      pipkin detects the Pico board and installs /lib/ssd1306.py
      connect with VS Code and run the example.
      it may have been my wiring but I wound up using I2C0 sda/scl on physical pins 1 and 2 so I have
      i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
      The rest is the same.
      I don't know why the install from Thonny failed There were a lot of cryptic errors. I had also downloaded ssd1306.py and copied that to the Pico. I think at that time I had a wiring problem since it failed in write_cmd()
      It took a lot longer than it should have but I did learn about pipkin which seems to be a relatively easy way to install libraries without thonny.

  • @EskandarSaraie
    @EskandarSaraie 9 месяцев назад

    down loading ssd1306 does not work.

  • @AviSchwartz1
    @AviSchwartz1 7 месяцев назад

    For me channel 1 gives an [Errno 5] EIO error while channel 0 works fine.

    • @paulmcwhorter
      @paulmcwhorter  7 месяцев назад

      Dont understand why, but seems some OLED only work on channel 0 for me. Not sure what is going on.

    • @PMART77
      @PMART77 2 месяца назад

      This also worked for me. Using GPIO pins 4,5 and channel 0 remedied the issue immediately.

  • @deeperlook3234
    @deeperlook3234 Год назад +2

    Kudos for the comprehensible explanation! But did you realize you had a bug? 😁 You can clearly see it escaping from the display to the right at ruclips.net/video/6SdNvqofWww/видео.html

  • @pralaymajumdar1206
    @pralaymajumdar1206 10 месяцев назад

    Just one symbol I want to share with you sir that is❤..

  • @arnoldschmucker9977
    @arnoldschmucker9977 Год назад +2

    Redid it based on Paul's suggestion. ruclips.net/video/4lWXIBPwA8c/видео.html

  • @keithlohmeyer
    @keithlohmeyer Год назад +1

    Looks like I am 3rd to post a video showing the the built in method. ruclips.net/video/mg9fBHhFQmw/видео.html
    Charlotte and Lori got the jump on me as I was doing a deep dive into ways to code a raster circle. That video will post shortly.
    Thanks Paul for all you do.

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

    At 17m30s I think I saw a bug in the system😁

  • @bigbogeyface
    @bigbogeyface Год назад +4

    Here's my homework:
    ruclips.net/video/zybl-Jmnm0I/видео.html
    I made three:
    ruclips.net/video/jW01OkOuoKE/видео.html
    This is my favourite 👇 🌧 😌 :
    ruclips.net/video/HBolAtKLQh4/видео.html
    I also made this:
    ruclips.net/video/EjdEA_PKU10/видео.html
    I think it's cool 😎 anyhow 🤷

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

    I'm not uploading a video since I let BARD (Google's AI) helped me with the solution. BARD gave me a function for a filled circle. Changing the

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

      Interesting approach, and very different than my solution. Mine is based more on simple math. This is sort of try all possibilities, and keep the ones that match the conditions.

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

      @@paulmcwhorter OK simple as in easy math to code or simple as in NOT needing the math module? I took a deep dive and I am trying to wrap my mind around midpoint circle algorithm and the Bresenham circle algorithm that use addition, subtraction and multiplication to define the pixels for a circle.

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

      Really, I see the simple way to do it is just step through the angles 0 to 360 and then calculate the x and y value of each pixel. x=r*cos(angle) and y=r*sin(angle). Simple as that. All the solutions I have seen so far do special cases for the different quadrants, but above approach does it all in one for loop. You do need to then adjust x and y to get the circle in the middle of the display.

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

      @@paulmcwhorter Yes that will work ok with the more powerful mcu like the Pico. Doing 360 sin and cos functions can slow an old 8 bit mcu down even in Arduino C++. I am going to try doing some timings for the different algorithms and post a video. Someone used the sin and cos method to draw a small circle for the degree symbol. Because it was so small the circle was represented by maybe a dozen pixels. It worked but that was a lot of processing for so few dots.

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

      @@paulmcwhorter You haven't introduced any math libraries. I was planning to give a Sunfounder kit to my 11 year old great grandson and suggest the course to him. I doubt that he has had any trig.

  • @hoellenstein
    @hoellenstein 7 месяцев назад

    Today, I received the tiny display. Eager to connect it, loading the library, writing the code, checking all parameter and voila, it didn't work. Received only cryptic error messages.
    My OLED display is on 0x3c, on the backside of the oled one can see it and figure that out (if you have perfect eyesight or a magnifying glass)
    Others in this comment section tried different addresses but no success for me.
    Eventually, after couple of hours frustrated re-connecting, re-wiring, trying to download different libraries, connecting to different GPIO Pins, it worked. So,
    i2c = I2C(0, scl=Pin(17), sda=Pin(16)) was it for my tiny displays.
    To draw a circle, I know there are certain formulas to use, but I simply asked chatGPT and the code worked immidiately. I know, I cheated this time...
    😝

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

    You resemble James Cameron

  • @davidh1187
    @davidh1187 9 месяцев назад

    Didn't know the math to generate the points of a circle so had to look it up which effectively gave the whole solution - not sure that is worthy of posting a video for what would have effectively been a copy and paste...... Found 2 solutions - one for a filled circle and the other just for the outline. Here is the solution for the record ruclips.net/video/h_NTJzXIz94/видео.html

  • @DrDave327
    @DrDave327 Год назад +2

    Hey, Paul! More great content from you, as usual. Thank you. Here is my solution to the homework:
    ruclips.net/video/OzgJsiFD8aQ/видео.html

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

      LEGEND!

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

      Nice job. Thanks for all the mentions but I have not posted my video yet. I am digging way too deep on this. I think my comment thread on William's video might have confused you.

  • @karliskide2460
    @karliskide2460 Год назад +2

    Thank you for the amazing lesson! This homework took me a while. Anyways - here is my homework assignment: ruclips.net/video/yOo-CS_V3mo/видео.html

  • @LorisHW
    @LorisHW Год назад +3

    A bit "under the weather" this week. Finally got this homework done. Thanks for the lesson Paul! ruclips.net/video/-lTU_bQyTZU/видео.html

  • @daveslack2755
    @daveslack2755 10 месяцев назад

    Love these displays. Can't take credit for this homework. New the circle math involved sin and cos but could not remember it and had to google for the calculations. Then had to study them and understand before using. homework ruclips.net/video/0_cbYYYt7hg/видео.html

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

    What a wonderful little display at the right hobby price. 🪐 Thank you.

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

    this PRIME day 2023 sales on KEPLER kit!

  • @videonewschannel1212
    @videonewschannel1212 10 месяцев назад

    using identical hardware and library/ code we get library error
    File "", line 7, in
    File "/lib/ssd1306.py", line 110, in __init__
    File "/lib/ssd1306.py", line 36, in __init__
    File "/lib/ssd1306.py", line 71, in init_display
    File "/lib/ssd1306.py", line 115, in write_cmd
    Anyone have suggestions! I even tried a second new 1306 display!

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

      I had the same problem. I solved it by moving the sda and scl to channel 0 and change the code.
      from machine import Pin, I2C
      from ssd1306 import SSD1306_I2C
      import time
      i2c = I2C(0, sda=Pin(0), scl = Pin(1), freq = 400000)
      dsp = SSD1306_I2C(128, 64, i2c)
      msg = 'Hello World!'
      dsp.text(msg, 0, 0)
      dsp.show()
      Hope this helps

  • @320mb
    @320mb 2 месяца назад

    Here is my Code for Posterity ... for some reason I have to include Pin(16) which is a TX pin... not sure why yet but i am going to research this and find out.... LOL
    from machine import Pin, I2C
    import sh1106
    i2c = I2C(1, scl=Pin(15), sda=Pin(14), freq=400000)
    display = sh1106.SH1106_I2C(128, 64, i2c, Pin(16), 0x3c)
    display.sleep(False)
    display.fill(0)
    display.text('Hello, world!', 10, 10, 1)
    display.show()

  • @Miko_Jones
    @Miko_Jones 4 месяца назад

    Hi, I realise I'm a year late with my homework, but the dog ate it! 😂
    well here it is anyway!
    I realise Paul hasn't introduced us to the math library in micropython yet but a I figured there must be one and a quick google search turned up the results. I hope using google isn't cheating, if it is, then I'm an unrepentant cheat!
    import math
    from machine import Pin, I2C
    from ssd1306 import SSD1306_I2C
    i2c=I2C(1, sda=Pin(2), scl=Pin(3), freq=400000)
    dsp=SSD1306_I2C(128,64,i2c)
    msg="Hello World!"
    msg2="its Circle time"
    def draw_circle(x0, y0, r):
    # Calculate the angle step for the circle approximation
    angle_step = 0.05 # Adjust for desired precision
    angle = 0 # Start angle
    angle_end = 2* math.pi #end angle
    while angle < angle_end:
    x = int(x0 + r * math.cos(angle))
    y = int(y0 + r * math.sin(angle))
    dsp.pixel(x,y,1) # Draw a pixel at x, y
    angle += angle_step
    dsp.text(msg,0,0)
    draw_circle(64, 32, 20)
    dsp.text(msg2,0,56)
    dsp.show()

  • @FranciscoCruz-jg7gc
    @FranciscoCruz-jg7gc 3 месяца назад

    This is my solution to the error people comment about:
    import machine
    import ssd1306
    from time import sleep
    i2c = machine.SoftI2C(scl=machine.Pin(3), sda=machine.Pin(2))
    reset_pin = machine.Pin(16, machine.Pin.OUT)
    reset_pin.value(0)
    sleep(0.1)
    reset_pin.value(1)
    dsp= ssd1306.SSD1306_I2C (128, 64, i2c)
    dsp.fill(0)
    msg='hello3 World'
    dsp.text(msg,0,0)
    dsp.show()

    • @ErlankBru
      @ErlankBru Месяц назад

      I'm still getting this error, maybe I should buy another oled and see... :
      MPY: soft reboot
      Traceback (most recent call last):
      File "", line 10, in
      File "/lib/ssd1306.py", line 119, in __init__
      File "/lib/ssd1306.py", line 38, in __init__
      File "/lib/ssd1306.py", line 75, in init_display
      File "/lib/ssd1306.py", line 124, in write_cmd
      OSError: [Errno 110] ETIMEDOUT