Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Peguino LCD Display Brick
#1
Peguino LCD Display Brick


This Peguino unit houses and delivers a text display into the center of your project. With its unique designed brick case it can be used standing upright or lying down to allow a broad range of toy brick project integration variations e.g. as a text display on your Peguino weather station.

[Image: LCD_Display_brick_01b.png]


Note: This brick uses the I2C communication protocol. Each display can have a individual communication address. Before your program might work properly, you have to use a program which scans the I2C address range and deliver the individual address of your LCD Display Brick. See Examples below!

Examples for Peguino Uno Nano and ESP32 V1:

First you have to read out the I2C address for the OLED Display. Use the following program to fin the correct I2C address. Both programs works for the Peguino Uno Nano and the Peguino Uno ESP32 Version!

I2C Adresscanner
Code example 1 scans the I2C data bus to deliver the correct address - copy this address in the right place of example 2!

Code:
/*
  I2C Address Scanner
  (C) 2018 by Peguino LTD
  Connect the Brick to scan to port B (eg. OLED Display Brick or LCD Display Brick...)
  Version 1
 
  Note: Use the Serial Monitor to see the found Address


  Peguino Uno Nano Board Pinout       Peguino Uno ESP 32 Development Board Pinout
             ┌─╥─┐                          ┌─╥─┐
     D_13  1 │     │ 30  D_12       3.3     1 │     │ 30  5V
    3.3 V  2 │     │ 29  D_11       GND     2 │     │ 29  GND
     AREF  3 │     │ 28  D_10       GPIO15  3 │     │ 28  GPIO13
 D_14 A_0  4 │     │ 27  D_9        GPIO2   4 │     │ 27  GPIO12
 D_15 A_1  5 │     │ 26  D_8        GPIO4   5 │     │ 26  GPIO14
 D_16 A_2  6 │     │ 25  D_7        GPIO16  6 │     │ 25  GPIO27
 D_17 A_3  7 │     │ 24  D_6        GPIO17  7 │     │ 24  GPIO26
 D_18 A_4  8 │     │ 23  D_5        GPIO5   8 │     │ 23  GPIO25
 D_19 A_5  9 │     │ 22  D_4        GPIO18  9 │     │ 22  GPIO33
      A_6 10 │     │ 21  D_3        GPIO19 10 │     │ 21  GPIO32
      A_7 11 │     │ 20  D_2        GPIO21 11 │     │ 20  GPIO35
       5V 12 │     │ 19  GND        GPIO3  12 │     │ 19  GPIO34
    Reset 13 │     │ 18  Reset      GPIO1  13 │     │ 18  GPIO39
      GND 14 │     │ 17  D_0 RX     GPIO22 14 │     │ 17  GPIO36
 Power In 15 │     │ 16  D_1 TX     GPIO23 15 │     │ 16  Chip enable
             └───┘                          └───┘
  Visit https://www.peguino.com    

        
*/
     
    #include <Wire.h>
     
    void setup()
    {
      Wire.begin();     
      Serial.begin (115200);        // Press Ctrl+Shift+M and set the serial monitor to the same baud rate!
      Serial.println("Peguino I2C OLED Display Scanner");
    }
     
     
    void loop()
    {
      byte error, address;
      int nDevices;
     
      Serial.println("Scanning...");
     
      nDevices = 0;
      for(address = 1; address < 127; address++ )
      {
        Wire.beginTransmission(address);
        error = Wire.endTransmission();
     
        if (error == 0)
        {
          Serial.print("OLED Display found at address 0x");
          if (address<16)
            Serial.print("0");
          Serial.print(address,HEX);
          Serial.println("  !");
     
          nDevices++;
        }
        else if (error==4)
        {
          Serial.print("Unknown error at address 0x");
          if (address<16)
            Serial.print("0");
          Serial.println(address,HEX);
        }    
      }
      if (nDevices == 0)
        Serial.println("No I2C devices found\n");
      else
        Serial.println("done\n");
     
      delay(500);     
    }


In the Serial Monitor you find the address. See example below:

[Image: LCDDisplay_scanadress_01.png]


Now copy the address (in the example above it is 0x27) and paste into the code example below to use the LED Display Brick.
In this example it might be the case you need to add the library LiquidCrystal_I2C. Press CTRL+SHIFT+I to open the Library Manager and copy in the search field "LiquidCrystal_I2C". Select the LiquidCrystal I2C library by Franz de Brabander to install.

Code:
/*
LCD Display Brick
(C) 2018 by Peguino LTD
Connect the LED Display Display Brick to port B
Version 1

Note: Check the I2C Address Scanner script first to get the correct I2C Address

  Peguino Uno Nano Board Pinout       Peguino Uno ESP 32 Development Board Pinout
             ┌─╥─┐                          ┌─╥─┐
     D_13  1 │     │ 30  D_12       3.3     1 │     │ 30  5V
    3.3 V  2 │     │ 29  D_11       GND     2 │     │ 29  GND
     AREF  3 │     │ 28  D_10       GPIO15  3 │     │ 28  GPIO13
 D_14 A_0  4 │     │ 27  D_9        GPIO2   4 │     │ 27  GPIO12
 D_15 A_1  5 │     │ 26  D_8        GPIO4   5 │     │ 26  GPIO14
 D_16 A_2  6 │     │ 25  D_7        GPIO16  6 │     │ 25  GPIO27
 D_17 A_3  7 │     │ 24  D_6        GPIO17  7 │     │ 24  GPIO26
 D_18 A_4  8 │     │ 23  D_5        GPIO5   8 │     │ 23  GPIO25
 D_19 A_5  9 │     │ 22  D_4        GPIO18  9 │     │ 22  GPIO33
      A_6 10 │     │ 21  D_3        GPIO19 10 │     │ 21  GPIO32
      A_7 11 │     │ 20  D_2        GPIO21 11 │     │ 20  GPIO35
       5V 12 │     │ 19  GND        GPIO3  12 │     │ 19  GPIO34
    Reset 13 │     │ 18  Reset      GPIO1  13 │     │ 18  GPIO39
      GND 14 │     │ 17  D_0 RX     GPIO22 14 │     │ 17  GPIO36
 Power In 15 │     │ 16  D_1 TX     GPIO23 15 │     │ 16  Chip enable
             └───┘                          └───┘
  Visit https://www.peguino.com    

         
*/

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2); // copy here the correct address in here. Replace the 0x27 with the Address your scan has provided!

void setup()
{
lcd.init(); // initialize the lcd
lcd.init();

lcd.backlight();
lcd.setCursor(0,0);   // 0,0 = start with the first character at first line (counting starts with zero!)
lcd.print("PEGUINO LCD");
lcd.setCursor(0,1); // 0,1 = start with the first character at the second line (counting starts with zero!)
lcd.print("Display Brick");

}

void loop()
{
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)