Raspberry Pi Pico Tutorial: 16x2 LCD I2C Micropython

  Переглядів 24,160

NerdCave

NerdCave

День тому

Welcome to the - Learn how to use the Raspberry Pi Pico Tutorial Series:
This video looks at the 16X2 character LCD display using i2c communication and how to use it with the Raspberry Pi Pico.
In the first example we look at how to create custom characters and text and go in detail through the code. The second example looks at the Pico's onboard temperature sensor and how to read the temperature and display it on the screen.
Check out my channel for other videos on the Raspberry Pi Pico, as I will regularly upload tutorials and projects related to the Raspberry Pi Pico.
If you found this tutorial helpful, subscribe to the channel and leave a comment and welcome to the NerdCave.
Code:
github.com/Guitarman9119/Rasp...
Library:
github.com/T-622/RPI-PICO-I2C...
Custom Character creation:
maxpromer.github.io/LCD-Chara...
Chapters
0:00 Introduction + Demo
0:37 Components + Schematic
1:27 Example 1 and Code explanation
4:49 Example 2 and Code explanation
5:55 Outro

КОМЕНТАРІ: 96
@scott6169
@scott6169 Рік тому
Great tutorial. Easy to follow. Presented at a good speed too. Thanks
@NerdCaveYT
@NerdCaveYT Рік тому
Glad it was helpful!
@TheJavaSync
@TheJavaSync Рік тому
@@NerdCaveYT Thanlk You!! Nice tutorial anw +.perfect font size (from my phone cell) while You explaining the codes
@Kris-cd9qs
@Kris-cd9qs 9 місяців тому
completed ✅ nice project 👌 i wasn't even aware of the temp. sensor
@NerdCaveYT
@NerdCaveYT 9 місяців тому
it is not super accurate but okay for simple things
@rodrigodemarchi1184
@rodrigodemarchi1184 Рік тому
your videos are great, thanks for making them!
@NerdCaveYT
@NerdCaveYT Рік тому
Thank you
@chirots
@chirots 9 місяців тому
Excellent videos. Thanks for sharing knowledge.
@NerdCaveYT
@NerdCaveYT 8 місяців тому
Glad you like them!
@damianbutterworth2434
@damianbutterworth2434 Рік тому
Finally got it going. Thank you. Lots of swearing as normal and the final problem was a small c instead of a capital C. Thank you again now I can have a beer.
@NerdCaveYT
@NerdCaveYT Рік тому
Great, I sometimes forget to remove swear words in my code I left in as comments so understand exactly
@armand9910
@armand9910 2 роки тому
Epic! :)
@user-kk2ef3kv4h
@user-kk2ef3kv4h День тому
Will he receive time if he is not connected to a laptop or computer?
@frankjon306
@frankjon306 Рік тому
Fantastic, can you make a video abouth how use LCD and 4x4 Matrix keypad, thanks
@NerdCaveYT
@NerdCaveYT Рік тому
I will probably in the near future, I took a break from youtube but seeing how the videos are helping people and the support I will start to upload soon, I want to cover everything from start since most of my videos assume people can read schematics etc.
@briancooper2737
@briancooper2737 Місяць тому
@castellarb3348 I ran into the same issue. I googled the issue and one suggestion was to use a different i2c pinset. There are like 5 of them for i2c on the pico w. When I moved it to the next one down, GP2 and 3, the error changed to bad scl pin. I tried several others with the same result. I changed the pin assignments on line 11 as I went. I finally went back to the original GP0 and 1 pins and it worked. I am not sure why, but it did.
@NerdCaveYT
@NerdCaveYT Місяць тому
I recently also experienced issues with an OLED display where I got the error the pins needed to be connected to pullup resistor and once I soldered it again it seems to be working. I am expecting noise issues could be the cause.
@user-xp1mn8lq3n
@user-xp1mn8lq3n Рік тому
hi, thanks for the tutorial. does this work on 20X4 lcd ? i get blank address
@NerdCaveYT
@NerdCaveYT Рік тому
It should work is it an i2c LCD module?
@christianraulbarronbanos9200
@christianraulbarronbanos9200 Рік тому
Traceback (most recent call last): File "", line 12, in TypeError: function takes 5 positional arguments but 4 were given what can i do
@NerdCaveYT
@NerdCaveYT Рік тому
is this the line you are having problems with: i2c = I2C(0, sda=machine.Pin(0), scl=machine.Pin(1), freq=400000)
@Neodel
@Neodel Рік тому
i2c scan gives: (i am using circuit python) Traceback (most recent call last): File "", line 1, in ImportError: no module named 'machine'
@NerdCaveYT
@NerdCaveYT Рік тому
did you install micropython on the Pico?
@RareformKRozhkov
@RareformKRozhkov Рік тому
please link to the parts used in the description if not in the video itself
@NerdCaveYT
@NerdCaveYT Рік тому
I don't have links due to the parts I used I bought from Taobao, which is in China, where I am located; I don't want to put random links in the description or amazon links as I can not guarantee it is working correctly.
@amirphilip2234
@amirphilip2234 3 місяці тому
MPY: soft reboot Traceback (most recent call last): File "", line 6, in ImportError: no module named 'pico_i2c_lcd'
@NerdCaveYT
@NerdCaveYT 3 місяці тому
in the video I showed where to download the pico_i2c_lcd script and upload it to the pico
@tompaquette7138
@tompaquette7138 Рік тому
[62, 96, 112] this is my results. any idea which i should use? I tried all 3 individually with no luck. im using the waveshare 1602
@NerdCaveYT
@NerdCaveYT Рік тому
is this what you are getting for the i2c address?
@tompaquette7138
@tompaquette7138 Рік тому
@@NerdCaveYT yup
@mezmerizer0266
@mezmerizer0266 Рік тому
where does the code come from at 3:09? There's nothing like it present in any of the 4 files?
@NerdCaveYT
@NerdCaveYT Рік тому
it comes from example 1 : github.com/Guitarman9119/Raspberry-Pi-Pico-/blob/main/I2C%20LCD/example1.py
@mezmerizer0266
@mezmerizer0266 Рік тому
@@NerdCaveYT thank you. I was being a goofball. I forgot I named it with "pico" in front, then forgot to change the i2c address. Thanks kindly.
@robloxplayer_and_meowshit_3527
@robloxplayer_and_meowshit_3527 Рік тому
I need another help it's not turning on the lcd screen I don't know why I put it all the jumper cables where it is
@NerdCaveYT
@NerdCaveYT Рік тому
did you check the schematic diagram?
@nickrocco7726
@nickrocco7726 Рік тому
Traceback (most recent call last): File "", line 3, in File "lcd_api.py", line 8 SyntaxError: invalid syntax this is the shell i get when i try to run example 1
@NerdCaveYT
@NerdCaveYT Рік тому
from lcd_api import LcdApi did you include this to your pico the library?
@raspberryeditingvideo4331
@raspberryeditingvideo4331 11 місяців тому
could you find a solution?
@frontier9
@frontier9 Рік тому
stuck at ImportError: no module named 'board', already did sudo pip3 install adafruit-blinka which people said would install board.py. But then it was because i was trying to run the program as a main.py so ... noob error. Then in the examples (using Thonny on linux Ubuntu) i had to add import machine (also remove import ds1302) to make each example work
@NerdCaveYT
@NerdCaveYT Рік тому
Hi Michael, was a bit confused on the module board, where you using CircuitPython, I have done another video using the LCD with CircuitPython. In example 2 I see I forgot to comment out the ds1302 library which I used in a previous tutorial thank you for that will update the code.
@frontier9
@frontier9 Рік тому
@@NerdCaveYT i started fresh. Pico, installed Thony and followed your instructions. I used Micropython. So this tutorial was good. Now i'm playing with circuit python on another one. I build fully functional synth with engine (DAC, code, midi receive etc - fully functional) based on open source by Marcel License. I added a lot of libraries. Now I'm just learning Python -> micro-controllers. I looked at another video you made for a midi matrix but I am building my own design and working with Adafruit guides - hope to find a synth engine but i have a feeling i'll need C++ for the speed., Anyway, this is fun -- hope your channel builds momentum.
@NerdCaveYT
@NerdCaveYT Рік тому
@@frontier9 That sounds awesome would like to see it, if you have discord I started a server a few weeks ago if you would like to join discord.gg/7mTDScek
@TheJavaSync
@TheJavaSync Рік тому
Are these libs, work to esp boards?
@NerdCaveYT
@NerdCaveYT Рік тому
I think it should be able to, if it is running micropython. Just have to change the pins etc.
@alex8276
@alex8276 14 днів тому
Hello, I searched for many hours why scan returned [] on my pico HW. I tried many pin SDA/SCL. I don't undersand how it work. When I plugin on Pin 0 and 1. scan returned []. And same result until pin 20 ... When I plugin on pin 39 and 40 code below return 62. sda=machine.Pin(16) scl=machine.Pin(17) i2c=I2C(0, sda=sda, scl=scl, freq=400000). IS there a matchin between index of pin and index of GPIO ? Pin 39 and 40 == GPIO 16 and 17 sda=machine.Pin(24) scl=machine.Pin(25) i2c=I2C(0, sda=sda, scl=scl, freq=400000) devices = i2c.scan() Return [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119]. I'm lost ...
@NerdCaveYT
@NerdCaveYT 13 днів тому
The Pico have two I2C communication lines - GP0,GP1, GP8,GP9 GP12, GP1,GP16,GP17 GP20,GP21 is part of I2C0 if you look at the pinout similar where other pins are I2C1. Now if you are already using an I2C device lets say on I2C0 you can at the back of the screen PCB short resistor pads to change the address of the device datasheets.raspberrypi.com/pico/Pico-R3-A4-Pinout.pdf www.ti.com/lit/ds/symlink/pcf8574.pdf?ts=1713598693413&ref_url=https%253A%252F%252Fwww.google.com%252F
@robloxplayer_and_meowshit_3527
@robloxplayer_and_meowshit_3527 Рік тому
I need help every time when I put in the eye to see scanting it doesn't give me a number it just puts it blank
@NerdCaveYT
@NerdCaveYT Рік тому
can you double check the connections of the lcd also try the default 0x27 as your adress or 39 in decimal
@robloxplayer_and_meowshit_3527
@robloxplayer_and_meowshit_3527 Рік тому
@@NerdCaveYT sorry its still not showing
@JC-ds1jh
@JC-ds1jh Рік тому
Keep getting this error: OSError: [Errno 5] EIO any advice please? Also great video
@NerdCaveYT
@NerdCaveYT Рік тому
is the wiring connect in the code the pinout you used?
@JC-ds1jh
@JC-ds1jh Рік тому
@@NerdCaveYT Oh I got it working sorry I forgot to say. Thank you.
@kevinclaypool6345
@kevinclaypool6345 11 місяців тому
@@JC-ds1jh How did you get it working? Im getting this errno 5 as well...
@JC-ds1jh
@JC-ds1jh 11 місяців тому
@@kevinclaypool6345 If I remember right I was missing a library
@alperenresber
@alperenresber Рік тому
ImportError: no module named 'pico_i2c_lcd' eror
@NerdCaveYT
@NerdCaveYT Рік тому
Hi Alperen have you downloaded the libraries to the Pico in the GitHub repository
@omerfarukgunaydn4881
@omerfarukgunaydn4881 Рік тому
soronu çözebildin mi
@porcha4883
@porcha4883 Рік тому
I am following the steps but I get the following error: Traceback (most recent call last): File "", line 3, in ImportError: no module named 'lcd_api' >>> Help pls
@porcha4883
@porcha4883 Рік тому
I solved it, it was the name of the file, but now im getting this: Traceback (most recent call last): File "", line 12, in File "pico_i2c_lcd.py", line 22, in __init__ OSError: [Errno 5] EIO
@porcha4883
@porcha4883 Рік тому
I got the error on example1.py
@NerdCaveYT
@NerdCaveYT Рік тому
I will be able to check next week, if I remember correct the EIO is when there is a connection error can be the TX and RX
@porcha4883
@porcha4883 Рік тому
@@NerdCaveYT Thanks! im trying to make the alarm clock, but im starting with the basics of the LCD and the ds1302
@onurarslan9407
@onurarslan9407 Рік тому
@@NerdCaveYT pls help that , i am getting the same error that everytime i try
@castellarb3348
@castellarb3348 7 місяців тому
Traceback (most recent call last): File "", line 12, in File "pico_i2c_lcd.py", line 22, in __init__ OSError: [Errno 5] EIO What I need to do?
@NerdCaveYT
@NerdCaveYT 6 місяців тому
did you double check the connections made
@nienekkodex
@nienekkodex 5 місяців тому
i have the same problem. Works fine with other code but with yours temperature code it makes the same error as this guy commented.@@NerdCaveYT
@NerdCaveYT
@NerdCaveYT 5 місяців тому
Let me have a look this weekend and will get back to you too, will create the circuit and run the code to confirm@@nienekkodex
@HariRam-jq4wp
@HariRam-jq4wp Місяць тому
​@@NerdCaveYT Mee also same prblm bro
@TheoCahill
@TheoCahill 19 днів тому
have had this problem for forever😭
@jesusponce9885
@jesusponce9885 Рік тому
For some reason my LCD screen blinks, but there's no text.
@NerdCaveYT
@NerdCaveYT Рік тому
do you mean by blink a cursor blink or the backlight ?
@kiszkah1815
@kiszkah1815 11 місяців тому
Hey, everything works except for puting string
@NerdCaveYT
@NerdCaveYT 11 місяців тому
what happens when you try to write a string does it show an error or just nothing
@g.o.a.t9804
@g.o.a.t9804 Рік тому
Why not program in C ??
@NerdCaveYT
@NerdCaveYT Рік тому
the videos I make is for beginners and if people knew see they will just use the sdk documentation and learn from that, I also personally don't use C, it is a good language for microcontrollers but just with all the resources and libraries available for micropython and circuitpython do not see the need to switch
@Tahir_CanKozan
@Tahir_CanKozan Рік тому
image of lcd is not geting
@NerdCaveYT
@NerdCaveYT Рік тому
What error are you receiving?
@Tahir_CanKozan
@Tahir_CanKozan Рік тому
@@NerdCaveYT I solved my problem.it is brightness end I didn't know brightness options.
@sammymiller6740
@sammymiller6740 Рік тому
thonny doesnt give me a choice to were i save
@NerdCaveYT
@NerdCaveYT Рік тому
is your interpreter right bottom corner set to micropython
@sammymiller6740
@sammymiller6740 Рік тому
@@NerdCaveYT It says micropython raspberry pi Pico
@NerdCaveYT
@NerdCaveYT Рік тому
@@sammymiller6740 so when you click file save as what does it show? it might be that a program is already running on the pico. which you can press the stop button and then try
@user-nn6uw6zi4z
@user-nn6uw6zi4z Рік тому
[39] ???
@NerdCaveYT
@NerdCaveYT Рік тому
?
@bedstevesuper1936
@bedstevesuper1936 Рік тому
I got [ ] I2C address
@NerdCaveYT
@NerdCaveYT Рік тому
an empty list at the return? I think you can test with the default address as shown in video which I received most of the LCD will be this
@bedstevesuper1936
@bedstevesuper1936 Рік тому
@@NerdCaveYT nvm I wired the pin gpio pens wrong
@AverageBat6589
@AverageBat6589 Рік тому
my lcd just blinks the screen and the light ):
@NerdCaveYT
@NerdCaveYT Рік тому
so no text just backlight or is it like a cursor blinking on screen
@AverageBat6589
@AverageBat6589 Рік тому
@@NerdCaveYT my friend fixed the problem for me you have a use the potentiometer
@AverageBat6589
@AverageBat6589 Рік тому
@@NerdCaveYT backlight
@gregolator8950
@gregolator8950 Рік тому
@@AverageBat6589 how did you fix that?
@00maytals
@00maytals Рік тому
My address is blank
@NerdCaveYT
@NerdCaveYT Рік тому
Did you connect the LCD to the Pico? You need to make sure that your LCD is supplied by 5V and that SDA and SCL is connected as indicated in the code.
@directorstu
@directorstu 14 днів тому
Mine was blank initially but returned an address when I used the correct GPIO pins
Turning a Raspberry Pi Pico into a GPU!
16:42
element14 presents
Переглядів 98 тис.
Raspberry Pi Pico LCD Projects
17:25
ExplainingComputers
Переглядів 97 тис.
Спектакль для окупантів та ждунів 🤯
00:47
Радіо Байрактар
Переглядів 542 тис.
LCD I2C Raspberry Pi Pico - ESP8266 - ESP32 [MicroPython] # 015
17:19
Sergio A. Castaño Giraldo
Переглядів 17 тис.
Raspberry Pi - Mini LCD Display Tutorial
9:00
TheRaspberryPiGuy
Переглядів 135 тис.
Beginners Guide to I2C on the Raspberry Pi Pico (BNO055 IMU Example)
16:57
Learn Embedded Systems
Переглядів 69 тис.
Raspberry Pi Pico: Manejando el LCD con el modulo I2C en Micropython
10:09
Creatividad Ahora
Переглядів 11 тис.
The Pi Pico has problems, so I made my own, the ProPico
7:17
Dmytro Engineering
Переглядів 34 тис.
Raspberry Pi Pico 20x4 LCD display tutorial using CircuitPython
8:02
Top 5 Beginner PCB Design Mistakes (and how to fix them)
12:52
Altium Academy
Переглядів 189 тис.
How to Run Linux on an ESP32
18:53
element14 presents
Переглядів 143 тис.
Маша!!! Я Иду тебя кормить #ЯжеВика
0:17
ЯжеВика
Переглядів 4,1 млн
Находка для розыгрышей с вайлдберриз озон #wb #shorts
0:15
Cabeça garrada #youtubeshorts #comedia
0:10
Familia Alves
Переглядів 34 млн