Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: 440 lcd teensy 3.6

  1. #1
    Junior Member
    Join Date
    Sep 2018
    Posts
    2

    440 lcd teensy 3.6

    Hello all, I'm new to programming I started with the arduino uno and have decided to step up to the teensy now so this is my first build. I'm having trouble finding any information on using a 40x4 lcd with the 3.6. I've spent quite a bit of time looking through the threads but can't seem to find anything. I had the lcd working with my uno but I'm having trouble with the teensy. If anyone knows a thread that could help me get this working id greatly appreciate it. Thank you for your time.
    -Chris

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,772

    Cool

    Well it might be helpful to mention which 40x4 LCD, and to display the program you are using. We aren't mind readers. We have no idea what display you are using, or what your program looks like.

    Assuming the 40x4 LCD is an i2c LCD, there are several common problems when moving code to the Teensy 3.x/LC:
    • Arduino AVR processors did not need pull-up resistors on the i2c bus, Teensy does need them. Some devices include pull-up resistors, some don't. If your device doesn't have the pull-up resistors, get two 2.2K resistors. Connect one resistor between pin 17/A4 and the 3.3v current. Connect the other resistor between pin 18/A5 and the 3.3v current. Multiple resistors are fine for small i2c buses, but if you have too many, it can slow down the i2c bus (i.e. if you only have one device, it is simple to connect the resistors even if the device already has pull-up resistors). I find myself tending to always plan to solder in the resistors even if I'm not immediately going to connect an i2c device.
    • Arduino runs on 5v power, while Teensy 3.x/LC runs on 3.3v power. You might need to connect the screen to 3.3v power and not 5v (VIN). This is so the device can determine if a signal is high or low (if the device is running on 5v, it might or might not notice a 3.3v signal).
    • Conversely, some older displays need 5 volts to properly display the screen. If your display needs 5 volts, you probably have to use a voltage converter for pins 17/18 and hook up the display to 5v. There are various voltage level converters available that work with i2c devices. If this is the problem, we can point out ones that we've used. Note, the Teensy 3.6 can be damaged if it receives 5v on a data pin (like the i2c pins), so you do want to be careful.
    • The Teensy 3.x/LC runs much faster than an Arduino, and some devices are slow. Often times, you need a delay in the init function to let the device wake up after being powered on. The Arduino is slow enough (and waits to see if the IDE is talking to the device), that you often times don't need to do an explicit delay, but adding a 1-2 second delay can help the Teensy. I haven't heard of any devices that can't run at the default i2c speeds, but you might need to add tiny delays to let the device process the data.
    • Some users seem to like programming the i2c bus by hand. Don't do that, use the standard Wire library to interact with the i2c bus.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Going to guess this is one of the normal character displays that works with the LiquidCrystal library?

    LiquidCrystal has 4 different constructors. The 6 pin one is safe to use with Teensy 3.6, because it never tries to read the display. You can just connect the wires directly if you use that way.

    If the interface or library is something else, to give you useful advice we'll need to know details about the display and which library works on Uno.

  4. #4
    Junior Member
    Join Date
    Sep 2018
    Posts
    2
    Thank you for your responses. Sorry for the lack of information in the original post. The LCD is a 040N004A https://www.vishay.com/displays/list/product-37317/ and yes the library I used with the arduino was the <LiquidCrystal> library.
    This is the code I used with the arduino but the R/W pin is grounded now instead of going to pin 13 because I'm using a 5v power supply for the lcd.
    Code:
    #include <LiquidCrystal.h>
    
    LiquidCrystal lcd(12, 13, 11, 10,  5,   4,   3,   2); 
                         //RS, RW, E2, E1, D4, D5, D6, D7
    
    void setup() {
      lcd.begin(40,4);
      lcd.setCursor(0,0);
      lcd.print("VOLTS.:1 = 0");
      lcd.setCursor(0,1);
      lcd.print("VOLTS.:2 = 0");
      lcd.setCursor(0,2);
      lcd.print("VOLTS.:3 = 0");
      lcd.setCursor(0,3);
      lcd.print("VOLTS.:4 = 0");
      lcd.setCursor(12,0);
    
    /*****************************************************************************
      
    ******************************************************************************/  
    
      lcd.print("|");
      lcd.setCursor(12,1);
      lcd.print("|");
      lcd.setCursor(12,2);
      lcd.print("|");
      lcd.setCursor(12,3);
      lcd.print("|");
      lcd.setCursor(14,0);
      lcd.print("AMPS.:5 = 0");
      lcd.setCursor(14,1);
      lcd.print("AMPS.:6 = 0");
      lcd.setCursor(14,2);
      lcd.print("AMPS.:7 = 0");
      lcd.setCursor(14,3);
      lcd.print("AMPS.:8 = 0");
      lcd.setCursor(26,0);
    
    /*****************************************************************************
      
    ******************************************************************************/    
      
      lcd.print("|");
      lcd.setCursor(26,1);
      lcd.print("|");
      lcd.setCursor(26,2);
      lcd.print("|");
      lcd.setCursor(26,3);
      lcd.print("|");
      lcd.setCursor(28,0);
      lcd.print("Eing.:9 = 0");
      lcd.setCursor(28,1);
      lcd.print("Eing.:10= 0");
      lcd.setCursor(28,2);
      lcd.print("Eing.:11= 0");
      lcd.setCursor(28,3);
      lcd.print("Eing.:12= 0");
    }
    
    void loop() {
    
      
    }

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    Looked at the datasheet just now. It doesn't give specs for Vih (minimum voltage for logic high) and doesn't say whether the inputs are CMOS or TTL levels. So whether it can reliably received 3.3V signals when running from 5V is a good question.

    But if the signals are compatible, it should "just work" if you use the LiquidCrystal library and keep RW low. LiquidCrystal is the same on Teensy as regular Arduino.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •