Show Posts
Pages: [1]
1  Using Arduino / Displays / [SOLVED] MJKDZ brand I2C Controller working with 1602 LCD on: April 01, 2013, 07:52:33 pm
Recently I bought a cheap I2C controller and 16x2 display off of eBay, and since there seemed to be a lot of documentation online, I thought it would be an easy thing to hook up to my Uno.  Instead, it took me weeks to figure it out.  (Don't laugh, I'm new at this.)  I noticed that there wasn't that much documentation about my specific I2C board, so I decided to help change that by posting the results of my work.

The display: a QC1602A 16x2 character display.
http://www.ebay.com/itm/170817946781?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
This seems to be pretty popular, and is fairly well documented.

The I2C Adapter:  MJKDZ brand I2C LCD1602
http://www.ebay.com/itm/140906400906?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
Cheap, but not nearly as popular as it's similar cousins, so there isn't nearly as much information on this device.  There is a website printed on the board.  Don't bother, it's all in Chinese, and using Google Translate, I can confirm that what is there is totally useless.  The name of the chip has been filed off for some unknown reason as well.

First of all, getting the I2C board properly connected wasn't hard.  This 5v device connects to the Arduino just like any other I2C device.  4 pins:  Ground, 5V power, A4/SDA and A5/SCL.  Because things weren't working (for other reasons, but I had no idea the time), I tried to hook it up straight, and then I did it again using 4.7K Ohm pull-up resistors to improve signal quality.  Both methods worked, so don't be so concerned with the pull-up resistors unless you are experiencing problems.

Next, testing to see if the I2C board itself works and responds to I2C commands is important.  I recommend an I2C scanner, because this will tell you if the MJKDZ board is acknowledging I2C commands.  I got mine at this website:  http://gammon.com.au/i2c about half way down the page.  There's a lot of great I2C information there.  When I ran my I2C scanner, it told me that the device has an I2C address of 0x20.  This is interesting, because the eBay seller claimed the address was 0x27, which is totally not true.  So it happens to be very important to run an I2C scanner on your device to confirm the address, because no sketch will work correctly if you don't have the right address.

Excited that my I2C board was working, I hooked up my 16x2 display, and loaded up an I2C "hello world" sketch and....  nothing.  I tried all the sketches I could find on Google, and still, nothing.  Sometimes, the back light would turn on and off, and sometimes, the screen would have strange flashing and gibberish.  At first I thought it was a connection issue, so I tested the continuity of every wire, but everything was fine.  I also tried turning the tiny screw on the blue potentiometer, as that adjusts the contrast on the display.  Still, nothing.  I spent many days searching the internet and trying everything I could get my hands on, but nothing seemed to work until yesterday.  Here is what is needed for sketches to work:

Step 1:  Remove all LCD libraries from your Arduino IDE.  Check both the user specific ones, as well as in the Arduino install folder.  Zip them up and save them somewhere else if you think you might need them again, otherwise, delete.

Step 2:  Install the new and improved LCD library by F Malpartida from here:  https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home  This person has done some awesome work for the Arduino community.

Step 3:  The sketch I got working I found at the bottom of this website:  http://arduino-info.wikispaces.com/LCD-Blue-I2C Again, a very useful website!
I had to modify the sketch a little bit to make it work with a 16x2 display with an address of 0x20.  Below is the modified code:

Code:
/* YourDuino.com Example Software Sketch
 16 character 2 line I2C Display
 NEW TYPE Marked "Arduino-IIC-LCD GY-LCD-V1"
 terry@yourduino.com */
/*-----( Import needed libraries )-----*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>  // F Malpartida's NewLiquidCrystal library

/*-----( Declare Constants )-----*/
#define I2C_ADDR    0x20  // Define I2C Address for the PCF8574A
//---(Following are the PCF8574 pin assignments to LCD connections )----
// This are different than earlier/different I2C LCD displays
#define BACKLIGHT_PIN  7
#define En_pin  4
#define Rw_pin  5
#define Rs_pin  6
#define D4_pin  0
#define D5_pin  1
#define D6_pin  2
#define D7_pin  3

#define  LED_OFF  0
#define  LED_ON  1

/*-----( Declare objects )-----*/  
LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  lcd.begin (16,2);  // initialize the lcd
// Switch on the backlight
  lcd.setBacklightPin(BACKLIGHT_PIN,NEGATIVE);
  lcd.setBacklight(LED_ON);
}// END Setup

void loop()   /*----( LOOP: RUNS OVER AND OVER AGAIN )----*/
{

// Reset the display  
  lcd.clear();
  delay(1000);
  lcd.home();
  
// Print our characters on the LCD
  lcd.backlight();  //Backlight ON if under program control
  lcd.setCursor(0,0); //Start at character 0 on line 0
  lcd.print("Hello, world!");
  delay(1000);
  lcd.setCursor(0,1); //Start at character 0 on line 1
  lcd.print("16 by 2 Display");
  delay(8000);
} // END Loop

I pressed upload and it worked the first time!  After all that hard work, it now seemed so easy.  I think the secret is that the pins on the I2C device aren't standard, so may need to be remapped, which is what I think happens in the code above.  This would also explain why those pins on the MJKDZ board have no labels.  For me as a new Arduino user, it was quite a hassle, but it all worked in the end, and I learned lots, so I can say that this was $5.23 well spent.  I hope this post helps any other new owners of the MJKDZ I2C LCD1602 boards save some time figuring things out the hard way.
2  Using Arduino / Displays / Re: SOLVED: How to wire an mjkdz I2C board to a 20 x 4 LCD on: March 26, 2013, 03:22:12 am
Hello everyone!  I have the same MJKDZ I2C board.  I also ran a I2C scanner, and the port is confirmed to be 0x20.  However, I do not have a 20x4 display, I have a 1602 display that I purchased here:  http://www.ebay.com/itm/170817946781?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649  Does it work in the same way as the 20x4?

I have connected it in a 1:1 manner like in the photograph of the original poster.  So far, I can't get it to work with any sketches that I have tried.  Since my I2C port scanner is working, I will assume that the problem is either the connection or software.

I am very new to Arduino and these types of devices, can someone please explain to me how I can get to the point of working example code, so I can do my own programming?
3  Using Arduino / Networking, Protocols, and Devices / Re: Is it possible to upload sketches over Bluetooth to an Arduino? on: January 29, 2013, 05:15:41 pm
I'm a newbie too, and I have had quite some trouble with this exact problem.  I have not gotten my DTR reset system to work yet, but I have mastered the manual reset method.  My Bluetooth module status LED flashes slowly when ready to connect, and goes solid when connected.  The procedure I have used successfully is to press "upload sketch" on the Arduino IDE, then press and hold the reset button on my Arduino.  When I see my Bluetooth Status LED go from flashing to solid, I immediately let go of the reset button.  Works every time for me.

I hope that helps!
4  Using Arduino / Installation & Troubleshooting / Re: Upgrading Arduino on: January 29, 2013, 04:30:19 pm
I installed my versions side by side, including beta versions.  Then I realized any user created stuff was saved elsewhere, so uninstalling old versions was as easy as deleting folders and shortcuts.
5  Using Arduino / Installation & Troubleshooting / Re: Bluetooth works, uploading sketches does not. on: January 29, 2013, 04:44:15 am
Partial success.  I have been able to program my Ardweeny using my Bluetooth module, using manual reset method.  The trick is to press and hold the reset button, and let go the moment the connection LED on the bluetooth module goes from flashing to solid.  Works every time.

In other news, the manufacturer of the Bluetooth module got back to me, and said it does support DTR on pin 25 (PIO2) of the module.  I have been experimenting with this, with so far no successes.

I have downloaded the latest beta IDE, and will soon be attempting Pito's work around.  I'll post my progress here.
6  Using Arduino / Installation & Troubleshooting / Re: Ardweeny Programming Failure - Strange Problem on: January 27, 2013, 10:37:15 pm
I always did the loopback test to see how far the signal was getting, so that I knew where the problem was.  It's easy to do.  Short the RX and TX pins on your USB adapter.  Open a com program and connect, and type something random.  If the serial device sends back exactly what you type, then it works.  If it doesn't, your problem is with your serial adapter or driver.  Get that to work first.

Next, you can short some RX/TX pins on your Arduino, to know if the signals are getting to the processor.  I know how to do that on my Ardweeny, but you may have to do a web search how to do it on your Due.

On my Ardweeny, doing a loopback test would mean shorting the RX and TX pins (D0 and D1)

Also, a multi meter is very handy.  Put one pin on ground, the other on the DTR pin.  Get a com program that lets you toggle the DTR.  I recommend Realterm.  With loopback and multimeter, you should be able to trace the path of the signal and see where it stops.  Best of luck!
7  Using Arduino / Installation & Troubleshooting / Re: Bluetooth works, uploading sketches does not. on: January 19, 2013, 03:59:23 pm
perhof, I tried the manual reset in different combinations for about half an hour with no success.  My last attempt will be to find a way to test the dtr solder point on the bluetooth module to see if it does anything, and if not, I'll order a more expensive bluetooth adapter that is known to work.  thanks for your advice.
8  Using Arduino / Installation & Troubleshooting / Re: Bluetooth works, uploading sketches does not. on: January 19, 2013, 12:53:32 am
perhof:  You may be right.  The only pin it has that I cannot understand is the "CLR" pin.  I'm not quite sure what it does, but it does not work the same way as the DTR pin on my USB to TTL.  Any ideas?

Pito, thanks for that link.  I went over that, and I'm not sure your adapter has the same firmware as mine.  I looked through my adapter's manual, and pin 32 is only labelled as "programmable I/O".  Perhof may be right, my adapter may not allow DTR, so I will need to buy another Bluetooth adapter if I want to upload sketches.  I wonder, is there any way to test if PIN32 on my Bluetooth adapter functions as DTR?  It's so tiny and I'm afraid to solder anything.
9  Using Arduino / Installation & Troubleshooting / Re: Ardweeny Programming Failure - Strange Problem on: January 19, 2013, 12:14:33 am
Crossroads, good point.  I bought two of these, as they are only $1.50 each (incl. shipping!) on ebay.  The one above I modified for general purpose use by adding all the header pins.  The other one I am considering mutilating in just such a fashion, but I'm holding off because it will just be a temporary solution, as I'm working on a Bluetooth adapter for my Ardweeny to do away with pesky cables altogether.
10  Using Arduino / Installation & Troubleshooting / Re: Ardweeny Programming Failure - Strange Problem on: January 18, 2013, 09:18:34 pm
A picture is worth a thousand words, so here are 4.  You can see how I modified the USB to TTL adapter.

http://i.imgur.com/SWVIxfh.jpg
http://i.imgur.com/vkJi2oV.jpg
http://i.imgur.com/7295ADv.jpg
http://i.imgur.com/EEEK4wJ.jpg

I hope this helps.
11  Using Arduino / Installation & Troubleshooting / Bluetooth works, uploading sketches does not. on: January 18, 2013, 01:49:12 am
I have an Ardweeny (uno-compatible) https://solarbotics.com/product/kardw/
I have a TTL Bluetooth Adapter http://www.geeetech.com/serial-ttl-bluetooth-module-p-601.html

The first thing I want to say, is that they work.  I have tested the bluetooth adapter on a USB-TTL connector.  I have connected the Bluetooth to the TTL connector on the Ardweeny, and everything works well.  I have been able to write test sketches and communicate both ways over bluetooth with my Windows Vista laptop.  Everything works.

Except uploading sketches via Bluetooth.  I've tried everything I can think of, and I can't get it to work.  The correct COM port is selected, as well as the baud rate of 115200.  I can click on "serial monitor" and communicate both ways if I have a sketch uploaded the old fashioned wired way beforehand.  But clicking "upload" gives me "avrdude: stk500_getsync(): not in sync: resp=0x00"  I've been searching the web for a solution, but nothing stands out yet.

Has anyone else had this problem with Bluetooth and the Arduino IDE?
12  Using Arduino / Installation & Troubleshooting / Re: Ardweeny Programming Failure - Strange Problem on: December 08, 2012, 03:26:30 am
WELL WELL, after much hair pulling and troubleshooting and experimenting, I got it to work!!!!!!

I'll let everyone what's going on, because other people using the B75937 USB to FTDI will need to know this.  (this is valuable information)

First of all, this little adapter does not come with a DTR pin that the Ardweeny needs, but it does have a small through-hole soldering point for a pin.  I pulled out my soldering iron and using a spare row of header pins I had left over from another project, I made myself a DTR pin on my B75937.  It took me 5 minutes.

Secondly, there is a mis-print on the board of the B75937, which would explain why it was so cheap.  ($2.50 including shipping).  The TXD and RXD labels are mistakenly switched.  The proper connectivity is TXD -> RXI and RXD -> TXD.  Once I had switched the connection, and had the DTR connected, my Ardweeny (which I am very happy with) came to life!

I hope anyone googling problems with their B75937 USB to FTDI serial adapter with CP2102 chip can find this information handy and save themselves some frustrations.
13  Using Arduino / Installation & Troubleshooting / Ardweeny Programming Failure - Strange Problem on: December 08, 2012, 02:11:48 am
Hi, I'm relatively new to electronics, but not to computers or troubleshooting.

I have an Ardweeny, as well as an Ardweeny Multipack.  I run Vista-32 and have a CP2102 USB-FTDI connector.  It's a B75937, and the manufacturer's website (sadly in Chinese) is here:  http://item.taobao.com/item.htm?spm=a1z10.1.28-2539457881.1.DPBQHO&id=9667883527  I installed the drivers, and assume they work fine, as it shows up as COM4, and I shorted the TXD and RXD pins, and a loop-back test worked normally.

When trying to upload a test sketch (blink), it does not work.  Error code avrdude: stk500_getsync(): not in sync: resp=0x00

I had Arduino Uno selected.  Manufactuer (www.solarbotics.com) suggested I select Arduino Duemilanove with ATMega328 for compatibility but it still did not work.  Manufacturer suggested I connect RST on B75937 to DTR on Ardweeny.  No go.  I noticed there was a through-hole connector on the B75937 that says DTR.  I soldered a connector to the DTR on the B75937, and connected that DTR to the Ardweeny DTR, and I got some progress.  Now, when I go to the "tools" menu, or try to upload a sketch, the LED on the Ardweeny flickers, so I assume things are working correctly now.  Yet still, I get the same error code no matter what I do, even though loop-back tests on D0 & D1 work.  (I used the procedure I found here: http://arduino.cc/forum/index.php/topic,73748.0.html)

I am not sure what I'm missing, as there is nothing else I can find on google or these forums that seems to help my problem.  Please help.
Pages: [1]