How to wire I2C LCD to ATiny85

I'm trying to wire a I2C LCD module to ATtiny85.
Do you have some example of wiring and the code needed to make it work?

My lcd module is:

Arduino IIC/I2C/TWI 16x2 1602 Serial Character LCD Module Display

Please help me,

thank you in advance!

Just look at the datasheet:

SDA is physical pin 5 (PB0)
SCL is physical pin 7 (PB2)

I've tried it but it does not work.
What library should i use?

I've downloaded the attiny85 version of I2C LCD Library (which i've found here: arduino-projects/libs at master · mtb77/arduino-projects · GitHub)

But it has no code examples about how to use it.

Any ideas are welcome.

You need to address the display.
To be able to do so, you need to know it's address.
Have a look at the type of I2C chip on your display (particularly does it have an "A" at the end ?).
Find any pins that set an address and find out what they are connected to.

Or of course run Nick Gammon's I2C scanner, which will try to find your device (works great!).

Of course also see if you need any resistors in your I2C setup (you do, but are they already present or not ?).

I think the address is 0x27... I guess that's what you mean...

This code is working fine in Arduino but not in ATiny85:

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

LiquidCrystal_I2C lcd(0x27,16,2);  

void setup()
{
  lcd.init();                      
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop()
{
}

Can you provide me an example like this but working on ATtiny85?
Thank you!

How about those resistors ?

I don't understand you... registers?

I know sometimes my pronunciation isn't always the best.
But that can't be the problem here.
Resistors are no software.
They are hardware.
Just connecting wires between your ATiny85 and an other device isn't always going to be enough.
You need resistors in your connection.
Are they already on your I2C board or not.

I know what resistors are :slight_smile: sorry I made a mistake while I was responding your last post.
But i still don't understand your answer.

The LCD I2C is working fine on standard Arduino (duemilanove, UNO, and so on)
But I can't make it work with ATtiny85.

This is the way I connect the I2C LCD to arduino UNO:

VCC -> Arduino 5v
GND -> Arduino GND
SDA -> Arduino analog in 4
SCL -> Arduino analog in 5

And it works fine.

For ATtiny85, I tried this:

VCC -> Arduino 5v
GND -> Arduino GND
SDA -> ATiny pin 0
SCL -> ATtiny pin 1

But it does not work.

I would like to know how the wiring has to be done and which libraries and code is ok for ATtiny.

Thank you.

I don't know where you got your pin numbering, but it's off.
SCL goes to pin 7 (which is PB2).
SDA goes to pin 5 (PB0).

I googled it, and found this image right here on the forum:

I think it clears things up, and advice you to keep the picture at hand while working with the ATiny85.

The physical world. Green wire SCL, yellow wire SDA.


Cheers!

See also Cosa/Boosting LCD 1602 performance (7X SR4W, 6.5X 4-bit parallel, 1.7-2.3X I2C) - #26 by kowalski - Displays - Arduino Forum