I2C LCD SHIELD

Have you ever hooked up one of these Sparkfun 2 line 16 character per line LCDs on a breadboard?  It takes more microcontroller I/O than you want to let go of, and is not quick to wire up either.  These LCD's use an HD44780 parallel I/O data interface chipset, and are useful for software debugging and displaying program information.  It is true that the same job can be done with a PC connect to the Arduino USB serial port, but an embedded LCD is far more portable.

Task Scheduler
Typical LCD breadboard hook-up​​​​ with contrast control, piezo and 4x LEDs

There are plenty of I2C to LCD boards out there.  However, an I2C LCD mounted with other input/output components as a shield makes it more versatile and easier to incorporate into projects.  Hence this simple LCD I2C Shield was born.  The design uses fairly common Arduino hook-ups.  The board incorporates an MCP23008 I2C 8-bit I/O port expander wired to Arduino pins A4(SDA)/A5(SCL), and is compatible with the Adafruit_LiquidCrystal I2C Library.

The only thing done different from most I2C/LCD boards is that the LCD contrast is controlled by a simple R/C filtered PWM signal, rather than by a dedicated  potentiometer.  A PWM value of 50 produces a pulse width of approximately 200us ON and 800us OFF.  An R/C time constant of 4.7ms (10uf * 470ohm) produces approximately 0.2 volts of DC ripple going into the LCD contrast pin.  Increasing the PWM value decreases the contrast and visa-versa.  Lower R/C time constants were tried, but more than 0.5 volts of ripple tended to produce some minor display artifacts. 

There are also 4 NeoPixel LEDs controlled with the Adafruit NeoPixel Libary.  The piezo speaker is activated using the built-in Arduino Tone()/noTone() API functions.  Two buttons are also provided on D2 & D3.  Following is a summary of the Arduino pin usage: D2 = BUTTON 1; D3 = BUTTON 2; D4 = PIEZO AUDIO; D5 = LCD PWM; D6 = NeoPixel 4x LED strand; A0 = 10K Potentiometer; A4 (SDA) = LCD; A5 (SCL) = LCD

GeoCache
GeoCache Configuration with External Antenna

Setting D2 & D3 pin modes to INPUT_PULLUP makes it real easy to check the button states periodically in software to determine if they are pressed or not.  It's kinda like taking your young children on a long ride to grandmas house, and the children keep askinig... "Are we there yet?  Are we there yet?  Are we there yet? etc, etc, etc"  However, if you have never used interrupts, this is your chance to try it out since both of these pins can be set up to trigger interrupts on either the press or release of the button, or both.  Just remember to address switch/button debouncing in your code. 

All the unused Arduino pins were specifically chosen to allow stacking the LCD I2C Shield with an Adafruit GPS Logger Shield on an Arduino UNO for a GeoCache project.  Note that clear lens NeoPixel LEDs were inserted in this board, since that is what I had on hand at the moment.  But diffused NeoPixel LED lenses are far better for viewing the RGB color mixing.  As you can see in the stacked GeoCache setup, the GPS square ceramic antenna is exposed sufficiently to acquire satellite signals.  Typically you want the GPS antenna to have clear view of the sky for optimum satellite acquisition.  One nice feature of the Adafruit GPS Logger Shield is that it also permits attaching an external active antenna using a tiny "u.FL" connector.  The current LCD screen indicates the target is at 320 degrees from the course over ground I am walking, or the target is NW of my direction.  If I am walking straight towards the target, the LCD would display 0 degrees, and the target is only 17 feet away!  This whole package can become portable by plugging in a 9V battery into the DC power plug of the Arduino.  That's what my students do!

I2C LCD SHIELD SCHEMATIC
LCD I2C Shield Schematic
I2C LCD SHIELD BOARD
LCD I2C Shield Board

 

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.