Using an I2C / SPI LCD on the Spark Core

@Frido how are you including the LCD library into your project?

This time I used spark.io/build

compiles and flashes ota but shows no output on the display.

@Frido can you post your code and wiring scheme. Iā€™m guessing you meant I2C, not SPI right? Have you added pull-up resistors on both SDA and SCL? Not sure what you meant by does not depend on pull-up resistors, but without them the Spark Core wonā€™t send a high output. Arduino doesnā€™t need them, for low capacitance buses, because they turn on the weak pullups.

Code is copied from @Soulhuntreā€™s recent post, changed to

#define MCP23008_ADDRESS 0x27

wiring scheme is simple

brown = GND
red = VCC
orange = SDA / D0
yellow= SCL / D1

pullup resistors on 3V3

LCD flickers for a moment nowā€¦

Pullups should go to VIN if thatā€™s whatā€™s powering your LCD. Are those 1k? Probably fine if so. If they are 10k, might wanna also try lowering them to at least 4.7k in addition to the supply voltage change. Keep in mind the LiquidCrystal_I2C code is a work in progress port of Adafruitā€™s I2C LCD backpack. I need to order one of everything weā€™re working on so I can help out more effectively.

EDIT: Just ordered an LCD I2C/SPI backpack and a 4-channel I2C safe level shifter from adafruit (just in case). @Soulhuntre what kind of driver chip does your LCD have? Or if you can point me to the datasheet that would be best. Just want to make sure I grab a comparable LCD out of my drawer full of them.

So I have a different i2c backpack from Adafruit that appears to use a slightly different chip. I tried loading the sketch Bdubs posted and it doesnā€™t seem to work. The backlight turns on but the first line is all block characters.

Itā€™s this one: http://www.adafruit.com/products/714

It has a MCP23017 instead of the MCP23008. So how difficult would it be to adapt the library for the MCP23017. It seems to be similar. Adafruit also has an RGBLCDshield library as well thatā€™s need for the backpack I have. Iā€™m guessing it mostly handles the button controls though.

Not too difficult Iā€™d say, but time consuming nontheless. Let me get the MCP23008 working reliably first and then we can turn to the MCP23017 after thatā€™s done. Meanwhile you can try to duplicate my efforts with the MCP23008 just by looking at the original library and the files Iā€™ve created. Or, if you want to send me a http://www.adafruit.com/products/714 Iā€™d definitely be more than happy to do the testing to get it working reliably.

I was thinking of just going through it later and seeing if I can duplicate what you did with the MCP23008

Yours look similar to my cheap eBay LCD, so this code could work:

I think this is the version that is originally from @Iv4n. I stripped of some his custom stuff to make it more clean on my taste. I just build it this from online IDE to make sure addresses are like they should be.

The only resistor is one I soldered in place of that led jumper to make backlight a bit dimmer. Electronics arenā€™t my expertise, so Iā€™m not sure if should add more of them in long run.

2 Likes

I managed to duplicate what BDub did to this Library. Hereā€™s their Hello World sketch example with all the code. I didnā€™t understand fully what I was doing so it may not work well, I just copied the modifications to make it compatible.

Github gist link

PS how do you do those fancy code boxes.

Edit: it does work but then the screen freaks out after about 30 seconds or so.

\o/ ā€œThis is how we do it!!!ā€ \o/

It works!!! Thanks a lot!!!

Nice idea to solder a resistor instead of the jumper!

So this is a solution for LCD with backboard ā€œLCM1602 IIC V1ā€. Could be copied to ā€œLibrariesā€ā€¦

Happy now,

Frido.

Update: Pullup resistors to 3V3 work as well. I like this because the wiring looks cleaner :wink:

Update: On my open WiFi uptime was two times over 17.000 secondsā€¦

1 Like

@gin that sounds like the same problem we were having with my port of the MCP23008. Gotta be something simple in there that I missedā€¦ Iā€™m hoping.

Yeah maybe. Bascially a bunch of Cs and Ss started appearing scrolling across and it kind of went from there.

I did notice that on the RGBLCD shield library there were some 16bit exchanges where the MCP23008 seemed to only have 8bit ones.

Yeah.... the latest Spark Core firmware lets me go between 30 and 200 seconds... but in the end it always freaks out.

It's ok, you're still my hero :: smile ::

Ken

1 Like

Did you ever get any further with this?

FYI, didnā€™t get my LCD I2C/SPI backpack yetā€¦ but when I do Iā€™ll put more time into this. Probably coming today.

No stress @BDub ! I appreciate it.

@BDub - if you want one of the Adafruit ones to play with, hit me in PM Iā€™ll be happy to ship you a setup (LCD / backpack) to help you out.

1 Like

Sorry I havenā€™t had a chance to look into this, Iā€™ve had my hands (and fingers!) full with other projects. Iā€™m sure youā€™re in good hands with @BDub though!

1 Like