I2C LCD using MCP23008

In this page on the playground:

http://www.arduino.cc/playground/Code/I2CPortExpanderAndLCDs

There is a schematic for using the MCP23008 as an I2C controller for an LCD display. There is this schematic:

I'm relatively new to interfacing with LCDs. Can someone answer some questions?

1) What's the purpose of Q1? It's connected to LED GND. Is that the backlight on the display?

2) A variable resistor is shown on the contrast pin (R4). No value is given. What would be appropriate?

3) A bypass cap, C1, is shown. I'm guessing a standard-issue .1uF ceramic would be appropriate?

OK, I’ll take a stab at this -

#1, Q1 could be for control - to switch LCD backlight OFF/On at command - perhaps to flash display in alarm condition?

#2. value isn’t critical - perhaps 1K? 10K max. try and see - won’t hurt anything.

#3. Yep, .1uF would be just fine as a bypass cap.

Ken H>

Q1 is normally controlled by a PWM signal to control backlight intensity. This of course could also be used to flash the LCD but thats not what its normally used for. Setting the PWM value between 0 and 255 gives you a 0 to 100% brightness. The resistor is used to control the current. On the LCDs that I am using, 150 ohms is a good choice.

Q1 would normally be a darlington transistor such as a TIP120 but any transistor that can handle the current required by the backlight would work fine.

In this case since you are having to "send" data in order to change it, it is probably just used for backlight ON/OFF

Mark

So, if I only care about on/off (i.e. not PWM control of brightness) is there any harm in connecting the LED_GND to GND, and LED_VCC to a pin on the MCP23008 directly?

is there any harm in connecting the LED_GND to GND, and LED_VCC to a pin on the MCP23008 directly?

Don’t forget the 15R series resistor.
How much current is this going to take, I would think it would be too much for just a raw arduino pin.

Q1 is an N-Ch FET. It's GATE is directly interfaced to the MCP which is fine (almost no gate current), but the same couldn't be said if you were to use a normal transistor, i.e. you'd need a series BASE resistor not to mention looking at the MCP output to see whether it can source or sink or both. With the FET it makes little difference........hence using a FET!

I don't know anything about that particular MPC, but I doubt very much it would have the source/sink current capability to drive the backlighting directly. You need to buffer these sorts of things.

PS. I use a great wee multipurpose FET to interface (flash) the backlighting on my LCD's.........ZVN3306A usually does the job. In fact I modified one the other day adding such facility.

Ian.

@ill_switch - or anyone else that has made this circuit work.... does it work? Did you use the old version of LCD library or the new version of LCD library?

That sure would be a cheap way of getting an IC2 LCD display - I had to pay $20 or so for the one I purchased for a project a while back. Not my code, but was able to use in a project.

I'd sure like to know more about this - and plan to learn some about this IC2.

Ken H>

I lost track of this thread but just actually tried the circuit tonight, and I'm having trouble already. The example sketch in the link I posted above (to the Playground) doesn't compile. There's a function called WriteLCD() in the setup loop that's not declared anywhere.

Has anyone else used this code? Or used an MCP23008 to control an LCD? I'm going to try to dig through this but figured I'd post up to see if anyone's had it working.

Hi all. I'm also new to arduino, and yesterday I have managed to establish the I2C connection between the MCP23008 and the LCD display. :) The code I used is not from the playground, I will post it soon. The shematics works.