Pages: [1] 2   Go Down
Author Topic: LCD 20x4 on ATTiny85 I2C problems  (Read 1668 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can some one tell me how to setup an ATiny85v to run a 20x4 LCD with an LCM1602 IIC V1 backpack?

I've downloaded and tried about 6 different Libraries. None seem to work.

SDA = Attiny85 pin 5 with pull up
SCL =  Attiny85 pin 7 with pull up
VCC = pin 8
GND = pin4

One of the problems is I don't know the I2c address and I cant seem to run the scanner on the tiny. When I setup the display on a Nano or a DueMilenove the address is 0x27. the backpack is running a PCF8574T.

Do I have to set any fuses or anything special first?

I've been googling and reading this forum all day and nothing seems to work for me. Any suggestions?

Thanks for your  help.
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1790
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This link may assist:
http://forum.arduino.cc/index.php?topic=183924.15

Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


This is the first article I read and the first library I downloaded. No luck! Thanks though
Logged

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

One of the problems is I don't know the I2c address and I cant seem to run the scanner on the tiny. When I setup the display on a Nano or a DueMilenove the address is 0x27. the backpack is running a PCF8574T.

The address of the backpack should be the same regardless of which uC you are using to talk to it.
Logged

Portugal
Offline Offline
Edison Member
*
Karma: 37
Posts: 1579
Pretending you know everything then you will learn nothing.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where did you get that board?
There are some Chinese ebay boards using the PCF8574T with the pins swapped and so you can't use the original library for it.
I have one of this Chinese board and my address is 0x20.
Here is the library for the Chinese version.
Remember, you must remove from the libraries folder the older one and  insert this new one.
Post results

* LiquidCrystal_I2C2004V1_Chinese.zip (19.06 KB - downloaded 33 times.)
« Last Edit: February 21, 2014, 01:23:38 pm by HugoPT » Logged

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok the chinese library worked for my ...milenove, but the char display acts as a 16x2 and not a 20x4 even is i try to print to the other char positions the 16x2 positions only print...

my address is 0x27 according to the i2c_scanner.

any suggestions on how to use the full display?
Logged

Portugal
Offline Offline
Edison Member
*
Karma: 37
Posts: 1579
Pretending you know everything then you will learn nothing.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but the char display acts as a 16x2 and not a 20x4 even is i try to print to the other char positions the 16x2 positions only print...
Did you specify the size in:
Quote
LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 20 chars and 4 line display
Logged

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is my code and attached is the output.

Code:
//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  lcd.print("Hello, world!");
  lcd.setCursor(2,1);
  lcd.print("Ywrobot Arduino!");
   lcd.setCursor(0,2);
  lcd.print("Arduino LCM IIC 2004");
   lcd.setCursor(2,3);
  lcd.print("Power By Ec-yuan!");
}


void loop()
{
}


* image.jpeg (538.01 KB, 1632x1224 - viewed 29 times.)
Logged

Portugal
Offline Offline
Edison Member
*
Karma: 37
Posts: 1579
Pretending you know everything then you will learn nothing.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thats very wierd since I have a chinese board like your and a LCD 20x4 and I'm sure it displays all the characters correctly.
When I get home I will try your code with mine to double check that.
Looking to your code I just have one thing to ask
Why are you initializing the lcd two times?
Quote

 lcd.init();                      // initialize the lcd
  lcd.init();
Logged

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the two init(); are in the example. I thought it was weird too...

in any case i just got another SainSmart 20x4 in the mail (just now); hooked it up and it works fine.

is there a way to fix the other one? replace a resister/component?
Logged

Portugal
Offline Offline
Edison Member
*
Karma: 37
Posts: 1579
Pretending you know everything then you will learn nothing.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are the second LCD same brand and model?
Logged

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

there is  no brand on the other one
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 450
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you use external pullup resistors? The internal are too weak on the ATtiny. Some I2C LCD adapter modules do not have them at all and require external.

Please see https://github.com/mikaelpatel/Cosa/issues/86


More info on http://cosa-arduino.blogspot.se/2013/07/object-oriented-lcd-management.html

Cheers!
« Last Edit: March 07, 2014, 09:04:35 am by kowalski » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you use external pullup resistors? The internal are too weak on the ATtiny. Some I2C LCD adapter modules do not have them at all and require external.

Please see https://github.com/mikaelpatel/Cosa/issues/86


More info on http://cosa-arduino.blogspot.se/2013/07/object-oriented-lcd-management.html

Cheers!


Thanks for the info!
 do you have a simple sample sketch?
When working with the 85 do you call pin 5 or Pin 0?

Thanks again for your help
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 450
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

do you have a simple sample sketch?
When working with the 85 do you call pin 5 or Pin 0?
First of all I need to explain that Cosa is an object-oriented platform for Arduino with over 100+ classes. It is an Arduino core but supports all AVR processor based boards plus ATtiny and Mighty. It is also stand-alone and does not depend on any Arduino code more than the IDE build process.

The simplest example sketch is the LCD hello world that I use for footprint benchmarking.
https://github.com/mikaelpatel/Cosa/blob/master/examples/LCD/CosaLCDsize/CosaLCDsize.ino

The pin-out is described in the Board description file for ATtiny.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Board/TinyX5.hh#L41
Pins in Cosa are symbols, e.g. Board::D0 instead of integers as in Arduino/Wiring.

You can basically develop on Mega, Uno, etc, and simply select ATtiny85 and compile-and-burn with more libraries than in any other Arduino package. SPI, TWI, 1-Wire etc are all support. LCD support is an abstract class that is implemented for HD44780, PCD8544, ST7565. The HD44780 driver also has an adapter layer for 4-bit parallel, Shift Register 3-wire (Pin or SPI), Shift Register 4-wire and a whole range of different I2C adapters. You can see how the configuration works in the CosaLCDsize sketch above.

Cheers!

Mikael
« Last Edit: March 07, 2014, 10:26:33 am by kowalski » Logged

Pages: [1] 2   Go Up
Jump to: