IC2 Wire2 20x4 LCD driver

ekartgo

Member
What libraries work with a T4.1 with a I2C Wire2 output for the common 20x4 LCD panels?

So far I'm batting zero with the ones I've tried. Some are supposed to let you override the default, but either that isn't documented or I picked the wrong ones. Many seem to conflict with the teensy4_i2c-master code. ;)
 
Obviously it will depend on which display you are trying to use...

But for example SSD1306 - I would try Adafruit_SSD1306

They have a constructor:
Code:
  Adafruit_SSD1306(uint8_t w, uint8_t h, TwoWire *twi = &Wire,
                   int8_t rst_pin = -1, uint32_t clkDuring = 400000UL,
                   uint32_t clkAfter = 100000UL);
Which allows you to pass in which wire object to use.

Likewise in their Adafruit_SSD1327 library.

Now as for teensy4_i2c compatibility. Sorry I don't know. My gut tells me it is along the line of T3.x with i2c_t3 support.
In that you can either include one or the other and not have both i2c_t3 and wire library included in the same sketch.
But I could be wrong.

But the library mentions things like:
Code:
This library can be used as a drop in replacement for the Wire library
in [Teensyduino](https://www.pjrc.com/teensy/td_download.html). It has
native APIs that are more flexible than Wire and simpler to use in
some cases. The primary reason for creating this library was to add
support for Slave mode.

Which may imply like i2c_t3, if you wish to use another library that includes Wire.h, you will need to edit the library (maybe make copy)
and edit it to include the header files for the this...

Alternative:
If you install the latest Teensyduino beta code: https://forum.pjrc.com/threads/70455-Teensyduino-1-57-Beta-3

Wire Slave support was added in the 1.57B1: https://forum.pjrc.com/threads/70196-Teensyduino-1-57-Beta-1
 
Thanks, I'll take a look at that.

This one was sold by RPIGear. I'm trying to find out what chipset it uses (on the underside of the backpack) and is a 20 pin chip. A 2004A display with possibly a PIC16LF1829-I/SS chip.
 
Last edited:
Good luck. I know at least with some RPI like TFT displays I have played with. They roll their own and maybe don't use any standard chipset like the SSD...
 
Returned... now to find a 20x4 LCD that actually works good.

I re-arranged the PCB so I can use Wire0 to make code use simpler, and then ran the clock and data lines through a voltage translator to boost them to 5v.
 
Returned... now to find a 20x4 LCD that actually works good.

I re-arranged the PCB so I can use Wire0 to make code use simpler, and then ran the clock and data lines through a voltage translator to boost them to 5v.

To be sure, for I2C you need a bi-directional voltage translator to handle I2C. I.e. you have to boost the signals from the Teensy from 3.3v to 5v, and you need to lower the signal from the I2C devices to the Teensy from 5.0 volts to 3.3 volts.

And in some cases, you might also need to incorporate pull-up resistors (typically 2.2k) between each of the SCL/SDA pins and 3.3v. I recall that one of the Adafruit level shifters said it wasn't really recommended for I2C traffic, but using pull-up resistors could help.

Many newer devices also incorporate pull-up resistors in their logic. For the older devices, you often had to have one set of pull-up resistors on the I2C to help the device with I2C. So, I often put pull-up resistors as a matter of habit on my Teensy I2C lines. Adding the pull-up resistors will also allow you to scan the I2C bus to see if there are devices (for example, you might want to add a display during development, but not use it in the final gadget, and you wanted the code to detect if the display was present). If there is nothing on the I2C bus, doing the I2C scan can fail without the resistors.

I recall when I was still using Arduino UNOs and switching to Teensy, that many of the 16x2 and 20x4 displays at the time required 5 volts. I may still have one or two in my parts drawer of holding. But I believe that the newer displays can happily run on 3.3v and don't need to boost/lower the voltage. I haven't bother to do level shifting for a couple of years now.

In the past, when I still had 5v only I2C devices, the level shifter of choice that I used was:

I find the 128x32, 128x64, and 128x128 OLED displays (both I2C and SPI) to be easier to read when they are just displaying text than the old 16x2 and 20x4 text only LCD displays. In general, the OLED displays tend to be cheaper. Finally, if you are trying to read the displays outside, the LCD character displays might not be viewable if you wear polarized sunglasses. That being said, the OLED displays do require you to buffer the whole screen in memory. Many times with Teensys that is not a problem (when I used ATtinys and Arduino UNOs, it was more of an issue).
 
Teensy 4.1 + I2C LCD at 5V. I am using an LCD with an I2C converter with a 5V supply on a Teensy 4.1 and it is working great. But now I am wondering if the 5V is endangering my T 4.1. Here is my set up.
T 4.1
HiLetgo 2004 20X4 LCD Display LCD Screen Serial with IIC I2C Adapter Yellow Green Color LCD for Arduino Raspberry Pi
https://www.amazon.com/gp/product/B01DKETWO2/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
I2C converter uses
PCE8574T
ABX919.
1 12
knG18133

Libraries:
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h> // include i/o class header
hd44780_I2Cexp lcd; // declare lcd object: auto locate & config display for hd44780 chip
 
Back
Top