iic i2c twi 1602 serial lcd module display free sample
As we all know, though LCD and some other displays greatly enrich the man-machine interaction, they share a common weakness. When they are connected to a controller, multiple IOs will be occupied of the controller which has no so many outer ports. Also it restricts other functions of the controller. Therefore, LCD1602 with an I2C bus is developed to solve the problem.
I2C bus is a type of serial bus invented by PHLIPS. It is a high performance serial bus which has bus ruling and high or low speed device synchronization function required by multiple-host system. The blue potentiometer on the I2C LCD1602 (see the figure below) is used to adjust the backlight for better display. I²C uses only two bidirectional open-drain lines, Serial Data Line (SDA) and Serial Clock Line (SCL), pulled up with resistors. Typical voltages used are +5 V or +3.3 V although systems with other voltages are permitted.
The Arduino family of devices is features rich and offers many capabilities. The ability to interface to external devices readily is very enticing, although the Arduino has a limited number of input/output options. Adding an external display would typically require several of the limited I/O pins. Using an I2C interface, only two connections for an LCD character display are possible with stunning professional results. We offer both a 4 x 20 LCD.
The character LCD is ideal for displaying text and numbers and special characters. LCDs incorporate a small add-on circuit (backpack) mounted on the back of the LCD module. The module features a controller chip handling I2C communications and an adjustable potentiometer for changing the intensity of the LED backlight. An I2C LCD advantage is that wiring is straightforward, requiring only two data pins to control the LCD.
A standard LCD requires over ten connections, which can be a problem if your Arduino does not have many GPIO pins available. If you happen to have an LCD without an I2C interface incorporated into the design, these can be easily
The LCD displays each character through a matrix grid of 5×8 pixels. These pixels can display standard text, numbers, or special characters and can also be programmed to display custom characters easily.
Connecting the Arduino UNO to the I2C interface of the LCD requires only four connections. The connections include two for power and two for data. The chart below shows the connections needed.
The I2C LCD interface is compatible across much of the Arduino family. The pin functions remain the same, but the labeling of those pins might be different.
Located on the back of the LCD screen is the I2C interface board, and on the interface is an adjustable potentiometer. This adjustment is made with a small screwdriver. You will adjust the potentiometer until a series of rectangles appear – this will allow you to see your programming results.
The Arduino module and editor do not know how to communicate with the I2C interface on the LCD. The parameter to enable the Arduino to send commands to the LCD are in separately downloaded LiquidCrystal_I2C library.
The LiquidCrystal_I2C is available from GitHub. When visiting the GitHub page, select the Code button and from the drop-down menu, choose Download ZIP option to save the file to a convenient location on your workstation.
Before installing LiquidCrystal_I2C, remove any other libraries that may reside in the Arduino IDE with the same LiquidCrystal_I2C name. Doing this will ensure that only the known good library is in use. LiquidCrystal_I2C works in combination with the preinstalled Wire.h library in the Arduino editor.
To install the LiquidCrystal_I2C library, use the SketchSketch > Include Library > Add .ZIP Library…from the Arduino IDE (see example). Point to the LiquidCrystal_I2C-master.zip which you previously downloaded and the Library will be installed and set up for use.
Several examples and code are included in the Library installation, which can provide some reference and programming examples. You can use these example sketches as a basis for developing your own code for the LCD display module.
The I2c address can be changed by shorting the address solder pads on the I2C module. You will need to know the actual address of the LCD before you can start using it.
Once you have the LCD connected and have determined the I2C address, you can proceed to write code to display on the screen. The code segment below is a complete sketch ready for downloading to your Arduino.
The code assumes the I2C address of the LCD screen is at 0x27 and can be adjusted on the LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27,16,2); as required.
Similar to the cursor() function, this will create a block-style cursor. Displayed at the position of the next character to be printed and displays as a blinking rectangle.
This function turns off any characters displayed to the LCD. The text will not be cleared from the LCD memory; rather, it is turned off. The LCD will show the screen again when display() is executed.
Scrolling text if you want to print more than 16 or 20 characters in one line then the scrolling text function is convenient. First, the substring with the maximum of characters per line is printed, moving the start column from right to left on the LCD screen. Then the first character is dropped, and the next character is displayed to the substring. This process repeats until the full string has been displayed on the screen.
The LCD driver backpack has an exciting additional feature allowing you to create custom characters (glyph) for use on the screen. Your custom characters work with both the 16×2 and 20×4 LCD units.
A custom character allows you to display any pattern of dots on a 5×8 matrix which makes up each character. You have full control of the design to be displayed.
To aid in creating your custom characters, there are a number of useful tools available on Internet. Here is a LCD Custom Character Generator which we have used.
This tutorial shows how to use the I2C LCD (Liquid Crystal Display) with the ESP32 using Arduino IDE. We’ll show you how to wire the display, install the library and try sample code to write text on the LCD: static text, and scroll long messages. You can also use this guide with the ESP8266.
Additionally, it comes with a built-in potentiometer you can use to adjust the contrast between the background and the characters on the LCD. On a “regular” LCD you need to add a potentiometer to the circuit to adjust the contrast.
Before displaying text on the LCD, you need to find the LCD I2C address. With the LCD properly wired to the ESP32, upload the following I2C Scanner sketch.
After uploading the code, open the Serial Monitor at a baud rate of 115200. Press the ESP32 EN button. The I2C address should be displayed in the Serial Monitor.
Displaying static text on the LCD is very simple. All you have to do is select where you want the characters to be displayed on the screen, and then send the message to the display.
In this simple sketch we show you the most useful and important functions from the LiquidCrystal_I2C library. So, let’s take a quick look at how the code works.
The next two lines set the number of columns and rows of your LCD display. If you’re using a display with another size, you should modify those variables.
Then, you need to set the display address, the number of columns and number of rows. You should use the display address you’ve found in the previous step.
To display a message on the screen, first you need to set the cursor to where you want your message to be written. The following line sets the cursor to the first column, first row.
Scrolling text on the LCD is specially useful when you want to display messages longer than 16 characters. The library comes with built-in functions that allows you to scroll text. However, many people experience problems with those functions because:
The messageToScroll variable is displayed in the second row (1 corresponds to the second row), with a delay time of 250 ms (the GIF image is speed up 1.5x).
In a 16×2 LCD there are 32 blocks where you can display characters. Each block is made out of 5×8 tiny pixels. You can display custom characters by defining the state of each tiny pixel. For that, you can create a byte variable to hold the state of each pixel.
In summary, in this tutorial we’ve shown you how to use an I2C LCD display with the ESP32/ESP8266 with Arduino IDE: how to display static text, scrolling text and custom characters. This tutorial also works with the Arduino board, you just need to change the pin assignment to use the Arduino I2C pins.
This 16 character by 2 line display has a very clear and high contrast white text upon a blue background/backlight. It also includes a serial I2C/IIC adaptor board pre-soldered to the back of the LCD. This means it can be controlled with just 2 I2C serial data pins (SDA & SCL) and so requires far less digital IO pins when controlled from a microcontroller. In total the module only requires 4 wires including 5V power and GND. Contrast adjustment is also provided by the daughter board via a potentiometer. If you plan to use this with an Arduino board you can download a compatible library and example sketch from our support forum
These modules are currently supplied with a default I2C address of either 0x27 or 0x3F. To determine which version you have check the black I2C adaptor board on the underside of the module. If there a 3 sets of pads labelled A0, A1, & A2 then the default address will be 0x3F. If there are no pads the default address will be 0x27.
If pressure is applied to the I2C daughter board it is possible for it to bend and come contact with the LCD module. Please ensure when the LCD is installed in your application that no external object is applying pressure to the back of the module.
This 2×16 character LCD Module with BLUE Backlight uses an I2C interface to communicate with the host microcontroller. This budget-conscious LCD is used on projects requiring the display of text, data, or ASCII characters of all types. Connect to Vcc, Gnd, SDA (serial data line), and SCL (serial clock line). This is a 5VDC device and will be found on the I2C bus at address 0x27 / 0x3F.
This is another great blue backlight LCD display. As the pin resources of Arduino controller is limited, your project may be not able to use normal LCD shield after connected with a certain quantity of sensors or SD card. However, with this I2C interface LCD module, you will be able to realize data display via only 2 wires. If you already has I2C devices in your project, this LCD module actually cost no more resources at all. It is fantastic for Arduino based project.
This is another great blue backlight LCD display. As the pin resources of Arduino controller is limited, your project may be not able to use normal LCD shield after connected with a certain quantity of sensors or SD card. However, with this I2C interface LCD module, you will be able to realize data display via only 2 wires. If you already has I2C devices in your project, this LCD module actually cost no more resources at all. It is fantastic for Arduino based project.
If you’ve ever tried to connect an LCD display to an Arduino, you might have noticed that it consumes a lot of pins on the Arduino. Even in 4-bit mode, the Arduino still requires a total of seven connections – which is half of the Arduino’s available digital I/O pins.
The solution is to use an I2C LCD display. It consumes only two I/O pins that are not even part of the set of digital I/O pins and can be shared with other I2C devices as well.
True to their name, these LCDs are ideal for displaying only text/characters. A 16×2 character LCD, for example, has an LED backlight and can display 32 ASCII characters in two rows of 16 characters each.
If you look closely you can see tiny rectangles for each character on the display and the pixels that make up a character. Each of these rectangles is a grid of 5×8 pixels.
At the heart of the adapter is an 8-bit I/O expander chip – PCF8574. This chip converts the I2C data from an Arduino into the parallel data required for an LCD display.
If you are using multiple devices on the same I2C bus, you may need to set a different I2C address for the LCD adapter so that it does not conflict with another I2C device.
An important point here is that several companies manufacture the same PCF8574 chip, Texas Instruments and NXP Semiconductors, to name a few. And the I2C address of your LCD depends on the chip manufacturer.
According to the Texas Instruments’ datasheet, the three address selection bits (A0, A1 and A2) are placed at the end of the 7-bit I2C address register.
According to the NXP Semiconductors’ datasheet, the three address selection bits (A0, A1 and A2) are also placed at the end of the 7-bit I2C address register. But the other bits in the address register are different.
So your LCD probably has a default I2C address 0x27Hex or 0x3FHex. However it is recommended that you find out the actual I2C address of the LCD before using it.
Connecting an I2C LCD is much easier than connecting a standard LCD. You only need to connect 4 pins instead of 12. Start by connecting the VCC pin to the 5V output on the Arduino and GND to ground.
Now we are left with the pins which are used for I2C communication. Note that each Arduino board has different I2C pins that must be connected accordingly. On Arduino boards with the R3 layout, the SDA (data line) and SCL (clock line) are on the pin headers close to the AREF pin. They are also known as A5 (SCL) and A4 (SDA).
After wiring up the LCD you’ll need to adjust the contrast of the display. On the I2C module you will find a potentiometer that you can rotate with a small screwdriver.
Plug in the Arduino’s USB connector to power the LCD. You will see the backlight lit up. Now as you turn the knob on the potentiometer, you will start to see the first row of rectangles. If that happens, Congratulations! Your LCD is working fine.
To drive an I2C LCD you must first install a library called LiquidCrystal_I2C. This library is an enhanced version of the LiquidCrystal library that comes with your Arduino IDE.
Filter your search by typing ‘liquidcrystal‘. There should be some entries. Look for the LiquidCrystal I2C library by Frank de Brabander. Click on that entry, and then select Install.
The I2C address of your LCD depends on the manufacturer, as mentioned earlier. If your LCD has a Texas Instruments’ PCF8574 chip, its default I2C address is 0x27Hex. If your LCD has NXP Semiconductors’ PCF8574 chip, its default I2C address is 0x3FHex.
So your LCD probably has I2C address 0x27Hex or 0x3FHex. However it is recommended that you find out the actual I2C address of the LCD before using it. Luckily there’s an easy way to do this, thanks to the Nick Gammon.
But, before you proceed to upload the sketch, you need to make a small change to make it work for you. You must pass the I2C address of your LCD and the dimensions of the display to the constructor of the LiquidCrystal_I2C class. If you are using a 16×2 character LCD, pass the 16 and 2; If you’re using a 20×4 LCD, pass 20 and 4. You got the point!
First of all an object of LiquidCrystal_I2C class is created. This object takes three parameters LiquidCrystal_I2C(address, columns, rows). This is where you need to enter the address you found earlier, and the dimensions of the display.
In ‘setup’ we call three functions. The first function is init(). It initializes the LCD object. The second function is clear(). This clears the LCD screen and moves the cursor to the top left corner. And third, the backlight() function turns on the LCD backlight.
After that we set the cursor position to the third column of the first row by calling the function lcd.setCursor(2, 0). The cursor position specifies the location where you want the new text to be displayed on the LCD. The upper left corner is assumed to be col=0, row=0.
There are some useful functions you can use with LiquidCrystal_I2C objects. Some of them are listed below:lcd.home() function is used to position the cursor in the upper-left of the LCD without clearing the display.
lcd.scrollDisplayRight() function scrolls the contents of the display one space to the right. If you want the text to scroll continuously, you have to use this function inside a for loop.
lcd.scrollDisplayLeft() function scrolls the contents of the display one space to the left. Similar to above function, use this inside a for loop for continuous scrolling.
If you find the characters on the display dull and boring, you can create your own custom characters (glyphs) and symbols for your LCD. They are extremely useful when you want to display a character that is not part of the standard ASCII character set.
CGROM is used to store all permanent fonts that are displayed using their ASCII codes. For example, if we send 0x41 to the LCD, the letter ‘A’ will be printed on the display.
CGRAM is another memory used to store user defined characters. This RAM is limited to 64 bytes. For a 5×8 pixel based LCD, only 8 user-defined characters can be stored in CGRAM. And for 5×10 pixel based LCD only 4 user-defined characters can be stored.
After the library is included and the LCD object is created, custom character arrays are defined. The array consists of 8 bytes, each byte representing a row of a 5×8 LED matrix. In this sketch, eight custom characters have been created.
{"id":1629858988090,"title":"IIC I2C TWI SPI Serial Interface Expanded Board Module Port for Arduino UNO R3 1602 LCD 2004 LCD 12864 LCD Display","handle":"diymore-iic-i2c-twi-spi-serial-interface-expanded-board-module-port-for-arduino-uno-r3-1602-lcd-2004-lcd-12864-lcd-display","description":"\u003cstrong\u003eFeature:\u003c\/strong\u003e\u003cbr\u003e\u003cbr\u003eUsing MCP23017 chip, which is compatible with 1602 LCD 2004 LCD 12864 LCD.\u003cbr\u003eI2C Address: Can be set according to your requirements, please see the left schematic.\u003cbr\u003eThe backlight and contrast is adjusted by potentiometer.\u003cbr\u003eCome with 2 IIC interface, which can be connected by Dupont Line or IIC dedicated cable.\u003cbr\u003eSupply Voltage: 5V.\u003cbr\u003e\u003cbr\u003e\u003cbr\u003eThis is a new design, using MCP23017 chip, which is compatible with 1602 and 12864 LCD screens. \u003cbr\u003eThrough this module switching, using I2C communication, only two MCU I\/Os are needed to realize the LCD drive display. The potentiometer on the module can achieve contrast adjustment. \u003cbr\u003eYou can also unplug the jump cap to turn off the backlight or adjust the brightness through PWM. \u003cbr\u003eWe provide the wiring diagram and arduino sample code.It is fantastic for Arduino based project.\u003cbr\u003eWe have the manufacture factory, making productions and selling by ourselves.\u003cbr\u003eSo we can control the quality of our productions by ourselves for you.\u003cbr\u003eWe"d like to receive your suggestions and thoughts on our products.\u003cbr\u003eIf you have any questions, please feel free to contact us.\u003cbr\u003e\u003cbr\u003e\u003cstrong\u003ePackage Included:\u003c\/strong\u003e\u003cbr\u003e\u003cbr\u003e1 x IIC I2C TWI SPI Serial Interface Expanded Board Module","published_at":"2018-07-05T18:21:14+08:00","created_at":"2018-07-05T18:40:30+08:00","vendor":"diymore","type":"Interface Module","tags":["Arduino","Display","New Products","UNO R3"],"price":1999,"price_min":1999,"price_max":1999,"available":true,"price_varies":false,"compare_at_price":null,"compare_at_price_min":0,"compare_at_price_max":0,"compare_at_price_varies":false,"variants":[{"id":14876930048058,"title":"Default Title","option1":"Default Title","option2":null,"option3":null,"sku":"012618","requires_shipping":true,"taxable":false,"featured_image":null,"available":true,"name":"IIC I2C TWI SPI Serial Interface Expanded Board Module Port for Arduino UNO R3 1602 LCD 2004 LCD 12864 LCD Display","public_title":null,"options":["Default Title"],"price":1999,"weight":9,"compare_at_price":null,"inventory_management":"shopify","barcode":"","requires_selling_plan":false,"selling_plan_allocations":[]}],"images":["\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_1_224.jpg?v=1588642543","\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/9e2408f5f928b2d429150abf75a6b707_324.jpg?v=1588642543","\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_394.jpg?v=1588642543","\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_67bd2bd9-f303-4443-a050-c6a471ba5fa0_820.jpg?v=1588642543","\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_2_655.jpg?v=1588642543","\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_5_336.jpg?v=1588642543","\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_11_910.jpg?v=1588642543"],"featured_image":"\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_1_224.jpg?v=1588642543","options":["Title"],"media":[{"alt":"Iic I2C Twi Spi Serial Interface Expanded Board Module Port For Arduino Uno R3 1602 Lcd 2004 12864","id":6678255534151,"position":1,"preview_image":{"aspect_ratio":1.0,"height":1000,"width":1000,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_1_224.jpg?v=1588642543"},"aspect_ratio":1.0,"height":1000,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_1_224.jpg?v=1588642543","width":1000},{"alt":"Iic I2C Twi Spi Serial Interface Expanded Board Module Port For Arduino Uno R3 1602 Lcd 2004 12864","id":6678255894599,"position":2,"preview_image":{"aspect_ratio":1.546,"height":647,"width":1000,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/9e2408f5f928b2d429150abf75a6b707_324.jpg?v=1588642543"},"aspect_ratio":1.546,"height":647,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/9e2408f5f928b2d429150abf75a6b707_324.jpg?v=1588642543","width":1000},{"alt":"Iic I2C Twi Spi Serial Interface Expanded Board Module Port For Arduino Uno R3 1602 Lcd 2004 12864","id":6678256353351,"position":3,"preview_image":{"aspect_ratio":1.0,"height":1000,"width":1000,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_394.jpg?v=1588642543"},"aspect_ratio":1.0,"height":1000,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_394.jpg?v=1588642543","width":1000},{"alt":"Iic I2C Twi Spi Serial Interface Expanded Board Module Port For Arduino Uno R3 1602 Lcd 2004 12864","id":6678256713799,"position":4,"preview_image":{"aspect_ratio":1.0,"height":1000,"width":1000,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_67bd2bd9-f303-4443-a050-c6a471ba5fa0_820.jpg?v=1588642543"},"aspect_ratio":1.0,"height":1000,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_67bd2bd9-f303-4443-a050-c6a471ba5fa0_820.jpg?v=1588642543","width":1000},{"alt":"Iic I2C Twi Spi Serial Interface Expanded Board Module Port For Arduino Uno R3 1602 Lcd 2004 12864","id":6678257008711,"position":5,"preview_image":{"aspect_ratio":1.0,"height":1000,"width":1000,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_2_655.jpg?v=1588642543"},"aspect_ratio":1.0,"height":1000,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_2_655.jpg?v=1588642543","width":1000},{"alt":"Iic I2C Twi Spi Serial Interface Expanded Board Module Port For Arduino Uno R3 1602 Lcd 2004 12864","id":6678257074247,"position":6,"preview_image":{"aspect_ratio":1.0,"height":1000,"width":1000,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_5_336.jpg?v=1588642543"},"aspect_ratio":1.0,"height":1000,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_5_336.jpg?v=1588642543","width":1000},{"alt":"Iic I2C Twi Spi Serial Interface Expanded Board Module Port For Arduino Uno R3 1602 Lcd 2004 12864","id":6678257270855,"position":7,"preview_image":{"aspect_ratio":1.0,"height":1000,"width":1000,"src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_11_910.jpg?v=1588642543"},"aspect_ratio":1.0,"height":1000,"media_type":"image","src":"https:\/\/cdn.shopify.com\/s\/files\/1\/0122\/7558\/0986\/products\/012618_11_910.jpg?v=1588642543","width":1000}],"requires_selling_plan":false,"selling_plan_groups":[],"content":"\u003cstrong\u003eFeature:\u003c\/strong\u003e\u003cbr\u003e\u003cbr\u003eUsing MCP23017 chip, which is compatible with 1602 LCD 2004 LCD 12864 LCD.\u003cbr\u003eI2C Address: Can be set according to your requirements, please see the left schematic.\u003cbr\u003eThe backlight and contrast is adjusted by potentiometer.\u003cbr\u003eCome with 2 IIC interface, which can be connected by Dupont Line or IIC dedicated cable.\u003cbr\u003eSupply Voltage: 5V.\u003cbr\u003e\u003cbr\u003e\u003cbr\u003eThis is a new design, using MCP23017 chip, which is compatible with 1602 and 12864 LCD screens. \u003cbr\u003eThrough this module switching, using I2C communication, only two MCU I\/Os are needed to realize the LCD drive display. The potentiometer on the module can achieve contrast adjustment. \u003cbr\u003eYou can also unplug the jump cap to turn off the backlight or adjust the brightness through PWM. \u003cbr\u003eWe provide the wiring diagram and arduino sample code.It is fantastic for Arduino based project.\u003cbr\u003eWe have the manufacture factory, making productions and selling by ourselves.\u003cbr\u003eSo we can control the quality of our productions by ourselves for you.\u003cbr\u003eWe"d like to receive your suggestions and thoughts on our products.\u003cbr\u003eIf you have any questions, please feel free to contact us.\u003cbr\u003e\u003cbr\u003e\u003cstrong\u003ePackage Included:\u003c\/strong\u003e\u003cbr\u003e\u003cbr\u003e1 x IIC I2C TWI SPI Serial Interface Expanded Board Module"}
This is a I2C Serial LCD Daughter board that can be connected to a standard 16×2 or 20×4 Character Display Module that supports 4-bit mode. All Character Modules sold on our site support 4-bit mode, and nearly all commercially available 16×2 and 20×4 line character modules support it too. This board has a PCF8574 I2C chip that converts I2C serial data to parallel data for the LCD display. There are many examples on the internet for using this board with Arduino. Do a search for “Arduino LCD PCF8574“. The I2C address is 0x3F by default, but this can be changed via 3 solder jumpers provided on the board. This allows up to 3 LCD displays to be controlled via a single I2C bus (giving each one it’s own address).
You will find out how to get to the I2C address of your display. If the standard 0x27 does not work, you can optionally connect a 20x4 LCD. Your time formats according to your choice.
After I was informed about the advantages of the I2C (= IIC) port andmanaged more than 120 objects, I have reordered an I2C adapter. It will upgrade my displays with I2C, and save the wiring of the 16 PINs. The adapter advantageously carries a potentiometer on board, which can adjust brightness. The photo shows a screwdriver that fixes the adapter header after insertion into the LCD. This ensures good contact (the soldering will be done later).
So what do I do if theParticle WebIDE(provided by Jim Brower - thanks! >Link to his GitHub<) and I2C LibaryLiquidCrystal_I2C_Sparkdo not work right away?
After all, I had GND, VCC andD0 (SDA) and D1 (SCL)as a source of errors. I can exclude some, even if I havenot built the resistors from the Particle Doc. The research brought me to change the hex address and so it worked out right away.// The address is typically 0x27. I2C Address: 0x3F// https://www.sainsmart.com/new-sainsmart-iic-i2c-twi-1602-serial-lcd-module-display-for-arduino-uno-mega-r3.htmllcd = new LiquidCrystal_I2C(0x3F /*address*/, 16 /*columns*/, 2/*rows*/);
This manual approach was trial and error, and could have gone wrong. I am today onthis thread from 2014, which an I2C scanner pushed the correct addresses over the serial port. So I feel responsible to document this project over the succession of 3 years.
The second part now wants to replace the example code for the clock from the library, and present ways to format its own output.lcd->setCursor(0 /*columns*/,0 /*rows*/);// lcd->print(Time.timeStr());lcd->print(Time.format(Time.now(), "%d.%m. %A"));// Serial.println(Time.format(Time.now(), "%H:%M:%S"));lcd->setCursor(4,1);lcd->print(Time.format(Time.now(), "%H:%M:%S"));