Pages: [1]   Go Down
Author Topic: Arduino LCD via I2C  (Read 979 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Everyone,

I have a "Arduino Nano w/ATmega 328", connected with a "Clock" and and LCD screen 4x20.

The LCD is the "JHD 204A" and there is a chip connected on it with code "BV4218"
(I guess it is a I2C chip, please do correct me if I'm wrong).

What I want to do is to print "Hello" on the LCD using the SCL and SDA, but I don't know how
to do it!

I read a lot about the SCL SDA (http://www.robot-electronics.co.uk/acatalog/I2C_Tutorial.html)
and I understood how it works in theory but I don't know what code I have to write in order to
send the sequences (Start, Address, Transite Data, Stop) to the LCD.

I would be really greateful if somebody could help.
 smiley
Logged

alabama
Offline Offline
Full Member
***
Karma: 1
Posts: 183
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Arduinakias,
Have you read the "How to use this forum" at the top of the page?
Depending on which version of Arduino you are using (1.0.3 up) there are examples included for using I2C LCDs.
Do you have the datasheet for the display, what is it's address, link to the retailers page/examples?
It is very easy to program once you get some basic parameters right, I think it is called a constructor, that has to be initialized at the start of the sketch.
If you have an older version of Arduino, search here for NewLiquidCrystal to find the new library for LCDs, with lots of help for installing and using.
You will also need the relevant library for the RTC.
You also might try searching the playground for more examples.
Google is your friend, lots of tutorials out there.
TomJ

Logged

Einstein once said you don't really understand anything until you can explain it to your Grandmother

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Depending on which version of Arduino you are using (1.0.3 up) there are examples included for using I2C LCDs.
Really?
I don't see any examples for I2C LCDs.
All I see is the LiquidCrystal library that uses 4 bit parallel mode.

Where are the i2c LCD examples?

--- bill
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1273
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A backward compatible LCD library can be found at

https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

Handles all sorts of serial LCDs.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A backward compatible LCD library can be found at

https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

Handles all sorts of serial LCDs.

fm's released library has support for using  4 bit mode, i2c, and shift registers using 2 or 3 wires
to talk to a HD44780 based LCD.
i2c is not a generic interface for an LCD. (There are different ways to use I2C to talk to an LCD)
The i2c support in the released library is for using a PCF8574 i2c chip to drive the LCD.

Arduinakias, the LCD & module you have appears to be using a i2c backpack,
the ByVac BV4218.
www.byvac.com/downloads/datasheets/BV4218%20DataSheet.pdf
While it does have an i2c interface on it, it does not work the same
as when a PCF8574 chip is driving the LCD.
So unfortunately, fm's currently released newliquidcrystal library does not have support
for the BV4218.

However....
Last summer (2012) ByVac added support for the BV4218 to fm's library.
There were some issues with the early code (it broke the library), but it looks
like the code was updated in sept of 2012.
I glanced at it and for sure it won't compile with pre 1.x Arduino core.
So not sure if it works with Arduino 1.x, but it is probably worth trying it.
Since fm has not created a release since this code was added,
there is no download zip file that includes the 4218 support.
To get the code you will have to go to the download section, then go to the [Tags] tab
and then download the "tip" tag.
The direct link to the zip file for that is here:
https://bitbucket.org/fmalpartida/new-liquidcrystal/get/tip.zip

To install and use it is just like the other downloads.
You have to move the existing liquidcrystal library directory off somewhere else.
Then extract the files in the zip image and place it in the liquidcrystal library directory.

--- bill

« Last Edit: March 20, 2013, 11:53:31 pm by bperrybap » Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18792
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This isn't your LCD, but I have a page about graphics LCD, and I2C:

http://www.gammon.com.au/forum/?id=10940

And I2C in general:

http://www.gammon.com.au/i2c

You don't need to worry about start/stop stuff, the library does that.
Logged


Pages: [1]   Go Up
Jump to: