Friday, 28 December 2018

Digispark#1 : Interfacing Digispark With LCD 16x2

Digispark #1:

 Interfacing Digispark With LCD 16x2


                 In the previous post, we have seen the introduction to Digispark and make a simple led blink project. This time we will use the Digispark to interface with 16x2 LCD display. Since the number of a pin on Digispark is limited, we will use the i2C protocol to connect with the LCD. The item we will use is as shown below.




Digispark





i2C 16x2 LCD Display



                           Once we all the items in hand. We are ready to make the hardware connection first. The connection is done as per the image below.







               
                           Next step is to write a program. To do this open the Arduino IDE and copy & paste the code below.




 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <TinyWireM.h>                  // I2C Master lib for ATTinys which use USI - comment this out to use with standard arduinos
#include <LiquidCrystal_I2C1.h>          // for LCD w/ GPIO MODIFIED for the ATtiny85

#define GPIO_ADDR     0x27             // (PCA8574A A0-A2 @5V) typ. A0-A3 Gnd 0x20 / 0x38 for A - 0x27 is the address of the Digispark LCD modules.


LiquidCrystal_I2C1 lcd(GPIO_ADDR,16,2);  // set address & 16 chars / 2 lines


void setup(){
  TinyWireM.begin();                    // initialize I2C lib - comment this out to use with standard arduinos
  lcd.init();                           // initialize the lcd 
  lcd.backlight();                      // Print a message to the LCD.
  lcd.print("Electrosoft!");
}

void loop(){

}


And below is the simple video on how to compile the code above and download to the Digispark.





Finally, you can run the code on the Digispark.







Below is the demo video.





Thank you.



1 comment:

  1. Thanks for sharing this useful content. STONE Tech is a manufacturer of HMI display module Intelligent TFT LCD.

    tft-lcd display

    ReplyDelete