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.

1602 serial lcd module display free sample

The Serial LCD Kit includes all the parts you need to add a serial "backpack" to a 16x2 LCD. The kit includes a pre-programmed ATmega328 microprocessor, which reads a serial stream of data and (after a little heavy-lifting) instantly displays it on the LCD. Interfacing the Serial LCD with an Arduino, or other serial-enabled devices, allows you to easily print GPS coordinates, short messages or any other information onto the LCD.

This tutorial will cover everything you need to know to get up and running with the Serial Enabled LCD Kit. We"ll first go over assembly so you can turn that bag-o-parts into something that hopefully resembles any pictures you may have seen of the kit.

Following assembly, we"ll touch on how to actually use the Serial LCD Kit. Specifically, we"ll go over how you"d use the thing with everybody"s favorite development board, Arduino. There"ll be example code galore, and you can even make your own LCD clock! It"s gonna be pretty crazy...

Finally, you"ll need something to send a serial stream of data to the display. An Arduino works great (any variety, this isn"t limited to the Uno) if you want to automate the serial data stream. FTDI breakouts or RS-232 level shifters work if you just want to connect the display to your computer and send data via a terminal program. For what it"s worth, this tutorial will focus on connecting the display to an Arduino.

The goal of the Serial LCD Kit is to make controlling an LCD simple and to make wiring to it even simpler. If you wanted, you could abstain from using the serial backpack and wire an Arduino directly up to the LCD. To that point, there are loads of great examples, and even some Arduino libraries, that make interfacing a microcontroller directly to an LCD very easy. However, because the LCD is driven by a parallel interface, those examples require a tangle of wires and anywhere from 6 to 11 pins of the Arduino to control the thing.

The microcontroller on the Serial LCD Kit takes care of all of that nasty wiring, so you only need one pin to control the LCD. The Serial LCD"s on-board microcontroller parses any incoming commands or characters, and then sends the proper data to the LCD over the multi-wire parallel interface. It"s a magic black box, and you don"t have to care how it does its job, just that it does it. So let"s get it built...

What you"ve got in front of you right now is not yet a Serial LCD Kit. First, we"ve got to turn that bag of parts into a Serial LCD Kit, which will require soldering. If you"ve never soldered before, don"t fret! This is one of the easier soldering projects, every part is through-hole, and well-spaced. If this is your first time though, I"d encourage you to take a trip over to one of our excellent soldering tutorials before picking up the iron.

First, pick out the big, ferrari-red PCB. See how one side has white silkscreen printed onto it? This is the top of the PCB. You"ll stick almost every part in on this side and solder the pins to the opposite side. The only time we"ll stray from that is when soldering the LCD, which is the last step.

Wait...something"s missing...oh, hi LCD! To connect the LCD to the PCB, we"ve included a straight 16-pin header with the kit. You"ll need to solder this header to both the PCB and the LCD. Solder it first to the LCD, stick the shorter pins into the LCD. Make sure the longer legs are extended out from the back of the LCD and solder all 16-pins on the top side of the LCD. Effort to keep the pins as perpendicular to the LCD as possible.

With the header soldered to the LCD,you"ll finally be able to connect the display to the PCB. Remember, we"re sticking this part into the bottom side of the PCB, and soldering to the top. Solder up all 16 pins, and that should be it.

Before you can display anything on the LCD, you"ll have to connect something to it. Only three wires are necessary to use the Serial LCD Kit: RX, GND and VCC. Plug the included 3-wire jumper cable into its mating JST connector that you soldered onto the PCB. This color coded cable has two wires for power, and one for receiving serial data. The red and black wires correspond to +5V and GND, respectively, and the yellow wire is RX.

You"ll need to figure out how you"re going to powerthe LCD Kit. It doesn"t have a regulator on-board, so it"s up to you to supply a clean, regulated 5V power source. If you"re using an Arduino, you could power the Kit off of the 5V and GND pins – connect red to 5V and black to GND. Otherwise, there"s a ton of options out there for power; you could use a USB adapter, a 5V wall-wart, a breadboard power supply. The list just goes on. Just make sure you"re not supplying any more than 5V (a little less may work, but you"ll lose some brightness).

