LCD Billboard – Learning path project 7

Our Learning Path is an itinerary designed to teach all the foundaments and a little more about electronics, coding and robotics.

When you complete all the projects you will be able to develop almost any project you can imagine. In each chapter new concepts are introduced. You will learn by doing in a funny way.

Learn to use a LCD screen, so your program will send messages to our material world!

Project 7
LCD BILLBOARD

Learn to show messages in a LCD display

BEFORE TO START

DIFFICULTY LEVEL: Intermediate
DURATION OF THE ACTIVITY: 45 min.

MATERIALS:
4in1 board
Buzzer
Battery holder & wires
Battery holder & wires
Battery holder & wires

1 - Build&Code 4in1 board
1 - 16X2 LCD Display with l2C
1 - Switch Button
1 - Any analog sensor

Battery holder, USB cable and wires.

7 - LCD display billboard

The LCD display with l2Clet us show messages to users. There are different types of LCD, and sizes. We use a monochromatic one with 2 lines or rows and 16 characters per line (2x16)

Seems difficult to control it? well, this LCD display has an I2C transceiver. I2C is a serial protocol for two-wire interface to connect low-speed devices. 4in1 board has a serial port also, where we can connect to many devices in a serial bus. Each device has an address, so we can send or read values. We will use it to send characters and they ubication in LCD display.

Universal Serial Bus ( USB) vs I2C

USB devices are very similar in concept, they also communicate data by serial line (one byte rear another one) and can be connected many devices simultaniously (bus). I2C has slower speed, and has different specifications, but both require only two wires to transmit data, and two more for power.

7. LCD Display - Circuit

We use serial port of the Build&Code 4in1 board, using Analog ports. Pay attention to the diagram:

Connect wires from 4in1 board to components:

- A5 S pin (blue) to SCL pin from LCD display
- A4 S pin (blue) to SDA pin from LCD display
- A4 V pin (red) to VCC pin from LCD display
- A4 G pin (black) to GND pin from LCD display

- DIO4 to button
- A2 to Analog sensor (LDR, potentiometer)

7.1 LCD Display - Your name

To be ready to program easily the display, is required to install library LiquidCrystal_I2C in Arduino IDE, and LCD i2c by vn_nda iIn mBlock 5. Find in this page how to add libraries! With this exercise you will see how to put your name in the LCD Display. See the code!!

Block Coding
Arduino Coding
#include <Wire.h> 
#include <LiquidCrystal_I2C.h> // LIBRERIA NECESARIA PARA LA PANTALLA LCD


LiquidCrystal_I2C lcd(0x27, 16, 2); // CONFIGURACIÓN DE LA PANTALLA LCD

void setup() {

lcd.begin(); // INICIALIZACION PANTALLA LCD
lcd.clear(); // LIMPIAR LA PANTALLA LCD
}

void loop() { 
  // ESCRIBIR EN LA PANTALLA LCD
  
  lcd.setCursor(0, 0);  // ESCRIBIR EN LA COLUMNA 0 LINEA 1
  lcd.print("INSERTAR NOMBRE");  // MOSTRAR POR PANTALLA EL NOMBRE 
 }
7.2 Analog output by screen

Read the analog sensor value and send it to LCD display. Yeah! You can do it with your eyes shut!

Block coding
Arduino code
#include <Wire.h> 
#include <LiquidCrystal_I2C.h> // LIBRERIA PARA LA PANTALLA LCD


LiquidCrystal_I2C lcd(0x27, 16, 2); // CONFIGURACIÓN DE LA PANTALLA LCD

void setup() {
// lIMPIAR PANTALLA LCD
lcd.begin(); // INICIALIZACION PANTALLA LCD
lcd.clear(); // LIMPIAR LA PANTALLA LCD
}

void loop() { 
  // ESCRIBIR EN LA PANTALLA LCD
  int sensor= analogRead(A2);
  lcd.setCursor(0, 0);  // ESCRIBIR EN LA COLUMNA 0 LINEA 1
  lcd.print(sensor);  // MOSTRAR POR PANTALLA LOS VALORES DEL SENSOR
 }
7.3 From computer to display

Using Arduino IDE, we can input text from our computer throught serial port (USB) and then our program will send it to the LCD display. Let's see how to do it!!

Arduino code
// WRITE ON THE KEYBOARD AND LEAVE ON THE LCD SCREEN

#include <Wire.h> // This library allows you to communicate with I2C / TWI devices 
#include <LiquidCrystal_I2C.h> //LCD I2C Library

int pinbutton = 4, button; //VARIABLE AND BUTTON CONECTOR
char input; // Input variable from computer keyboard

LiquidCrystal_I2C lcd(0x27, 16, 2); // LCD parameters

void setup(){

  pinMode (pinbutton, INPUT); // Declare button as an input
  lcd.begin();
  lcd.backlight(); // turn on the LCD backlight
  lcd.clear(); // Delete content from the LCD screen
  Serial.begin(9600); // serial port speed
}
 
void loop(){
  lcd.blink();
  if (Serial.available()>0) // Serial port reading
  {
    input=Serial.read(); // Save information of the serial port in the input variable
    lcd.print(input); // display the input variable on the LCD screen
  }
  button = digitalRead ( pinbutton); // PRESS THE BUTTON AND CLEAR THE LCD SCREEN
  if (button == HIGH)
  {
    lcd.clear();
  }
}
Final project - Billboard

An LCD Display always is a good component to show information to user. We propose you to do a billboard so you can know all films disponible to see today. Here cardboard template

Block coding
Arduino code
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup(){
/*  LiquidCrystal_I2C() – Constructor de la clase, configura el hardware.
    init() – Prepara el LCD para su uso.
    clear() – Borra todos los caracteres de la pantalla LCD.
    setCursor(col, row) – Permite mover el cursor a la posición indicada en sus parámetros.
    print() – Imprime una variable o literal en la pantalla
    scrollDisplayLeft() y scrollDisplayRight() – Recorre el contenido de la pantalla a la izquierda o a la derecha
    backlight() y noBacklight() – Métodos para encender / apagar la iluminación de fondo
    createChar(num, data) –  Crear un carácter definido por el usuario en la memoria del controlador de pantalla
 */
    lcd.begin();
    lcd.clear();
    lcd.setCursor(0,1);
    lcd.print("ebotics");
}

void loop(){
    lcd.setCursor(0,0);
    lcd.print("Project7-LCD Billboard");
    lcd.scrollDisplayLeft(); 
    delay (300);
}
previous arrow
next arrow
Slider

The Mega Maker Kit fits perfectly with the Learning Path, you can build all projects with it, but if you have other kits, you can also follow the entire itinerary and finish some projects, or buy the missing components. You can check in our Learning Path page.

0 0

0