Shop OBEX P1 Docs P2 Docs Learn Events
I2C LCD used in place of a Parallax 27977 LCD — Parallax Forums

I2C LCD used in place of a Parallax 27977 LCD

I have several I2C type LCDs laying around, however the project that I am woking on uses a Arduino script for a Parallax 27977 LCD. Is there a way to modify the script to accomodate the I2C rather than the 27977? I now you have to add a differecnt LCD library and change the pin outs etc but would appreciate any guides on how to accomplish this. Thanks

Comments

  • I have the 27977 LCD and an I2c model now.

    I have a C library for each of them on the P2. For Arduino you will have to replace the serial object with the Wire object to do I2C.

    Mike
  • Thanks. I will give it a try.
  • kayej,

    Your Parallax Serial LCD uses a microcontroller so the commands are custom to it but it should be using the standard serial library.

    Most likely your I2C LCDs just use an "I/O Expander".
    Do you know the make and model of your LCDs?

    It's been a while since I last used an Arduino but I have several, however I don't remember what type of LCDs I have for them.
  • @Genetix ,

    It sounds like he has a project that uses the Parallax LCD model and he only has the I2C ones on hand. So he just needs to replace the Serial object used in that project with the Wire (I2C) object he is use to using on his other projects.

    The command code set though is going to be different and may need to translate some of the code to make it all work.

    Mike
  • Appreciate all the suggestions. Command codes are going to be a tough one. The saga continues. Thanks.
  • kayej,

    Can you post the script and which LCD you intend to use?

    Unfortunately all of my Arduino LCDs are regular so I can't test any code changes.
  • Unfortunately I can't upload a .ino file on this forum. Script it fairly long and I don't tha think that would be proper on this forum. Correct me if I am wrong please. Thank you for posting.
  • You can put the .ino file in a zip file, and attach it that way. Or you can rename the file with a different extension, such as .txt.
  • Genetix. Here is the file ziped. The sketch uses a Parallax 27977 LCD and I am tryng to compile it using a I2C 16X2 LCD. Any suggestions would be appreciated. It is complied to run on an Arduino micro or leonardo.
  • Wait, I'm a bit confused...are you trying to update your Arduino code to replace the Parallax LCD with one of your generic i2C LCDs?

    If so, there are several libraries available. This is a good one, it is frequently updated and will auto-detect the i2C address:
    https://github.com/duinoWitchery/hd44780
  • kayej,

    I see that this program comes from the current issue of QST, so I assume it uses a switch and a Piezo or speaker for sound.

    Most of the Parallax LCD commands are defined in the top of the program but there are 2 near the end for the last character of each line.
    The Leonardo and Micro use the same chip so you can use either, and they are cheaper than the Uno because it needs a USB chip.

    I see that library that Jeff Haas mentioned has code for a number of I2C chips that LCDs use,

    The program has the Key attached to Pin D2 which is also the SDA (I2C Data) line used by the WIRE library for I2C.

    You still haven't said what I2C LCDs you have.
  • You are correct. This is the project from QST. I am trying to replace the Parallax 27977 with a generic I2C 1602 LCD. Just wondering what lines of code in the script have to be modified to accomplish this, if it is possible at all. Appriciate all the helpful info. It uses a morse key as the switch and a 8ohm speaker for sound.
  • This is possible, you're just replacing one LCD with another. You'll need to understand how to include the new library, then go through the code, understand what each command currently does, and figure out what the equivalent is in the new library you want to use. The library I linked to is well documented.

    The key with something like this is to take your time; the way the original author did it may not map 100% onto the replacement library. You'll also want to become familiar with the quirks of LCD displays in general, so I suggest you start by going through the examples from the new library and understand how text is written to the screen, how to position the cursor, how to replace an existing line of text with a new one, etc. There's a few little gotchas with these displays that you have to manage.
Sign In or Register to comment.