Package: pibooth-lcd-display
pibooth-lcd-displayis a plugin for thepiboothapplication.Add any 16x2 or 20x4 LCD-screen with aHitachi HD44780 controllerusing either a port expander connected through I2c or just wire through GPIO 4 or 8 bit.We recommend using LCD-screen with I2c, as it uses less wire (only 4), is faster and more stable.It can show numbers ofPhotos Taken,Printed Photos,Forgotten Photos,Remaining Duplicates.It also have 4 xFree-Textwhere you can write your own text, and showDate/Time.Examples:Show pibooth counters like “Taken Photos 197” or “Today Photos 197”Show some free text in the line “Hello from pibooth!”Show the Date/Time Clock**NoteMaximum text size depends on the LCD type and on the presence of a counter after.Supported port expanders are the (PCF8574- Default), theMCP23008and theMCP23017.I2c port address (Default 0x27on I2c PCF8574T ), (Default 0x3Fon I2c PCF8574AT)All changes can be made in the pibooth.cfg or in the Pibooth menu under “LCD display setup”ContentsRequirementsInstallConfiguration when using I2c port expanderTurn on I2C - Raspberry PiHow to find the name of your port expander on the I2cHow to find your I2c addresssHow to change address on the I2cHow to setup the LCDOptions are available by editing the configuration fileHow to setup “LCD DISPLAY SETUP” in either config.cfg or Pibooth menuHow to setup “LCD DISPLAY TEXT” in either config.cfg or Pibooth menuSelect what to display on line 1,2,3,4Write the text showing before the counterHow to change the Date-Time formatWrite your own text on the displayStates descriptionCircuit diagram -only when using I2c - port expanderWiring -only when using I2c - port expanderI2C-safe Bi-directional Logic Level ConverterHow to connect aLevel Converterto yourPort Expanderand the Raspberry PiCircuit diagram -only when using GPIO - 4bit modeCircuit diagram -only when using GPIO - 8bit modeCircuit diagram -only when using GPIO - Turn off Backlight on exit - 4bit and 8bit modeWiring -only when using GPIO 4bit or 8bit modeRequirementsHardware1 Raspberry Pi 3 Model B (or higher)1 LCD-screenHitachi HD44780 controller(PCF8574, or MCP23008 or MCP23017) with an I2c port expander. Or just wire through GPIO 4 or 8 bit. We recommend using a LCD-screen with an I2c port expander as it uses less wire (only 4) and is faster and more stable.1 I2c safe Bi-directional Logic Level Converter (Only necessary when using LCD with I2c port expander)2 (R1/R2) - Potentiometers: 10K Ohms (Only necessary when using GPIO 4 or 8 bit mode) - R1: Potentiometer can be substituted with and resistors.optionalLCD Backlight Off, when Pibooth shutsdown - (Only necessary when using GPIO 4 or 8 bit)1 Q1 - NPN transitor (BC547, BC548 or equivalent) Backlight (Only necessary when using GPIO 4 or 8 bit)1 R3 - Resistor 27k Ohm - Backlight (Only necessary when using GPIO 4 or 8 bit mode)Install$ pip3 install pibooth-lcd-displayConfiguration when using I2c port expanderTurn on I2C - Raspberry PiThe I2C peripheral is not turned on by default.There are two methods to adjust the settings. To enable it, do the following.Raspberry Pi Configuration via Desktop GUIYou can use the Desktop GUI by heading to the Pi Start Menu > Preferences > Raspberry Pi Configuration.A window will pop up with different tabs to adjust settings. What we are interested is the Interfaces tab.Click on the tab and select Enable for I2C. Click on the OK button to save.We recommend restarting your Pi to ensure that the changes to take effect.Click on the Pi Start Menu > Preferences > Shutdown. Since we just need to restart, click on the Restart button.raspi-config Tool via TerminalI2C is not turned on by default. Again, we can use raspi-config to enable it.Run sudo raspi-config.Use the down arrow to select 5 Interfacing OptionsArrow down to P5 I2C.Select yes when it asks you to enable I2CAlso select yes if it asks about automatically loading the kernel module.Use the right arrow to select the <Finish> button.Select yes when it asks to reboot.The system will reboot. when it comes back up, log in and enter the following command>ls/dev/*i2c*The Pi should respond with/dev/i2c-1Which represents the user-mode I2C interface.How to find the name of your port expander on the I2cYou need to provide the name of the I2c port expander that your board uses.It should be written on the microchip that’s soldered on to your I2c board.Supported port expanders are thePCF8574, theMCP23008and theMCP23017.The board on this photo has aPCF8574Tport expander chip on it.How to find your I2c addresssYou need to know the address of your I2c. You can find it on the command line using the“sudo i2cdetect -y 1”command.In this case the address of the display is0x3F.How to change address on the I2cYou can change the address by making a bridge.Soldering 1 or more wire on the back of the I2c (short circuit)A0,A1,A2If your LCD has aPCF8574Tchip from Texas Instruments, its default I2C address is 0x27Hex. If your LCD has aPCF8574ATchip from NXP semiconductors, its default I2C address is 0x3FHex. So your LCD probably has an I2C address 0x27Hex or 0x3FHex.How to setup the LCDOptions are available by editing the configuration fileusing the command - (All options can also be changed in the pibooth menu under “Lcd display setup”)$ pibooth --configHow to setup “LCD DISPLAY SETUP” in either config.cfg or Pibooth menu[LCD DISPLAY SETUP]# Choose I2c(Default) or GPIO-4bit or GPIO-8bit setuplcd_gpio_or_i2c =I2c# Choose LCD chip - PCF8574(Default) or MCP23008 or MCP23017lcd_chip =PCF8574# Change Port Address 0x27(Default)lcd_port_address =0x27# Change the I2C port number 1 or 2 - (Default = 1)lcd_port =1# Change the I2C charmap A00 or A02 or ST0B - (Default = A02)lcd_charmap =A02# Number of columns per row 16 or 20 (16 = Default on a 16x2 LCD)lcd_cols =20# Number of display rows 1 or 2 or 4 - (2 = Default on a 16x2 LCD)lcd_rows =4GPIO ONLY - pin setup# GPIO-PIN_RS - Default 7lcd_pin_rs =7# GPIO-PIN_E - Default 8lcd_pin_e =8# GPIO-DATA_PIN_0 - Default 21 (8 bit mode only)lcd_data_pin4 =21# GPIO-DATA_PIN_1 - Default 20 (8 bit mode only)lcd_data_pin5 =20# GPIO-DATA_PIN_2 - Default 16 (8 bit mode only)lcd_data_pin6 =16# GPIO-DATA_PIN_3 - Default 12 (8 bit mode only)lcd_data_pin7 =12# GPIO-DATA_PIN_4 - Default 25 (4+8 bit mode)lcd_data_pin4 =25# GPIO-DATA_PIN_5 - Default 24 (4+8 bit mode)lcd_data_pin5 =24# GPIO-DATA_PIN_6 - Default 23 (4+8 bit mode)lcd_data_pin6 =23# GPIO-DATA_PIN_7 - Default 18 (4+8 bit mode)lcd_data_pin7 =18# GPIO-Backlight_PIN - Default None (4+8 bit mode)lcd_backlight_pin =NoneHow to setup “LCD DISPLAY TEXT” in either config.cfg or Pibooth menu[LCD DISPLAY TEXT]Select what to display on line 1,2,3,4# This can also be changed in the pibooth menu under “LCD DISPLAY TEXT”#Taken_PhotoPrintedForgottenRemaining_DuplicatesDate_TimeEmpty_LineText# Choose what to display on line 1,2,3,4lcd_line_1_typelcd_line_2_typelcd_line_3_typelcd_line_4_type= etc.Taken_PhotoWrite the text showing before the counter# Text before etc.Taken Photo Counteris displayed - This can also be changed in the pibooth menu under “LCD DISPLAY TEXT”Max-12 characters on a 16x2 display - Max 16 characters on a 20x4 displaylcd_line_1_textlcd_line_2_textlcd_line_3_textlcd_line_4_text= etc.Taken Photo,Printed,Forgotten,DuplicatesHow to change the Date-Time formatSee the Date-Time format codes in the followingpage# You can change the way Date-Time is displayed - This can also be changed in the pibooth menu under “LCD DISPLAY TEXT”Max-16 character on a 16x2 display - Max 20 character on a 20x4 display# Default =%d/%m - %H:%M:%SChoose Date_Time and use etc.%d/%m - %H:%M:%Sto display the date and timeWrite your own text on the display# This can also be changed in the pibooth menu under “LCD DISPLAY TEXT”# Text - Max-16 characters on a 16x2 display - Max 20 characters on a 20x4 displayChoose Text =Write your own textStates descriptionCircuit diagram -only when using I2c - port expanderHere is the diagram for hardware connections.Wiring -only when using I2c - port expanderI2C-safe Bi-directional Logic Level ConverterWhen using a port expander with I2c on your LCD, you will have to use 5v.Since the Raspberry Pi GPIO only handle 3.3v, it will therefore be a good idea to use aI2C-safe Bi-directional Logic Level Converterso you don’t fryed your pi.How to connect aLevel Converterto yourPort Expanderand the Raspberry PiConnect the I2c Port Expander toHV(High Level) on the Level Converter.GND: Pin GND (GND)VCC: Pin HV  (HV)(5v) - Also connect5vfrom the raspberry Pi Pin 2, toHVon the Level ConverterSDA: Pin HV2 (HV2)SCL: Pin HV1 (HV1)Connect the Raspberry Pi (BOARD numbering scheme) toLV(Low Level) on the Level Converter.GND:  Pin 6 (GND)3.3v: Pin 1 (LV)SDA:  Pin 3 (LV2)SCL:  Pin 5 (LV1)Circuit diagram -only when using GPIO - 4bit modeHere is the diagram for hardware connections4bit mode.Circuit diagram -only when using GPIO - 8bit modeHere is the diagram for hardware connections8bit mode.Circuit diagram -only when using GPIO - Turn off Backlight on exit - 4bit and 8bit modeHere is the diagram for hardware connectionsIf you want to automatic turn off Backlight, when Pibooth shutsdownoptional.Use an (Q1) NPN transitor BC547, BC548 or equivalent, which is activated by an additional GPIO connection.
The LCD backlight is treated in exactly the same way as a switch for standard LED.The base (middle wire) of the transistor is wired to an additional GPIO PIN via (R3) 27Kohm resistor.
It then open and close LCD PIN 16 (GROUND) to control the backlight LED in the LCD.Wiring -only when using GPIO 4bit or 8bit modeFirst, connect the LCD Pins directly to the GPIO header of the Raspberry Pi: (BCM numbering scheme)You can choose between4bit mode (4 DATA wires “D4,D5,D6,D7”)or8bit mode (8 DATA wires “D0,D1,D2,D3,D4,D5,D6,D7”)8bit mode is faster and often more stable than 4bit mode.If you don’t know how to wire up the LCD to the Raspberry Pi, use some of the above examples.Connect PINS from the LCD, to the raspberry Pi.LCDGPIO (BCM scheme)BOARD numbering scheme1  (GND)(Ground)PIN 62  (VCC/5v)5v PowerPIN 23  (V0)Middle wire of theR2 potentiometer.4  (RS)GPIO7PIN 265  (RW)Important(Ground)PIN 66  (EN)GPIO8PIN 247  (D0) 8bit mode onlyGPIO21PIN 408  (D1) 8bit mode onlyGPIO20PIN 389  (D2) 8bit mode onlyGPIO16PIN 3610 (D3) 8bit mode onlyGPIO12PIN 3211 (D4) 4bit and 8bitGPIO25PIN 2212 (D5) 4bit and 8bitGPIO24PIN 1813 (D6) 4bit and 8bitGPIO23PIN 1614 (D7) 4bit and 8bitGPIO18PIN 1215 (A) (LED +)Middle wire of theR1 potentiometer.16 (K) (LED -)(Ground)PIN 6NOTE:The RW pin allows the device to be be put into read or write mode.We wanted to send data to the LCD device but did not want it to send data to the Pi so we tied this pin to ground.The Pi can not tolerate 5V inputs on its GPIO header.Tying RW to ground makes sure the LCD device does not attempt to pull the data lines to 5V which would damage the Pi.((NOT ALL OLD LCDs CAN USE 5v, CHECK YOUR LCD SPEC. Or test it with 3v3 first))R1: Potentiometers: 10K Ohms. But can be substituted with and resistors.R2: Potentiometers: 10K Ohms. Controls the contrast and brightness of the LCD. Using a simple voltage divider with a potentiometer, we can make fine adjustments to the contrast.