[SOLVED] MJKDZ brand I2C Controller working with 1602 LCD

Thanks fm! :) I've solved! ...maybe error full row square can be for reverse pinout :grin: (chinese LCD soldered by reverse PCB) :.

greets

I also bought a mjkdz I2C module.

I don’t know why, but the pins are not on the back side like most other I2C LCD modules I’ve seen.

On this one the top right pin is the GND, it goes to the VSS pin on the LCD module, right?

naut:
On this one the top right pin is the GND, it goes to the VSS pin on the LCD module, right?

Incorrect.

On that mjkdz module in the photo,
pin 1 (vss) of the hd44780 interface is the upper left and pin 16 (kathode) is on the upper right.
If you look closely you can see the trace from the pot wiper running over to pin 3 (Vo, contrast in)
over twards the upper left in your photo and you can see the trace from the 2TY transistor going
over to pin 15 (Anode) in the upper right.
This orientation means that when you solder the board to most hd44780 modules the side facing up
in your photo will be down. i.e. the pot will be up against the lcd module.
(See attached photo)

While that orientation is nice to have access to the address jumpers (A B C )
(which are on the back side of the board in the photo)
since they will be facing out, once soldered you will not be able to adjust the
contrast pot.

I have a couple of these.
My recommendation if soldering these directly to the lcd,
is to either change out the pot for one with a thumb wheel,
or a side screw access or unsolder the pot and move it to the other
side of the board. That way when the board is soldered directly to the lcd,
you will still have the ability to adjust the pot.
Depending on your lcd, you may
also want/need to re-solder the i2c header to the other side of the pcb as well since in
its current location it can end up touching the lcd module making it difficult
to connect to the i2c connector/wires.

Alternatively, you could desolder the 16 pin header and flip it around. Then
the pcf8574, pot, and i2c header will be on top. The down side to that is that
you will not be able to get to the address solder jumpers to change the i2c address.

— bill

mjkdz.png

thanks!

ye, the Cathode and VSS are both ground, that's what confused me.

I found some pin-out pictures:

source: http://www.instructables.com/id/How-to-drive-a-character-LCD-displays-using-DIP-sw/?ALLSTEPS

My recommendation if soldering these directly to the lcd, is to either change out the pot for one with a thumb wheel, or a side screw access or unsolder the pot and move it to the other side of the board.

I soldered some female pins to the LCD module, this way I can remove the I2C module anytime I need to.

another question came up:

do I need to insert a resistor between 5V and the back light anode (pin 15)?

The I2C and the LCD modules have some smd resistors on them but since I don't have the schematics I can't tell if any of them is there to limit the current to the back light leds.


:solved, there is a 100ohm resistors connected to the anode pin.

naut:
another question came up:

do I need to insert a resistor between 5V and the back light anode (pin 15)?

The I2C and the LCD modules have some smd resistors on them but since I don’t have the schematics I can’t tell if any of them is there to limit the current to the back light leds.


:solved, there is a 100ohm resistors connected to the anode pin.

Not clear what you mean by this.
Did you mean your particular LCD has a built in 100 ohm resistor on its module?
The MJKDZ board has no current limiting resistor for the backlight.

The mjkdz board has a 2TY PNP transistor.
If you look at the board, you will see that pin 12 of the pcf8574 (P7) is connected
to a part labeled “102” that is a 1k resistor.
That resistor then drops down vertically and connects over to the base of the PNP transistor.
The Emitter is directly connected to hd44780 pin 15 which is the backlight Anode.

There is no current limiting for the backlight being done on the mjkdz board.

Attached is additional information about the mjkdz board and how to use it with fm’s library.

— bill

LCD-I2C-MJKDZ.zip (299 KB)

Did you mean your particular LCD has a built in 100 ohm resistor on its module?

yep.

I also measured the voltage output of the I2C module (pins 15 and 16), equals 4.7V.

bperrybap: pulsarus, If you are out of ideas, and are unable to determine the pin wiring of your i2c chip to the hd44780 interface, attached is a sketch I wrote that will try to figure it all out by guessing. It will locate the i2c chip's address then try several of the most common configurations. I will say that while I've not seen any damage occur using incorrect configurations, it is possible that using an incorrect configuration could damage the hardware.

It uses the serial port along with the serial monitor in the IDE to control the "guessing". See the comments in the sketch for how set things up and how to use it.

Give it a try and let me know if it detects the proper constructor for you.


fm, I'm working on some updates for the library that are not quite finished yet. This sketch is one of the updates.

--- bill

Many thanks Bill, this has proven to be extremely useful!

Wow...thank you very much GordonShumway. All works fine!

I have been banging my head against the same problems as others here initially encountered (ie flashing backlight and gibberish on screen), unfortunately it is impossible for me to move on to the next step because of the following error.

HelloWorld_i2c:12: error: ‘NEGATIVE’ was not declared in this scope

and HelloWorld_i2c:12: error: ‘POSITIVE’ was not declared in this scope

I know the address is correct, but I’m not sure if the other pins are, though the default doesn’t work either. I don’t know what the problem is. the Here’s my code.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, NEGATIVE); // Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity
 
void setup()
{
    lcd.begin(16,2);
    lcd.backlight();
    lcd.setCursor(0, 0);
    lcd.print("Hello world!");
    lcd.setCursor(0, 1);
    lcd.print("Row number: ");
    lcd.setCursor(12, 1);
    lcd.print("2");
}
void loop()
{
 
}

