Skip to content
FLAVIO COPES
flaviocopes.com
2026

Johnny Five, how to work with an LCD Screen

By Flavio Copes

Learn how to wire and control a 1602A LCD screen with Johnny Five and Node.js, initializing the LCD class and showing text with the print() method.

~~~

This post is part of the Johnny Five series. See the first post here.

An LCD screen is a pretty cool component because we can use it for many different projects in creative ways.

1602A LCD screen component with dark display and 16 pins along the top edge

This one I have is named 1602A.

Back side of 1602A LCD showing circuit board with labeled pins and components

It has 16 pins. I wired it in this way:

Complete wiring setup with Arduino connected to LCD screen and potentiometer on breadboard

Close-up view of LCD connected to breadboard with colorful jumper wires

The potentiometer has 3 pins. The middle one is connected to the LCD screen, the left one is 0V and the right one 5V:

Potentiometer component with three pins wired on breadboard for LCD backlight control

Arduino Uno board connected to LCD project with jumper wires and USB cable

That’s it for the wiring.

Create a new lcd.js file and load this code:

const { Board, LCD } = require("johnny-five")
const board = new Board()

board.on("ready", function () {})

Now initialize a new LCD object from the LCD class.

The exact initialization procedure depends on the kind of display used. In my case, it was this:

const lcd = new LCD({ pins: [7, 8, 9, 10, 11, 12] })

Finally, call the print() method to display a string:

const { Board, LCD } = require("johnny-five")
const board = new Board()

board.on("ready", function () {
  const lcd = new LCD({ pins: [7, 8, 9, 10, 11, 12] })
  lcd.print("Hello World!")
})

and run the program using node lcd.js to see it work:

LCD screen displaying Hello World text in bright blue characters on dark background

The LCD class also offers those cool methods:

You can find out more on http://johnny-five.io/api/lcd/.

~~~

Related posts about js: