Go Down

Topic: SainSmart LCD Module For Arduino 20 X 4, PCB Board -- No Code Works :( (Read 5387 times) previous topic - next topic


Graham, what is the major difference between "??" and <??>? I'd like to thank you for your help, I'm thinking about contacting SainSmart and doing a return/exchange. If I return it, I think I'm going to get this module: http://www.amazon.com/RioRand-trade-Module-Arduino-White/dp/B00GZ6GK7A/ref=sr_1_1?ie=UTF8&qid=1417288411&sr=8-1&keywords=riorand+lcd

Do either one of you know if anyone has had issues with this one? Or could you recommend me another LCD (preferably 20 x 4 and under $15USD)?

Thanks so much for your help,


There's no reason to return the module.  Just stop dealing with ancient libraries.

Don, my I2C ID guesser recommended 0x27 . . .
The i2cLCDguesser sketch that I recommended will give you the pin connections that you need to get the up-to-date version of FMs library to work with your adapter.

Place the entire folder in your sketch folder..............NOT LIBRARIES!!!..........
It would be a better idea to put the library where the current version of the IDE expects to find it.  http://arduino.cc/en/Guide/Libraries



It looks like the LCD module you linked to in reply #15 is a regular 20x4 without an I2C adapter.  It should work properly using the LiquidCrystal library supplied with every Arduino IDE since v0017.

You could just de-solder your current display from its I2C adapter and achieve the same result without the postage.



"Try this, try that, etc.." is nothing but guessing and I would ignore that type of advice.
That is not a good way to get something up and working.
It wastes time and can create frustration.

What I'm seeing is a mixing up of different libraries and sketches.
You must stick with a single library and then use sketches that are written for that library.
i.e. you can't use a sketch written for one LiquidCrystal_IC2 library on a another LiquidCrystal_I2C library.

I'm also seeing the use of libraries other than fm's library.

You cannot install multiple of these libraries at the same time either.
If you install one, you must un-install and completely remove it when using another/drifferent library.
(also you must exit and restart the IDE when installing/removing libraries)
This is because of the way the IDE works and collisions/duplicates of header files within the libraries.

While the different libraries may use the same header file name,
the libraries work differently and have different APIs.

That is why you are seeing strange types of errors.

My recommendation is to use fm's library as that one can be made to work with any
of the PCF8574 based backpacks.
Make sure to remove any/all of the other i2c lcd libraries.
Install fm's library in your sketchbook/libraries directory and name the directory for fm's
library "LiquidCrystal" as this will ensure that it overrides the IDEs built in "LiquidCrystal" library.
Fill in the constructor in your sketch with the pin/bit numbers depending on the wiring of your backpack.
If you are unable to see the PCB traces to determine the wiring of your backpack
to come up with the proper numbers,
you can run the guesser sketch referenced earlier and it will try various combinations to come
up with the wiring for your backpack.

If the guesser sketch doesn't compile, then there is an installation issue of fm's library.

This entire process should take less than 10 minutes.

--- bill


I hope you can convince him.  He certainly wouldn't listen to me.



Don, I'm trying to use the I2C IDguesser you sent, however I get this error:
i2cLCDguesser:99: error: #error i2dLCDguesser requires using fmalpartida LiquidCrystal replacement library
i2cLCDguesser:336: error: 'POSITIVE' was not declared in this scope
i2cLCDguesser:343: error: 'POSITIVE' was not declared in this scope
i2cLCDguesser:344: error: 'NEGATIVE' was not declared in this scope
i2cLCDguesser:345: error: 'NEGATIVE' was not declared in this scope
i2cLCDguesser:346: error: 'NEGATIVE' was not declared in this scope
i2cLCDguesser:347: error: 'POSITIVE' was not declared in this scope
i2cLCDguesser:348: error: 'POSITIVE' was not declared in this scope
i2cLCDguesser.pde: In function 'int guessconfig(uint8_t)':
i2cLCDguesser:372: error: 'POSITIVE' was not declared in this scope
i2cLCDguesser:388: error: no matching function for call to 'LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t&, uint8_t&, uint8_t&, uint8_t&, uint8_t&, uint8_t&, uint8_t&, uint8_t&, uint8_t&, int&)'
C:\Program Files (x86)\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:57: note: candidates are: LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, uint8_t)
C:\Program Files (x86)\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:55: note:                 LiquidCrystal_I2C::LiquidCrystal_I2C(const LiquidCrystal_I2C&)

And I have no idea what it means. I'm using FM's NewLiquidCrystal, and I2C from:


Carefully read the reply by bperrybap.  He's the author of the I2C IDguesser sketch.

