LCD Backpacks

Device Information

There are several LCD backpacks on the market. This guide is written specifically using backpacks sold by HiLetGo on Amazon, but should work with any LCD Backpack using a single PCF8574T module. Note that the backpacks with a different architecture (like Adafruit’s) use a different library for communication. Additionally, not all modules are equal – we have found that those from SunFounder may vary in addressing schemas, despite being similar architecture to the HiLetgo modules.

In summary: The general function for all backpacks is the same, but some details may differ from the notes below for different individual units.

Photo of LCD Backpack with PCF8574T Module

Arduino Library

The LCD Library for this module is from https://github.com/johnrickman/LiquidCrystal_I2C.
In Arduino Library Manager, is it listed as “LiquidCrystal I2C” by “Frank de Brabander”. The version used in the code provided below is 1.1.2 .

Setting the Address

There are 3 solder pads on the backpack, labeled A0, A1, and A2. By default, the pads are all open. You may close them with a solder or wire bridge to adjust the address to suit your needs.

For convenience, it can be a great help to write the address in Sharpie on the back of the LCD/Backpack combination.

AddressA0A1A2
0x20ClosedClosedClosed
0x21OpenClosedClosed
0x22ClosedOpenClosed
0x23OpenOpenClosed
0x24ClosedClosedOpen
0x25OpenClosedOpen
0x26ClosedOpenOpen
0x27OpenOpenOpen
A photo of four LCD units from the back, showing labels for the address.

Obtaining the Address & Writing to the display

Some modules do not use the table above, even if they use the same architecture. As such, it is fairly standard to scan the I2C bus to identify the display. I took the code a step further and print the address to the display when it is found.

A photo of four LCD devices connected to an Arduino board.
#include <LiquidCrystal_I2C.h>

// SPDX-FileCopyrightText: 2023 Carter Nelson for Adafruit Industries
//
// SPDX-License-Identifier: MIT
// --------------------------------------
// i2c_scanner
//
// Modified from https://playground.arduino.cc/Main/I2cScanner/
// --------------------------------------

// The LCD Library used is from https://github.com/johnrickman/LiquidCrystal_I2C
//
// In Arduino Library Manager, is it listed as "LiquidCrystal I2C" by "Frank de Brabander". The version used in dev is 1.1.2 .

#include <Wire.h>

LiquidCrystal_I2C *plcd = NULL;

void setup() {
  Wire.begin();

  Serial.begin(9600);
  while (!Serial)
     delay(10);
  Serial.println("\nI2C Scanner for LCD Backpacks");
  delay(2000);
}


void loop() {
  byte error;
  uint8_t address; 
  int nDevices;
  char addrString[4];

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at decimal address ");
      Serial.print(address);
      Serial.print(" or hexadecimal address 0x");
      Serial.print(address, HEX);
      Serial.println(" !");
      sprintf(addrString, "%#x", address);

        plcd = new LiquidCrystal_I2C(address, 20, 4);
        plcd -> init();
        plcd -> noBacklight();
        delay(1000);
        plcd -> clear();
        plcd -> backlight();
        plcd -> setCursor(0,0);
        plcd -> print("Hello World");
        plcd -> setCursor(0,1);
        plcd -> print(addrString);
        

      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(60000);
}

Sabertooth Motor Controllers

The Sabertooth family of DC Brushed Motor Controllers, made by Dimension Engineering, are versatile and very simple to set up as long as you follow the datasheet/instructions. Below, we will run through some example circuits and behaviors.

(more…)

Multiplexing multiple I2C sensors: TCA/PCA9548A

One of the major limitations to I2C is the inherent address conflicts when you try to bus multiple sensors of the same type/family together. While all sensors have a default address, some give an option for a secondary, and fewer give tertiary addresses or beyond. Since most systems only have one I2C bus, you are limited in how many of those sensors are used.

The 9548 family of modules solves this problem: they are multiplexer.

(more…)

Sparkfun Serial 7-Segment Display

Sparkfun has made life much easier when working with 7-segment displays. To do so, they made their own PCB which has an Atmel 328P on the back and a 4-digit 7-segment display on the front.

(more…)

RasPi: Node Red with GUI

Node Red is an application built upon NodeJS which supports interfacing the GPIO pins of a Raspberry Pi via a webpage GUI.

It does not require that Apache or PHP be pre-installed, it can also run concurrently with Apache and PHP if they are.

(more…)

Analog to Digital Converters

Measuring voltages is a common task in electronics and is accomplished using Analog to Digital Converters. Some microcontrollers and Single-Board computers have them built in, but some do not.

(more…)

Using Shift Registers

Shift Registers are a specific type of semiconductor which use bitwise control to toggle outputs. In doing so, a number of outputs can be controlled with minimal wires or programming.

For the examples this document, we’ll be focusing on the Texas Instruments 6b595, which has been replaced by the 6b596 and 6b598-Q1. They all function the same, but the manufacturing architecture and packages have been updated.

(more…)

5V Single Board Computers on 12/24V Systems

As the Raspberry Pi and Atmel/Cortex/ESP platforms become more powerful computational processors, they require more power to do so. Powering these devices in Automotive 12V or Industrial 24V applications has become its own challenge.

(more…)