I recently received cheap LCD shield from e-Bay with blue LCD and tiny "joystick"instead of menu buttons. It is marked on the back "Deek-Robot Shield Model 1602LCD I2C SHIELD"
Shield is mounted and powered off Arduino Mega R3. I am able to get I2C address with I2C scanner sketch - 0x20 (means that shield is technically alive) , but I am unable to put anything on the LCD and/or read from "joystick" . backlight is also not available.
Wondering, if anybody here had better luck with this shield? is there any sketch example I can use as starting point.
E-Bay link for reference http://www.ebay.com/itm/NEW-design-I2C-1602-LCD-Shield-for-arduino-Blue-LCD-2-PINS-/351712311712
I just got one of these too. The MCP230167 is a 16 bit I/O expander. The I/O pins can be input or output as required. The I2C address of 0x20 is correct if we are only using one. We can use up to 8 if all I2C addresses are used but 0x20 is the only one we need to worry about.
Some Arduino code for this IC can be found here: Tutorial: Maximising your Arduino’s I/O ports with MCP23017 | tronixstuff.com
There are also helpful website on using the MCP230167 with Raspberry Pi's.
What we need to know is which I/O lines are connected to which devices. I expect the joystick will be connected to inputs and the LCD connected to outputs. Once we know these connections the rest will be easy.
The LCD is a stock 1602 device which uses the HD44780. Alll we need to know is if it is being driven in 4 or 8 bit mode and the port connections. After that the LCD is easy to drive. The joystick status (really five switches) will be read by doing a port read. Again we just need to know which switch goes to which bit in each port.
Later today I will bus-out the connections and report back.
adafruit has a shield that uses a design like that.
If you are lucky, it uses the same pin mappings.
Ok, I've sorted it out now. The LCD only uses D4-D7 so we need to use 4-bit mode for the HD44780. There are spare ports so I don't know why they didn't use the full 8 bit (each port can be input or output).
Check the IC data sheet for meaning of GPBx and GPAx.
The joystick switches all pull down to Vss (0V) so you should enable the weak pull-ups on the input ports using the GPPUA register. This device will optionally invert the sense of the inputs so if the input is low then the port read will be high.
Anyway, these are the connections.
RS - GPB7
R/W - GPB6
E - GPB5
D4 - GPB4
D5 - GPB3
D6 - GPB2
D7 - GPB1
UP - GPA3
DOWN - GPA2
LEFT - GPA4
RIGHT - GPA1
MIDDLE - GPA0
Hopefully this is all you need to program the device now.
The ebay listing for my unit mentioned three backlight pins. This may be why they didn't use 8-bit mode on the LCD. Until I have done some more research I cannot say what the backlight options are - if any.
We could assume that the unused bits (GPB0, GPA5, GPA6, GPA7) are outputs for the backlight. It should be simple to try a few permutations of outputs and see what happens!
At least we now have enough data to drive the display and read the joystick. I will hack some code later this week and see what more I can add to this post.
Again, go look at the adafruit RGB lcd keypad shield.
It uses that exact same pin mapping on the MCP23017.
On their shield, there are 3 backlight LEDs. Red, Green & blue.
red is GPA6
green is GPA7
blue is GPB0
You should be able to use their library as well.
did you test adafruit library for the RGB lcd i think it's the same?