You are going to save a lot of time by getting rid of all of your I2C libraries, reinstalling the IDE, and starting from scratch.



And I have no idea what it means. I'm using FM's NewLiquidCrystal, and I2C from:
Those errors mean you are not using fm's library.

Look at the first error that my guesser sketch printed during compilation.
My sketch detects when it is being compiled with the wrong library.

You either have not properly installed fm's library and/or you also have some other i2c lcd library
installed and it is conflicting with fm's library.

--- bill


   I have a SainSmart LCD2004 display module too. I know that getting it to work is a challenge but I don't believe this is the fault of the module. The trouble is in the quality of advice found in forums such as this. Advice can come from people with no personal experience in the subject - in this case the I2C add-on found neatly and correctly attached to the Sainsmart LCD2004 display. Also the I2C address often quoted is not applicable to this I2C module. Using the I2C scanner, I found my display's address is 0x3F (not 0x27).

   Like many others I started from the point of ignorance and blamed Arduino, Sainsmart and the liquidCrystal_I2C library for my failure. Having deleted the library and reinstalled it countless times and even reinstalled the Arduino IDE itself, the sketch I was using suddenly began to work. Not magic however, I think you have to be very careful in selecting the particular part of the malpartida library when using the Arduino library installer. I never got it to install properly when I did it manually.

   My biggest mistake was to expect to see something on the Display no matter what the contrast setting. So when at last it seemed the sketch recognised the library (because the display lit up) but there were still no characters visible, I blamed the display! It's a known syndrome, I've experienced and been guilty of it many times. The user just can't be wrong can he/she?

   A quick fiddle with the contrast control on the I2C module revealed the answer! I had been expecting a gradual contrast increase with visible characters no matter what the setting but not so - the correct setting is very sharp and either side of it you get nothing at all!

   I'm still in the process of getting to understand how to use the library because the reference to liquidCrystal_I2C functions on the Arduino website tells the reader very little besides the names of the functions - it needs improvement! 

   To summarise my thoughts on the help I have received so far, I have to say with all respect that a lot of it is misleading and downright unhelpful. The trouble is that people posting here read opinions and advice that are not correct - perhaps the original author learned better later but did not go back to delete or correct what they wrote. The result is that the beginner at least, ends up being totally bamboozled!

   Might I suggest that when posting replies and advice to questions on Technical Forums the author should consider whether he/she is offering advice based on personal experience or Qualification. Please don't write content which is pure hearsay (or seesay or readsay or even readwrite). Such self-discipline will truly help beginners like myself!


I agree with you about seeing lots of unhelpful "advice".
When it comes to getting a ic2 backpack up and running there is quite a bit of misinformation
and misunderstanding out there.

The biggest thing that people are not understanding is that there is no way to make
a i2c to hd44780 backpack "plug and play" for the all the various backpacks out there.
There are different designs and there is no reliable way to detect those differences in s/w.
Also, there are several different libraries
out there with the same name but they are not the same.
They work differently and have different APIs.

I worked with fm on the library and even contributed several components so I am quite familiar
with it. I also did the guesser sketch to help those who are unable to determine their backpack
wiring from looking at their module.

My strong advice is use fm's library and NOT use any other "LiquidCrystal_I2C" library
out there for PCF8574 based backpacks that you may find.
The problem with using other libraries is that there are several of them and many of them have
issues and/or won't work on all backpacks. Many of them are hard coded for a given backpack
which is great if you happen to have that backpack but will never work if you don't.

While there can be some issues getting fm's library up and working, I still recommend using this
library since it can and will work with all PCF8574 based backpacks.
Most of the issues related to getting fm's library up are user related and are due to
improper installation of the library.

My advice based on my experience and knowledge of having looked at many of the i2c to hd44780
backpack libraries out there is to use fm's library.

Install it and then run my guesser sketch.
If you have issues getting the guesser sketch working, then the library is not properly installed.
At that point. STOP and ask for help.
Don't be tempted to go off and get another library and try that, as it can make things worse.

When the guesser isn't building or working, come back to the forum
and continue asking questions until the guesser sketch builds and uploads.
After that the guesser sketch will tell display the parameters needed to use for the backpack
in use.

When the library is installed correctly, the entire process should only take about 10 minutes
including all the time to download the library, install it, download the guesser, build it and run it.

If there are issues and it is taking more than 20 minutes to get the backpack up and running
with fm's library, come back and ask questions as something has gone wrong.
There really isn't anything that complicated, but there are a few very specific things that must
be done to ensure the library will work.

--- bill

Go Up