Connect 4x20 I2C LCD to Spark Core fails

Hi everyone,

I am trying to connect a 4x20 LCD display to my Spark Core and cannot get it to work, no matter what I try.

If I connect this LCD to Arduino it works perfectly fine. I did some Arduino projects before but I am new to the whole Particle thing (maybe that’s the issue) - I just found the Spark in my pile of electronics and thought I give it a go. Eventually I want to connect the Spark to some cloud backend like Azure to demo IoT capabilities. But I need to get this LCD running first.


This is the setup:

This is the LCD screen:

And connections are (LCD: Spark):
SDA: D0 (pullup resistor 4.7k to VIN)
SCL: D1 (pullup resistor 4.7k to VIN)


I am using the LiquidCrystal_I2C library and simplified my code down to this:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
void setup()
   lcd.print("Hello, world!");

What have I tried

  • “Normal” code works fine, like blinking an LED or something, so the spark works
  • Also the LCD works fine when I connect it to an Arduino
  • Tried without the pullup resistors or just pullup to 3v3
  • Flashed with newest firmware (and cc3000)
  • Different I2C addesses do not work either (like 0x20 or 0x3F)
  • Standard I2C scanner cannot find anything (?) and when I try the I2C scanner with particle publish code it fails and device keeps restarting


  • Not sure if this is my limited understanding of Particle but compiling seems to be a bit buggy? I have sometimes the compile fail for no reason (both Desktop IDE and CLI) with a simple “Failed. Compile exit” message. Is there any log I can check what actually failed?
  • When flashing the device back to factory settings I got this error - does that mean my spark is damaged?

Thanks in advance for all your help!

@marcg, everything seems to be fine with power and pull-ups and connections. On the Photon, you don’t need #include <Wire>; so you can comment that out. What version of Particle CLI are you using?

Spark Core…

I2C was a little bajiggity on that device.

more here

1 Like

I just installed it so I just assume the newest one? It’s 1.20.1

Also, it’s not a Photon, it’s a Spark Core - can I still remove the Wire?

@marcg, I just test a 16x2 LCD with the same piggyback board and got it working with 10K pull-ups. Which library are you using? I am using the LiquidCrystal_I2C_Spark library from the web IDE. The example is working just fine.

1 Like

I am using the LiquidCrystal_I2C library with this header:

// ---------------------------------------------------------------------------
// Created by Francisco Malpartida on 20/08/11.
// Copyright 2011 - Under creative commons license 3.0:
// Attribution-ShareAlike CC BY-SA
// This software is furnished “as is”, without technical support, and with no
// warranty, express or implied, as to its usefulness for any purpose.
// Thread Safe: No
// Extendable: Yes
// @file LiquidCrystal_I2C.h
// This file implements a basic liquid crystal library that comes as standard
// in the Arduino SDK but using an I2C IO extension board.
// @brief
// This is a basic implementation of the LiquidCrystal library of the
// Arduino SDK. The original library has been reworked in such a way that
// this class implements the all methods to command an LCD based
// on the Hitachi HD44780 and compatible chipsets using I2C extension
// backpacks such as the I2CLCDextraIO with the PCF8574* I2C IO Expander ASIC.
// The functionality provided by this class and its base class is identical
// to the original functionality of the Arduino LiquidCrystal library.
// @author F. Malpartida -
// ---------------------------------------------------------------------------

I actually thought the LiquidCrystal_I2C_Spark is only for 16x2 displays and I cannot use it with my 20x4? Maybe I am wrong - will give that library a shot in a second, thanks!

@marcg, the IDE library lets you define the geometry also. Just change this line in the example:

  lcd = new LiquidCrystal_I2C(0x27, 16, 2);   // Change 16,2 to 20,4

Well… don’t I feel silly now. I came across that library before but didn’t try because it didn’t have a 20x4 example… doh! :confounded:

Thank you very much - works like a charm with that library!

Still had the compiler issue on Desktop and CLI, got it working using Web IDE. Any ideas about that or should I open a new topic?


You should open a new thread for that and place a link to it here.
Also please include the whole log including the actual command used and some more background about your code and project structure.