Thursday, May 21, 2015

Addicore 20 x 4 Serial LCD using I2C and BS170 MOSFETs

This is a very nice 20 column, 4 line display from Addicore - big and easy to read.  I've ordered several things from them recently and have been pleased.  They have free mailing in the U.S. for orders over $25 and are quick and responsive.  Recommended....

Here is what it looks like when up and running on the MSP430F5529 LaunchPad.



Note that this is a 5V device!  I've translated signals using BS170 MOSFETs and the following circuit.



I got it up and running easily using a library from DFRobot.

Here is the test code running in the display above.

//Using library from DFRobot.com
//Compatible with the Arduino IDE 1.0
//Library version:1.1
/*
 * 20x4 Serial LCD from Addicore
 * https://www.addicore.com/2004-20x4-Character-LCD-with-I2C-backpack-p/157.htm
 * Tested on MSP430F5529LP
 * NOTE: This is a 5V device!
 * Need to translate 3V3 <---> 5V (used two BS170 MOSFETs)
 * F Milburn   21 May 2015
*/
#include <Wire.h>
#include "LiquidCrystal_I2C.h"

LiquidCrystal_I2C lcd(0x27,20,4);  // set for a 20 character 4 line display

void setup()
{
  lcd.init();                      // initialize the lcd
  // LINE 0
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("First line");
}

void loop()
{
  // LINE 1 - Number of columns
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  lcd.print("Second line");
 
  // LINE 2 - ENERGIA
  lcd.setCursor(0, 2);
  lcd.print("Third line");
 
  // LINE 3 - Count seconds
  lcd.setCursor(0, 3);
  lcd.print("Time since reset:");
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

No comments:

Post a Comment