Pages: [1]   Go Down
Author Topic: I2C - working w/ Duemilanove, not w/ Nano  (Read 1706 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello there!

I'm approaching the end of my wisdom and I hope you can help me! I have a 16/2 display, controlled via I2C. With the libraries of fm it works perfectly on my Arduino Duemilanove. If I upload the exact same sketch to my Nano, wire everything exact the same way (believe me, 10 times doublechecked), the display is lighened, but no chance that there would appear any letters.

I'm using 10k pull-up resistors, the display is some no name product with a I2C adaptor from YwRobot (LCM1602).

As I said, exactly the same way wired, exact the same sketch.

Stop, there's one difference: On the Duemilanove, I power the display via the 5V and GND pin, on the Nano i take 2 digital pins for this, so in the sketch for the Nano there's this bit of code which gives power to those two pins.

Any help is appreciated! Thanks!
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

10k pull-ups are a too high value, should be something between 2k2 and 4k7. Can you try with pull-ups in this range?

How are you driving the LCD display? With power supplied by the Arduino? What else is powered from the Arduino?
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your response! Actually I don't have other pull-ups around, but I can try, probably I'll find some in a shop. Could this make the difference, since it does work with the Duemilanove? (I actually tried it without on both Arduinos, same result)

Yes, the power is supplied directly from the Arduino. There's nothing else connected.
« Last Edit: June 20, 2012, 07:19:32 am by GoingForGold » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you know how much power the display consumes? Can you measure it?

The pull-ups can make the difference although it's unusual that such a setup works with one Arduino but not the other. That's why I'm asking for the power consumption. A description of the consequences of different pull-ups can be found here:

http://www.dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors.html
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I measured it, it says about 16mA. Anyways, I tried it with the 5V and GND pin on the Nano, the displeay seems a bit brighter to me, but nothing changed so far.

I'm looking for lower values in the internet, but actually I cant find anything around 3.3k
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Probably unnecessary to ask but nevertheless: You do connect the display on the Nano to A4 and A5 (although there A6 and A7 also exist)?

16mA are no reason for the LM78M05 to have problems, so power should not be a problem. Are you powering from the USB or a separate power supply?

You don't have the possibility to check the two lines SDA and SCL with a oscilloscope, do you?

You can try to lower the I2C frequency by inserting the following lines after Wire.begin():

Code:
TWBR = 78; 
TWSR |= _BV (TWPS0);

This lowers the frequency from 100kHz to 25kHz. With this frequency your 10k pull-ups may be enough.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again for your help!

I'm sure I'm using the right pins smiley-wink I power the Arduino via USB, but also tried 9V via the VIN pin, again, the display seems a bit brighter but no change. Unfortunately I don't have an oscilloscope.

I have a problem with your bit of code, I tried to insert it and get a bunch of errors, "expected unqualified-id before 'volatile'". I tried google it but didn't find anything out. Since I'm not using a Wire.begin(), I'm not sure where to put it.
« Last Edit: June 20, 2012, 10:25:28 am by GoingForGold » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's probably time to show us your whole code, because if you don't use the Wire library it may be possible that you don't use the hardware I2C at all.

Post the code with the code tags (the hash # sign in the editor). Also include links in the post to all the libraries you use which are not part of the main IDE distribution.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I'll do that later, it's not possible at the moment.

Well, I AM using the WIre library, but I'm not calling any function with it. The LiquidCrystal_I2C (actually all such libraries) manage this by themselves, but the Wire library needs to be attached to the sketch.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So you have to insert the lines after the code for initializing the LiquidCrystal_I2C library.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so, I'm back:

My library is from: https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

I found this thread: http://arduino.cc/forum/index.php?topic=106655.0

I'm using the code below, which works for Duemilanove, but not on Nano:

Code:
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR    0x27  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

int n = 1;

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
  lcd.begin (16,2);
 
// Switch on the backlight
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home ();                   // go home

  lcd.print("SainSmart I2C test"); 
  lcd.setCursor ( 0, 1 );        // go to the next line
  lcd.print("F Malpartida library");
 }

void loop()
{
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, did this ever get solved? I only have the nano board (V3.0) so i cant tell if my display works on any other board. The display works without I2C..

Im using this display

http://www.ebay.co.uk/itm/New-2004-204-20X4-Character-LCD-Module-Display-Arduino-/290703654171?_trksid=p5197.m1992&_trkparms=aid%3D111000%26algo%3DREC.CURRENT%26ao%3D1%26asc%3D14%26meid%3D6197463754650217579%26pid%3D100015%26prg%3D1006%26rk%3D1%26sd%3D290703654171%26

with this LCM1602 (Emall-4u), yes ive seen that thread (Made no difference) :-)

http://www.ebay.co.uk/itm/390527388644?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2648


I think i have tested every freaking code and library out there. Im using the FM 1.2.1 library for now. SDA is connected to A4 and SCL to A5. Im all ears people...

Edit: Forgot, the display lights up and displays only blobs on row 0 and row 2.
« Last Edit: March 12, 2013, 03:06:03 pm by puttelino » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey puttelino,

I bought the same adapter from emall-foryou but the hello world example from the LiquidCrystal_I2C library only flashes my display once during setup.
No characters are displayed.
1602 display, Arduino Nano v3.0 using A4/A5 and 0x20 as the I2C address.
smiley-sad
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In the code of GoingForGold:

Code:
#define I2C_ADDR    0x27  // Define I2C Address where the PCF8574A is
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

In the example code on the linked page:

Code:
LiquidCrystal_I2C lcd(0x20,16,2); //set the LCD address to 0x20 for a 16 chars and 2 line display

Which code are you using?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there,

I also spent some time today with this problem and found this page
http://arduino-info.wikispaces.com/LCD-Blue-I2C

There is an patched LiquidCrystal_I2C which works like a charm for me.
You just have to replace the whole folder in libraries with their version.

I have got this: http://www.ebay.de/itm/251214363014?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
The arduino I used is an Nano v3 china knockoff. SDA and SCL go on analog 4 and 5.

Maybe this info will help someone.

Greetings
DerBunman
Logged

Pages: [1]   Go Up
Jump to: