Monthly Archive:February 2019

Byamber

Drive 16×2 LCD with Raspberry Pi

Objective:
In this project, we will use GPIO pins to send text to 1602 LCD screen.

If you don’t know what is GPIO layout, check our tutorial How to read Raspberry Pi i/o pin diagram (GPIO pin graph)

Parts:

1 pc Raspberry Pi 2/3/zero raspi
1 pc 8GB MicroSD memory card preinstalled Raspbian OS. 8gtf
1 pc 1602 LCD screen 1602LCD
1 pc Potentiometer Potentiometer
1 pc breadboard BREADBOARD
1 pc GPIO breakout kit(optional) breakout

Prerequisite:

Raspbian should be upgraded to latest version in order to support RPI.GPIO module
Please run following commands in shell:

  • sudo apt-get update
  • sudo apt-get upgrade

Raspberry Pi and 1602 LCD pin connection

LCD Pin Description Pi Function RasPi Pin
01 GND GND 06
02 +5V +5V 02
03 Contrast To Potentiometer middle pin
04 RS GPIO7 26
05 RW GND 06
06 Enable GPIO8 24
11 D4 GPIO25 22
12 D5 GPIO24 18
13 D6 GPIO23 16
14 D7 GPIO18 12
15 +5V +5V 02
16 GND GND 06

Circuit Graph:

Caution: Unlike Arduino board 5V input voltage, Raspberry GPIO pin accept only 3 Volt. Wrong voltage input might damage the Pi board. Please be very careful!

Write python code
You have two ways to write python code:
Option 1)
download http://osoyoo.com/driver/pi_lcd.py and copy/paste it to raspberry pi

Option 2)
You can also download above python file from our server by typing following shell command:

sudo wget http://osoyoo.com/driver/pi_lcd.py

Finally, run following command in shell window:

sudo python pi_lcd.py

Adjust the Potentiometer to make LCD text displaying clearly. You will see following text string rolling in LCD screen:
LCD work with
Raspberry Pi!

Designed by
osoyoo.com

Read Tutorial @
osoyoo.com

Video Demo:

Byamber

Drive i2c LCD Screen with Raspberry Pi

In previous posts We’ve driven 16×2 LCD screens with the Raspberry Pi. That project was easy to set up, however, it needs to solder many jump wires and occupy lots of GPIO ports which are valuable resources to the Pi.

To save our GPIO port resources, in this project we will connect the Pi with an I2C enabled LCD screen which only has 4 pins as shown below.
LACC2006AD-9
Caution: To make sure this project works properly, you should use a MicroSD card with fresh-installed Raspbian OS.
Step 1: Circuit Connection Graph:

PI-LCDI2C_bb PiI2C Pin

GND(Pin 39 or Pin 9) GND
5V(Pin 2) VCC
SDA(Pin 3/GPIO 2) SDA
SCL(Pin 5/GPIO 3) SCL

Step 2: Enable i2c using raspi-config utility
In terminal, type the following command:
sudo raspi-config

Select Advanced Option -> I2C -> Enable I2C ->Finish
The Pi will reboot after you click the Finish Button

After rebooting the Pi, we need to modify the module’s config file. Type the following command in terminal:
sudo nano /etc/modules
Add following two lines in modules file if they do not exist:
i2c-bcm2708
i2c-dev

Then Type Ctrl X and Yes to save the file.

Step 3: Step 3 – Install smbus and i2c python library
Type following command in terminal:
sudo apt-get update
sudo apt-get install -y python-smbus i2c-tools
sudo reboot

After rebooting the system, type the following command in order to check software installation:
lsmod | grep i2c_
You should see i2c_bcm2708 in a list, this means the library has been installed successfully. Otherwise you might need to find another Raspbian OS MicroSD card and repeat Step 2 and 3.

Step 4:Testing Hardware
Depending on your Raspberry Pi version, please run one of following commands in terminal:

sudo i2cdetect -y 1
or
sudo i2cdetect -y 0

You should see something as follows:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: — — — — — — — — — — — — —
10: — — — — — — — — — — — — — — — —
20: — — — — — — — — — — — — — — — —
30: — — — — — — — — — — — — — — — 27
40: — — — — — — — — — — — — — — — —
50: — — — — — — — — — — — — — — — —
60: — — — — — — — — — — — — — — — —
70: — — — — — — — —

If you can only see “– — –” sign in the list without any numbers, it means either your circuit connection is wrong or your software is not properly installed.

Step 5: Download Python Code and run the project:
in terminal window, type the following commands:

wget http://osoyoo.com/driver/i2clcda.py
sudo python i2clcda.py

If there is any runtime writing error, it might be caused by the LCD I/O address mismatching. try the following commands:

wget http://osoyoo.com/driver/i2clcdb.py
sudo python i2clcdb.py

Now your LCD should display the following messages:

Created by
Osoyoo.com

> Tutorial Url:
> http://osoyoo.com

If your Pi does not show any runtime error but LCD still does not display any messages, you can use a screw driver to adjust the contrast screw on the back of the LCD until you see the message.

Byamber

Use Raspberry Pi display temperature/humidity to i2c LCD screen

Objective:

In this project, we will get temperature and humid data from DHT11 and send it to Raspberry Pi, then display the temperature and humid on 16×2 LCD screen.

If you don’t know what is GPIO layout, check our tutorial How to read Raspberry Pi i/o pin diagram (GPIO pin graph)

Parts:

1 pc Raspberry Pi 2/3/zero x 1 raspi
1 pc 8GB MicroSD memory card x 1preinstalled Raspbian OS. 8gtf
1 pc DHT11 Temperature/Humid Sensor x 1 dht11
1 pc I2C 1602 LCD screen x 1
1 pc breadboard x 1 BREADBOARD
1 pc GPIO breakout kit(optional) breakout

Software/Hardware Installation and Configuration

Step 1)Raspbian should be upgraded to latest version in order to support RPI.GPIO module

Please run following commands in shell:

  • sudo apt-get update
  • sudo apt-get upgrade

Step 2)Enable I2C and SPI protocol

To enable the protocol, run shell command

sudo raspi-config

Then select Advance Options and enable I2C and SPI

After rebooting the Pi, we need to modify the module’s config file. Type the following command in terminal:

sudo nano /etc/modules

Add following two lines in modules file if they do not exist:

i2c-bcm2708

i2c-dev

Then Type Ctrl X and Yes to save the file.

Step 3) – Install smbus and i2c python library

Type following command in terminal:

sudo apt-get update

sudo apt-get install -y python-smbus i2c-tools

sudo reboot

After rebooting the system, type the following command in order to check software installation:

lsmod | grep i2c

You should see i2c_bcm2708 in a list, this means the library has been installed successfully. Otherwise you might need to find another Raspbian OS MicroSD card and repeat Step 2 and 3.

Step 4)Raspberry Pi ,I2C 1602 LCD and DHT11 sensor pin connection

LCD Pin Description Pi Function RasPi Pin
GND GND GND pin 6 or pin 39
VCC +5V/3.3v +3.3V pin 2
SDA SDA GPIO 02 pin 3
SCL SCL GPIO 03 pin 5
DHT11 DATA pin GPIO 14 pin 8
DHT11 +VCC pin +3V pin 1
DHT11 GND(-) GND pin 6

Circuit Graph:

201703pi-dh11-i2clcd

Caution: Unlike Arduino board 5V input voltage, Raspberry GPIO pin accept only 3 Volt. Wrong voltage input might damage the Pi board. Please be very careful!

Step 5) Testing Hardware

Depending on your Raspberry Pi version, please run one of following commands in terminal:

sudo i2cdetect -y 1

or

sudo i2cdetect -y 0

You should see something as follows:

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: — — — — — — — — — — — — —

10: — — — — — — — — — — — — — — — —

20: — — — — — — — — — — — — — — — —

30: — — — — — — — — — — — — — — — 3f

40: — — — — — — — — — — — — — — — —

50: — — — — — — — — — — — — — — — —

60: — — — — — — — — — — — — — — — —

70: — — — — — — — —

If you can only see “– — –” sign in the list without any numbers, it means either your circuit connection is wrong or your software is not properly installed.

Please take special attention on the “3f” in above result, this is the i2c address of your LCD, it might be other value such as 27. If the value is not 3f, you need change line 18 of file “pi-dht11-i2clcd.py” (you need download this file in Step 6 with wget command)

Step 6) download python code

Please typing following shell commands to download python file(dht11.py):

sudo wget http://osoyoo.com/driver/dht11.py

a) If your LCD i2c address shows 3f, pls type following shell commands to download python file(pi-dht11-ic2lcd.py)
sudo wget http://osoyoo.com/driver/pi-dht11-i2clcd.py

b) If you get other number in the step 5(not 3F), pls type following command in shell window
sudo nano pi-dht11-i2clcd.py
then copy python code and paste the code into pi-dht11-ic2lcd.py.
you need change line 18 of file “pi-dht11-i2clcd.py” (I2C_ADDR = 0x3f, use your number to replace 3f)
Then Type Ctrl X and Yes to save the file. and press enter

Finally, run following command in shell window:

sudo python pi-dht11-i2clcd.py

If you can not see the text clearly in LCD, use a screw driver to adjust the brightness screw(on the back of 1602 LCD) until the display is ok.

Video Demo:

Byamber

5 Inch TFT Capacitive Touch Screen DSI Connector LCD Display Monitor 800×480 Resolution for Raspberry Pi

Authorized Amazon Store

Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

–> DSI Connector,Plug and Play,No Driver Needed.
–> Capacitive Touch Screen ,Finger Touch,800×480 high resolution,better touch response,faster response time
–> 5 inch display monitor with high resolution picture and large viewing screen.
–> Free drive support Raspberry ,Ubuntu MATE,Kali,RetroPie,OpenElec,OSMC,Arch system and so on.
–> Support all raspberry board except PI zero(PI A,PI B need use I2C on gpio).

What’s Inside?
1x 5 inches DSI Touch LCD Screen for Raspberry Pi
1x DSI Ribbon Cable
1x Philips screwdriver
1x User manual

Feature
The 5″ LCD display is an LCD display which connects to the Raspberry Pi through the DSI connector.
It is capacitive touch LCD screen.
It is compatible with Raspberry Pi 3B+, 3B, and 2B.
Equipped with reserved fixing holes for control boards – suitable for Raspberry Pi 3 model B+,3 model B, and 2 model B.
It doesn’t need install driver, and you can plug and play.
The Physical resolution of LCD display is 800*480.
No need additional power.

Creative for DIY

As OSOYOO 5″ DSI touch screen connect with Raspberry Pi via DSI ribbon cable, makers can extend the raspberry pi GPIOs for DIY projects.

What’s more, no need driver and supported multiple Linux operation systems, makers can create more ideas.

2018008900-1 2018008900-2 2018008900-3 2018008900-4 2018008900-5