P.S. Here’s my LCD and i2c modules:

http://www.ebay.com.au/itm/300922342381?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649

Do you have any traces of other i2c LCD libraries or I2C lcd libraries in your environment other than this one?

No. not that I'm aware of. I'm on a Mac and I tracked down LiquidCrystal and LiquidCrystalFast libraries and zipped them up and deleted the directories. I then restarted the Arduino IDE. It's very frustrating not knowing if there is something else interfering.

Is there any way to actually see what files are being included when you try to build? If there is something that is interfering, I haven't found it.

For what it's worth here is a list of all the libraries I have available. If any of them could be the problem then let me know and I will zip them up.

hackintosh:~ michal$ cd /Users/michal/Applications/Arduino.app/Contents/Resources/Java/libraries 
hackintosh:libraries michal$ ls -1
AccelStepper
AltSoftSerial
Bounce
CapacitiveSensor
DS1307RTC
DmxSimple
DogLcd
EEPROM
Encoder
Entropy
Esplora
Ethernet
FastSPI_LED
Firmata
FlexiTimer2
FreqCount
FreqMeasure
FrequencyTimer2
GSM
IRremote
Keypad
LedControl
LedDisplay
LiquidCrystal.zip
LiquidCrystalFast.zip
LowPower
MIDI
Metro
MsTimer2
NewSoftSerial
OSC
OctoWS2811
OneWire
PS2Keyboard
PWMServo
Ping
Robot_Control
Robot_Motor
SD
SPI
ST7565
Servo
ShiftPWM
SoftPWM
SoftwareSerial
Stepper
TFT
Time
TimeAlarms
TimerOne
TimerThree
TinyGPS
Tlc5940
VirtualWire
WiFi
Wire
XBee
ks0108
x10
hackintosh:libraries michal$ cd ~/Documents/Arduino/libraries/
hackintosh:libraries michal$ ls -1
EmonLib
EmonLibPro
NewLiquidCrystal
NewPing
RF24
SevSeg
i2c_t3
jeelib
rbuf
readme.txt
hackintosh:libraries michal$

Or perhaps this is more definitive?

hackintosh:libraries michal$ cd /Users/michal/Applications/Arduino.app/Contents/Resources/Java/libraries 
hackintosh:libraries michal$ find . -iname LiquidCrystal_I2C*
hackintosh:libraries michal$ cd ~/Documents/Arduino/libraries/
hackintosh:libraries michal$ find . -iname LiquidCrystal_I2C*
./NewLiquidCrystal/LiquidCrystal_I2C.cpp
./NewLiquidCrystal/LiquidCrystal_I2C.h
hackintosh:libraries michal$

In you code, include "LCD.h"

That is where it is defined but it should be included in the sub-classes.

I assumed it was being included and I had tried it previously, and again now with the same result.

And I tried both:

#include <LCD.h"

and

#include “LCD.h”

I find this baffling :confused:

(This latest discussion really should be a new thread as it is an issue unrelated to the original post)

A quick response though. My suspicion is that you have some other library that is being included.

To tell for sure, turn on the verbose output in the IDE: [File]->[Preferences] Then check the "Show verbose output during compilation". You can then look at the compiler command line include paths included on the -I options and see where the header files are coming from.

--- bill

In hindsight I think you’re right Bill. Not only that but it’s marked as [SOLVED]. Next time I’ll start a new topic if I have a problem.

I followed your suggestion but it has just made it all the more mysterious since there appears to be nothing wrong :confused:

/Users/michal/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/Users/michal/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino -I/Users/michal/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/variants/standard -I/Users/michal/Documents/Arduino/libraries/NewLiquidCrystal -I/Users/michal/Applications/Arduino.app/Contents/Resources/Java/libraries/Wire /var/folders/vw/z8j2vz3j4r7376s46r6zs_3c0000gn/T/build5384796287676286130.tmp/HelloWorld_i2c.cpp -o /var/folders/vw/z8j2vz3j4r7376s46r6zs_3c0000gn/T/build5384796287676286130.tmp/HelloWorld_i2c.cpp.o 
HelloWorld_i2c:6: error: 'NEGATIVE' was not declared in this scope

It looks this way whether or not I include LCD.h

Can you see the examples in the arduino IDE? What version of the IDE are you using? If it is version 1.0.5, move the documentation directory else where and reload the IDE.

Yes, I can see the examples and I am using Arduino IDE version 1.0.5. Are you referring to the NewLiquidCrystal library docs directory? I tried moving that to the Desktop and restarting the IDE, but I still get the same error.

The NewLiquidCrystal examples remain.

EDIT: For what it's worth, in the comments section of this page it seems that people had a similar problem, though I don't know which libraries are linked. But that's the only place on the internet I've found anyone with a similar problem as I have :/

http://magnusglad.wordpress.com/2013/03/16/arduino-lcd/

mihalski, Please start a new thread, this cluttering up the thread. I have an idea as to what is going on and I'll answer in the new thread. --- bill

bperrybap: mihalski, Please start a new thread, this cluttering up the thread. I have an idea as to what is going on and I'll answer in the new thread. --- bill

Done. New thread at http://forum.arduino.cc/index.php?topic=179411.0