After powering the Serial LCD Kit, you should notice the backlight turn on. If the contrast is properly adjusted, you might see the splash screen flash for a second or two. Most likely though, the contrast won"t be set correctly, so you won"t see a splash screen. In that case, you may see anything from 32 white boxes to absolutely nothing. You"ll have to be quick about it, because the splash screen only remains for a couple seconds before going blank, but try turning the trimpot knob until you"ve got a good view of the characters on the LCD.

The "Serial" in the Serial LCD Kit can be a little confusing. What it really means is TTL serial, not to be confused with RS-232 serial. The voltage on the RX line should only go between 0 and +5V. If you"re using a microcontroller (like an Arduino) to talk with the LCD, then you most likely don"t have to worry. Just don"t hook up a PC"s serial port straight to the LCD and expect it to survive.

There"s a lot of components that are capable of sending TTL serial data. The most popular here at SparkFun are USB-to-Serial boards (like the FTDI Basic Breakout), or an Arduino. This tutorial is going to assume you have an Arduino for the next few examples. No Arduino? That"s cool. I get it; you"re not gonna conform to this passing fad. Feel free to read on, and try to port these examples to your platform.

Connect the Arduino to the Serial LCD as follows. If you have a wire stripper, you may want to expose a few millimeters more of wire to allow them to stick really nicely into the Arduino"s headers.

Here"s a simple example sketch, which uses the SoftwareSerial library (which is included with recent versions of Arduino) to instill our Arduino with more than just the one, hardware, serial port. Now we can use the hardware serial port to listen to the serial monitor, and the second serial port can be used to talk to the LCD.

Now, plug in your Arduino and upload the code. Open up the serial monitor, and make sure it"s set to 9600. Type “Hello, world” into the serial monitor and send it over to the Arduino. The LCD should echo your greeting. Take the LCD for a test drive, discover all the characters it can display!

You"ll quickly notice, that the code is severely lacking any sort of clear display command, but don"t think for a second that the Serial LCD Kit doesn"t have a clear display command. It"s got commands up the wazoo! The Serial LCD Kit is set up to accept commands that control the backlight, baud rate, and all sorts of display functionality, like clearing the screen. Have a look at the Kit"s “datasheet”, which lists all of the characters and commands you can send to the display. I wrote that, but I understand if it"s all gobbledygook to you right now.

The commands are divided into three groups: backlight, baud rate, and special commands. Each command requires that you send at least two bytes to the display. For instance to set the backlight, you first have to send the backlight control byte (0x80, or decimal 128) followed by a byte with any value from 0 to 255. Sending a 0 will turn the backlight completely off, 255 will turn it all the way on, 127 will set it to about 50%, and so on. The backlight setting is stored in the Serial LCD Kit"s memory and will be restored when the LCD is turned off and on.

What we really care about right now, though, is clearing the display, which requires a special command. To issue a special command to the LCD, you first have to send 0xFE (or decimal 254) which tells the display to go into special command mode, and wait for a data byte. The clear display command is 0x01 (or decimal 1), that command should be sent immediately after sending the special command byte. So to clear the display we need to send two bytes: 254 (0xFE) followed by 1 (0x01). Check out the datasheet link for all of the special commands. You can do all sorts of fun stuff: scroll the display, turn it on/off and control the cursor.

Our next piece of example code, Serial_LCD_Kit_Clock, delves into sending special commands to the LCD with an Arduino. There are individual functions that clear the display (clearDisplay()), set the backlight (setBacklight(byte brightness)), and set the cursor (setLCDCursor(byte cursor_position)), feel free to copy these and add them to any code you"d like.

This is a good start, but there"s plenty of room for growth. Try adjusting the brightness of the display based on what time it was. Make it the brightest at midnight, dimmest at noon. What else can you do with the code?

Now then, that should be enough to get you on your way to using the Serial LCD Kit with a serial interface. If you"re happy with that, and don"t want your mind blown, I suggest you stop reading here.

Oh, you"ve taken the red pill? Well then you get to learn the Serial LCD Kit"s very deep, dark secret. It may not look anything like one, but the LCD Kit is actually Arduino-compatible. It has an ATmega328, just like the Arduino, and that ATmega328 has a serial bootloader, just like an Arduino. It can be programmed via a USB-to-Serial board. This means you can hook up all sorts of sensors, blinkies and other I/O to the Kit itself, while continuing to use the LCD to display any info you"d like. The 6-pin serial programming port on the right hand side of the PCB can be connected to an FTDI Basic Breakout.

With the FTDI board connected, and Arduino open, simply select the corresponding COM port in the Tools>Serial Port menu, and select Arduino Duemilanove or Nano w/ ATmega328 under the Tools>Boards menu. Though it probably won"t look like it"s doing anything, try uploading Blink, change the LED pin to 9 to at least see the backlight of the LCD flick on and off. Remember, you can download the Serial LCD Kit firmware here. If you ever want to turn it back into a Serial LCD, upload it to the LCD like you would any sketch.

If you want to be really adventurous, and get the most out of the Serial LCD Kit, I"d recommend first taking a trip over to where the Serial LCD Kit"s source code is hosted and getting a good idea how the code works. That firmware is written as an Arduino sketch, and uses a great little Arduino library named LiquidCrystal to control the LCD. The LiquidCrystal library makes controlling the LCD with an Arduino super-simple.

You should also get a good feeling for the kit"s schematic. There are a few Arduino pins that can only be used with the LCD (4-9), but pins 10-13, and all of the analog pins can be used with any device you"d normally connect to an Arduino. The available pins are all broken out on the bottom of the PCB.

Remember, this part is all very extracurricular. Don"t feel at all required to use your Serial LCD Kit as an Arduino. I just wanted to let you know what"s possible with this kit.

Serial LCD Clock Example Sketch - Displays a digital clock on the Serial LCD. This is a good example of how to use special commands, like clear, with the display.

Now I"ll leave you and your Serial LCD Kit in peace. I hope you"ve learned a good amount about the display. I also hope you"re left with questions and ideas about what you"re going to do with it next. If you"ve still got questions about the display, or comments about the tutorial, please drop them in the comments box below or email us.

1602 serial lcd module display free sample

This module works with at least the LiquidCrystal I2C and LiquidCrystal_PCF8574 libraries available in the Arduino library manager. Address 0x3F worked for me since the A0, A1, and A2 jumpers are not shorted.

Recently purchased unit has a different address than the same part number purchased a year ago. It seems that if the small board is marked MH, the address is not going to be 0x27 or 0x20 but 0x3F. With that change of address, this display works and looks great.

Google for LCM1602 and you will find many pages that mention the board - including the pinouts stated above and sample programs using the Arduino library.

On the software side, you have to download and install a new LiquidCrystal_I2C library for Arduino, which has the capability to talk to the LCD display over the I2C bus. Heres a link to the library. Follow the example code for the DFRobot board, which turns out to have the same configuration as this LCD, and it should fire right up for you. The LCD has white characters on a backlit blue background, and looked great.

1602 serial lcd module display free sample

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.

1602 serial lcd module display free sample

This 2×16 character LCD Module with YELLOW 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.

1602 serial lcd module display free sample

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.

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.

1602 serial lcd module display free sample

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.

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.

1602 serial lcd module display free sample

ERMC1602SBS-2 is 16 characters wide,2 rows character lcd module,SPLC780C controller (Industry-standard HD44780 compatible controller),6800 4/8-bit parallel interface,single led backlight with white color included can be dimmed easily with a resistor or PWM,stn- blue lcd negative,white text on the blue color,wide operating temperature range,rohs compliant,built in character set supports English/Japanese text, see the SPLC780C datasheet for the full character set. It"s optional for pin header connection,5V or 3.3V power supply and I2C adapter board for arduino.

1602 serial lcd module display free sample

ERM1602SYG-6 is 16 characters wide,2 rows character lcd module,SPLC780C controller (Industry-standard HD44780 compatible controller),6800 4/8-bit parallel interface,single led backlight with yellow green color included can be dimmed easily with a resistor or PWM,stn-lcd positive,dark blue text on the yellow green color,wide operating temperature range,rohs compliant,built in character set supports English/Japanese text, see the SPLC780C datasheet for the full character set. It"s optional for pin header connection,5V or 3.3V power supply and I2C adapter board for arduino.

1602 serial lcd module display free sample

The principle of the LCD1602 liquid crystal display is to use the physical characteristics of the liquid crystal to control the display area by voltage,

Before we get into the programming, we need to make sure the I2C module is enabled on the Pi and install a couple tools that will make it easier to use I2C.

By inserting the variable from your sensor into the mylcd.lcd_display_string() function (line 22 in the code above) you can print the sensor data just like any other text string.