ESP32 MicroPython OLED Tutorial with ADC & FTP

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ค. 2024
  • This MicroPython tutorial demonstrates how to connect and drive a color SSD1351 OLED display using an ESP32. It also includes using the ADC to read analog signals and FTP for file transfers.
    All the code, schematics, notes and updates are available on my website: www.rototron.info/raspberry-p...
    This is part 4 of an ESP32 MicroPython seriers.
    Part 1 (Set Up & NeoPixels): • ESP32 MicroPython Tuto...
    Part 2 (MQTT & Sensors): • ESP32 MicroPython MQTT...
    Part 3 (Web Server): • ESP32 MicroPython Web ...
    Playlist for all videos: • ESP32 MicroPython Tuto...
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    These tutorials are great, you cover the topics very throughly and then add more interesting info.

  • @Alex-sr8kx
    @Alex-sr8kx ปีที่แล้ว +1

    This was a literal lifesaver trying to get a SPI protocol OLED working with my PICO, newcomer and found the documentation difficult on other projects. Thank you so so so much!

    • @mimivrc4148
      @mimivrc4148 2 หลายเดือนก่อน

      which OLED did you get working on a pico? I'm trying to find a color oled that works on pico!

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

    Thanks for doing these tutorials! Please keep them coming - It's a pleasure to learn from you at this fast pace - they are engaging and my mind doesn't drift off )

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

    Neat, pure, simple and right on target. I couldn’t ask for more.

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

    Your videos are really packed with accurate and precise information. Thank you very much. All the best to you.

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

    Great tutorial, it helped me to make it work on rpi pico with the OLED display SSD1309

    • @tinker7722
      @tinker7722 3 ปีที่แล้ว

      th-cam.com/video/iUGry0O3XXI/w-d-xo.html

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

    Another great tutorial, your series is the best. Thanks!!

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

    Great tutorial actually the course I needed !

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

    Highly appreciated work man. keep it up! :)

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

    that's so cool~ great tutorial! thanks very much!

  • @casio007
    @casio007 6 ปีที่แล้ว

    Great video! I am going to look at the upython closer

  • @cam_DA_Hawkdriver
    @cam_DA_Hawkdriver 4 ปีที่แล้ว

    Would love to hear about your background and education. I’m just playing around with some of this stuff, but you’ve got some real knowledge. Thanks for what you do!

  • @elucas1234
    @elucas1234 6 ปีที่แล้ว

    Very very good video. I will need to deep dive into the code.... Tks for share it with us.

  • @meggrobi
    @meggrobi 4 ปีที่แล้ว

    very good tutorials :)

  • @daslolo
    @daslolo 6 ปีที่แล้ว

    Love the 6.8 pF capacitor. How does this magic smooth the signal?

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

    I love your videos. Can you please make a video tutorial for using the UART library? I am having a hard time making the jump to micropython and circuitpython to get a Trinket M0 talking to an ESP32. The commands don't seem to be very similar to the Arduino librarys.
    Thanks so much for your tutorials, they are incredibly helpful. Loved getting the MQTT stuff working.

    • @rdagger
      @rdagger  6 ปีที่แล้ว

      I was planning on a doing a UART video. I created a MicroPython library for the JQ6500 audio player on GitHub. The code contains good examples of using the UART on an ESP32. github.com/rdagger/micropython-jq6500

  • @RTmadnesstoo
    @RTmadnesstoo 5 ปีที่แล้ว

    Sprite ! I haven't heard that term since I was fooling with a Comadore 64.
    Great video. I'll be watching this about a dozen times in an attempt to pick up some of your tricks.
    Where would you go to learn about I2C and SPI?

    • @rdagger
      @rdagger  5 ปีที่แล้ว

      I made Raspberry Pi tutorials that focus on I2C and SPI: th-cam.com/video/i5A5AsDRRwQ/w-d-xo.html and th-cam.com/video/npSwLOMfstY/w-d-xo.html
      For MicroPython specific info you can check out the docs: docs.micropython.org/en/latest/library/machine.I2C.html and docs.micropython.org/en/latest/library/machine.SPI.html
      The LoBo build also has excellent I2C and SPI libraries: github.com/loboris/MicroPython_ESP32_psRAM_LoBo/wiki/i2c and github.com/loboris/MicroPython_ESP32_psRAM_LoBo/wiki/spi

  • @MrKristian252
    @MrKristian252 6 ปีที่แล้ว

    This looks really complicated. But the Idea is cool

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

    Thanks for creating all this! It's amazingly useful info, and enabled me to dive into this stuff in a way I've never been able too before!
    By the way, how feasible do you think it might be, to use your SSD1351 library to write a micropython equivalent of of the Uncanny Eyes project? Would it be fast enough to do that? I mean sure, I could probably just get the C version working if I had too, but personally I hate working with C.. So it might be a fun challenge to create my own version for micropython, if that's even possible. heh
    Also side note, I get a "Unicode Error" when demo_fonts example tries to load the neato font.

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

      BTW, in regard to the Uncanny Eyes idea, do you think I'd need to create a blit function to achieve that? Or some other way to load image data, manipulate its array to select which parts to use, then output to screen.. The standard uncanny eyes code uses some gradient images to do the blinking, and it seems like a very efficient way to do things, if I can replicate it in micropython.

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

      I'm not familiar with the Uncanny Eyes project. I took a cursory glance, and it would probably take a lot of optimization to get it to work in MicroPython. I think there is a blit function. I made the video 6 years ago, so I don't remember if the blit function was performant. Your best bet would be a fast board with a lot of RAM. I'm working on some SPI optimization for a new current project (doesn't involve graphics). I might throw together a quick video.

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

      @@rdagger Ah cool, might be interesting to see!
      I've been tinkering around with a Raspberry Pi Pico W lately, and I'm fairly sure it can handle it. Tho typically the ESP32 seems to be commonly used for it, same goes for the SSD1351. Glad I got it, I like this screen so much I got a second one cause they were on sale. Could make for an amazing Halloween prop, or maybe a smartwatch for a future project. heh
      Course I may just give in, and deal with C++, so I can use the real Uncanny Eyes. I'm sure whatever I could manage in micropython wouldn't hold a candle to the original adafruit project, and it'd likely perform better anyway.
      Edit: Actually, I think I might be able to get closer to achieving this, if I do most the work in a framebuffer first, since that has a blit function with transparency support. @BytesNBits did a video on micropython's framebuffer, and actually used it to improve the performance of your bouncing boxes demo quite a bit! ;)

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

    CTRL-SHIFT-C and CTRL-SHIFT-V copy and paste in the terminal. Selecting a file and pressing enter in FileZilla will transfer the file

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

      I get that a lot but it makes the videos harder to follow if I use too many shortcut keys.

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

      @@rdagger Ah, I see

  • @ahmedbelfakir6688
    @ahmedbelfakir6688 4 ปีที่แล้ว

    Can you please make a home automation system

    • @rdagger
      @rdagger  4 ปีที่แล้ว

      I made a video 5 years ago showing how I automated a fountain using Python and a Raspberry Pi: th-cam.com/video/D3L9L6Itig4/w-d-xo.html

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

    By the way, according to other documentation I'm seeing out there, the screen's chip supposedly limits Baudrate to 16,000,000. And personally I'm not noticing any difference between 14.5mhz and 16mhz when I test between the two. Maybe things were different for older versions of this screen? And I don't suppose either changes the life-span of the screen?

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

      Depending on your MicroPython board and your frequency settings, the actual SPI baudrate may not equal the passed value because the clock divider must be an integer. You can view the actual baudrate by using print(spi) after initialization.

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

      @@rdagger Ah, okay cool, thanks for the info! I'll give that a check.
      BTW, I was indeed able to recreate the Uncanny Eyes project in MicroPython! Works pretty darn good now too. Had to use a build of MicroPython with ulab included, for numpy functions like 'where'. Plus numpy enables me to load lower resolution eyelid gradients for both eyelids, to fit them into the Pico's remaining memory after micropython.. Then process their current blink state, and upscale them and blit them over the iris framebuffer. Also, a minor overclock to 200mhz smooths out the framerate nicely. Honestly shocked I was able to replicate the majority of the project in like 60 lines of code. heh

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

      @@NikoKun That's great! You should post a link.

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

      @@rdagger Sure, tho youtube tends to not let me post links for some reason.. So on GH I go by Nikorasu, and the project's repo is called NicoEyes. Hope it's okay that I included your SSD1351 library in the project, for now for ease. Also, still working on the ReadMe file. heh

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

      github.com/Nikorasu/NicoEyes
      Look forward to trying your project!
      fyi: Posts with links are held until the owner of the channel approves them. I often don't notice the held posts for several days.

  • @shawnlee2811
    @shawnlee2811 6 ปีที่แล้ว

    Where do you learn python from? Online learning like datacamp doesn't work for me,they are to hard to use.

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

      Python wasn’t my first language. Once you know 1 programming language it’s much easier to learn another. I taught myself to program in basic on a Z80 when I was 9. I started by copying and modifying code for simple games from books and magazines (this was before the Internet.) I was really into adventure games. The first program I remember writing was a simple graphic adventure (think Atari) based on a Gothic horror short story. I think the best way to learn anything is with a fun project. For example, I taught myself woodworking by building an arcade cabinet. Having a goal that you enjoy motivates you to acquire new skills. Watching videos is a great way to immerse yourself in a field, but you have to actually write code if you want to build proficiency.

  • @sanatana_dharmam18
    @sanatana_dharmam18 5 ปีที่แล้ว

    how to connect esp32 to raspberry pi without using without using USB cable to transfer the data to web server to get temp and humidity values

    • @rdagger
      @rdagger  5 ปีที่แล้ว

      I have several relevant tutorials:
      www.rototron.info/raspberry-pi-esp32-micropython-web-server-tutorial/
      www.rototron.info/raspberry-pi-esp32-micropython-websockets-tutorial/
      www.rototron.info/raspberry-pi-esp32-micropython-mqtt-dht22-tutorial/

  • @Parapascal
    @Parapascal 6 ปีที่แล้ว

    The esp32 has two ADCs - ADC1 and ADC2 but it seams that only ADC1 is supported in micropython. Thats sad because all the ADC2 Pins are on the one side that i wanted to use in my tutorial. Does anyone know why ADC2 is not supported?

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

      You can only use ADC2 only when the Wi-Fi driver is not started because the driver uses ADC2 and it has a higher priority. Also some of the ADC2 pins are used as strapping pins (GPIO 0, 2 & 15) which are reserved by some development kits.

    • @Parapascal
      @Parapascal 6 ปีที่แล้ว

      Thank you. Didn't know that

  • @florians5694
    @florians5694 7 หลายเดือนก่อน

    kein clone link würde reichen!

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

    youtube has removed my post, i was just asking how to use you img2rgb656 program i have installed pip and pillow ect but have no idea how to call your program from cmd and then tell it to convert my image

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

      python img2rgb565.py
      is the full path to the image file you want to convert

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

      i just keep getting this error
      C:\Windows\System32>python img2rgb565.py
      The syntax of the command is incorrect.
      C:\Windows\System32>

    • @rdagger
      @rdagger  21 วันที่ผ่านมา

      @@philoffhistree6700 Angle brackets < > are commonly used to indicate a placeholder, which means that you need to replace the text inside the brackets with the actual value, without including the brackets themselves: python img2rgb565.py C:\Users\ppap\AppData\Local\Programs\P
      ython\Python38\Scripts\honda_colour.jpg
      Also, when you post to TH-cam, don't ever include country code top-level domains (ccTLDs) such as .cn, .ru, .kp or .py in your comment because TH-cam will automatically place a hold on it.

  • @daslolo
    @daslolo 6 ปีที่แล้ว

    Does the ESP32 have only 1 ADC pin?

    • @rdagger
      @rdagger  6 ปีที่แล้ว

      No, GPIO's 32-39 can be used as ADC inputs. If Hall sensor is used, GPIO 36 & GPIO 39 cannot be used as ADC inputs at the same time.

    • @daslolo
      @daslolo 6 ปีที่แล้ว

      Thank you.

    • @daslolo
      @daslolo 6 ปีที่แล้ว

      So those ADC are pretty noisy, I see that the m5stack has an oscillo extension, how good can this be, you think?

    • @rdagger
      @rdagger  6 ปีที่แล้ว

      There are solutions to address the noise. I haven't tried the m5stack. The Loboris build allows you to route the reference voltage to an external pin for measurement. The gain and offset factors of an ESP32 module's ADC are calculated using the reference voltage and the Gain and Offset curves provided in the lookup tables. Nominal voltage reference is 1100 mV, and can be adjusted to compensate for ESP32 chip differences.

    • @daslolo
      @daslolo 6 ปีที่แล้ว

      This would address the non linearity, but to address noise, wouldn't you need to smooth the signal and therefore lose resolution?

  • @daslolo
    @daslolo 6 ปีที่แล้ว

    How do you add an sd card in an ESP32?

    • @rdagger
      @rdagger  6 ปีที่แล้ว

      The Loboris build has support for SD cards: github.com/loboris/MicroPython_ESP32_psRAM_LoBo/wiki/filesystems

    • @daslolo
      @daslolo 6 ปีที่แล้ว

      Thank you. Once I receive the m5stack I'll go through your tutorial to install this build of python on it. By the way, I read some benchmarks that show 10x slowdown compared to C when it comes to reading analog input, are there ways to mitigate this?

    • @rdagger
      @rdagger  6 ปีที่แล้ว

      I remember reading the same thing but I'm not sure if there was a satisfactory resolution. I'd post your question to the Loboris forum: loboris.eu/forum/index.php

    • @daslolo
      @daslolo 6 ปีที่แล้ว

      Great, I just registered, will wait for forum access. Now the ESP32 has 2 cores, from what I gather core 0 is the one that has access to the hardware IO, what's your experience with multi core programming?

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

      It's my understanding that currently the MicroPython runtime is not efficient with respect to running python code on multiple cores. This should improve in the future. However Free-RTOS and MicroPython services (written in C) can definitely take advantage of the dual cores. This allow your MicroPython code to run on 1 core while system tasks like Wi-Fi run on the other, or services such as MQTT, Telnet and FTP run in parallel.