Pages: [1]   Go Down
Author Topic: How to wire I2C LCD to ATiny85  (Read 1619 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!

Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8975
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just look at the datasheet:

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

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

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

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: https://github.com/skulawik/arduino-projects/tree/master/libs)

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

Any ideas are welcome.
Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 51
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?).
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

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

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

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

Code:
#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!
Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 51
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How about those resistors  ?
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

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

I don't understand you... registers?
Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 51
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

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

I know what resistors are smiley 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.
Logged

The Netherlands
Offline Offline
Edison Member
*
Karma: 51
Posts: 1729
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

« Last Edit: July 15, 2013, 10:34:47 am by MAS3 » Logged

Have a look at "blink without delay".
Did you connect the grounds ?
Je kunt hier ook in het Nederlands terecht: http://arduino.cc/forum/index.php/board,77.0.html

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

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


Cheers!

See also http://forum.arduino.cc/index.php?topic=175702.msg1316743#msg1316743
Logged

Pages: [1]   Go Up
Jump to: