I2C LCD screen with Raspberry Pi Pico
-
- Posts: 3
- Joined: Mon Jan 25, 2021 1:00 am
I2C LCD screen with Raspberry Pi Pico
I am thinking of buying a Pico for a project I'm working on, but I can't figure out how to use an i2c lcd screen with it. In the product page for the Pico there is a picture of the Pico with a screen attached to it:
https://www.raspberrypi.org/products/raspberry-pi-pico/
My question is what is the simplest way to program a 16 by 2 lcd screen like the one in the picture with micropython and how would I go about doing so. Thanks in advance for any advice.
https://www.raspberrypi.org/products/raspberry-pi-pico/
My question is what is the simplest way to program a 16 by 2 lcd screen like the one in the picture with micropython and how would I go about doing so. Thanks in advance for any advice.
Re: I2C LCD screen with Raspberry Pi Pico
The LCD in the display is a LCD1602 module.ElJacko123 wrote: ↑Mon Jan 25, 2021 1:04 amMy question is what is the simplest way to program a 16 by 2 lcd screen like the one in the picture with micropython and how would I go about doing so. Thanks in advance for any advice.
There's a MicroPython driver by dhylands (who is very active on this forum) at https://github.com/dhylands/python_lcd
-
- Posts: 3
- Joined: Mon Jan 25, 2021 1:00 am
Re: I2C LCD screen with Raspberry Pi Pico
Thanks for the reply.
I have seen this library here before, and i wasn't sure if it was compatible with the Pico. What files in the library would I have to copy onto the Pico to drive the 1602?
I have seen this library here before, and i wasn't sure if it was compatible with the Pico. What files in the library would I have to copy onto the Pico to drive the 1602?
Re: I2C LCD screen with Raspberry Pi Pico
The Pico port provides the same machine.I2C API that other ports provide. So for example you could copy esp8266_i2c_lcd.py (and you'll also need lcd_api.py).ElJacko123 wrote: ↑Mon Jan 25, 2021 5:42 amI have seen this library here before, and i wasn't sure if it was compatible with the Pico. What files in the library would I have to copy onto the Pico to drive the 1602?
The way this library works is that lcd_api.py does the common stuff and the various xyz_i2c_lcd.py provide port-specific details. Now that most ports are providing the machine module, they all end up looking the same (I don't actually see any esp8266-specific stuff in esp8266_i2c_lcd.py).
You could use esp8266_i2c_lcd_test.py to test it too, the only thing you'll need to change is the pin numbers.
-
- Posts: 3
- Joined: Mon Jan 25, 2021 1:00 am
Re: I2C LCD screen with Raspberry Pi Pico
Alright thanks that is what I was looking for.
I love Miss Vickies Sea Salt and Malt Vinegar Kettle Cooked Potato Chips.
How about you?
How about you?
Re: I2C LCD screen with Raspberry Pi Pico
Hi
I'm tinkering with the Raspberry PI Pico, basically I have no idea what I'm doing, a complete beginner. I'm trying to get a QAPASS lcd1602 board working. I copied esp8266_i2c_lcd.py and lcd_api.py to the pico and tried running esp8266_i2c_lcd_test.py. I changed the oins for sda and scl, but I get
Traceback (most recent call last):
File "<stdin>", line 47, in <module>
File "<stdin>", line 14, in test_main
TypeError: 'id' argument required
I can't see any evidence of id in the code.
Any advice?
Cheers Nik
I'm tinkering with the Raspberry PI Pico, basically I have no idea what I'm doing, a complete beginner. I'm trying to get a QAPASS lcd1602 board working. I copied esp8266_i2c_lcd.py and lcd_api.py to the pico and tried running esp8266_i2c_lcd_test.py. I changed the oins for sda and scl, but I get
Traceback (most recent call last):
File "<stdin>", line 47, in <module>
File "<stdin>", line 14, in test_main
TypeError: 'id' argument required
I can't see any evidence of id in the code.
Any advice?
Cheers Nik
Re: I2C LCD screen with Raspberry Pi Pico
I'm going to guess that it's the id passed to machine.I2C
I don't have my RPi Pico yet, so I can't confirm.
Looking at the source it looks like an ID is required:
https://github.com/micropython/micropyt ... 2ee64a1R64
and this makes sense since there are 2 I2C blocks which can each appear on any of the pins.
I don't have my RPi Pico yet, so I can't confirm.
Looking at the source it looks like an ID is required:
https://github.com/micropython/micropyt ... 2ee64a1R64
and this makes sense since there are 2 I2C blocks which can each appear on any of the pins.
Re: I2C LCD screen with Raspberry Pi Pico
You have to give the number of the I2c unit, which is 0 or 1. For instance
i2c = I2C(1, sda=Pin(14), scl=Pin(15))
Here GPIO14 and GPIO15 are used with ID1. The mapping between I2C ID and GPIO number is on the Pinout.
i2c = I2C(1, sda=Pin(14), scl=Pin(15))
Here GPIO14 and GPIO15 are used with ID1. The mapping between I2C ID and GPIO number is on the Pinout.
Re: I2C LCD screen with Raspberry Pi Pico
Thanks so much to both of you. Now working perfectly.
So this is because the Pico has two I2C buses?
So this is because the Pico has two I2C buses?
Re: I2C LCD screen with Raspberry Pi Pico
Yep. Sorry I missed that detail in the original reply!