Go Down

Topic: I'm Confused DS1307 & LCD (Read 8644 times) previous topic - next topic


I went back to the LCD4Bit library for now. Works great with the DS1307 library.


For those that prefer to use LiquidCrystal, there is a modifed LiquidCrystal.cpp file posted here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1259689547/11#11


Dec 04, 2009, 02:01 am Last Edit: Dec 04, 2009, 02:04 am by DanDare Reason: 1

Did some tests without the DS1307 library but just Wire.h and same stuff, sometimes it works sometimes it doesnt, depending the how you code and place the lcd instructions, it´s unstable.

I found a nice solution for the parallel LCD library (I dont liked the LCD4bit library at all). Fixed the LCD issue using this: http://code.google.com/p/arduinoshiftreglcd/ that works flawless.

This turned the best thing because:
1- You can use parallel LCD that are cheaper, the 74LS164 sift register is also very cheap and common.
2- You can use just two wires like in the serial LCD, but you dont need to make the RX pin busy like on serial
3- The guy library is very good, fast and reliable, accept numbers (LCD4Bit dont), you can specify types just like in Serial.print like 'srlcd.print(value, HEX)' or anything.
4- You can specify 8 (or more not sure), custom characters on his library.

Made a couple of tests and the library is really light and fast, and makes you code smaller.

Guys should add this stuff as default IDE library IMO.
Thanks to Italo Lima user on his post http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1258683705 in pointing me to shift-registers.




Rodrigo, the shift register library is built on top of the LiquidCrystal library so I am surprised that one worked and the other did not, but good to hear you have it going.

Have fun!


Dec 04, 2009, 02:34 pm Last Edit: Dec 04, 2009, 02:51 pm by DanDare Reason: 1
Hello mem,

Thanks in pointing out about the similarity among the libraries. So now Im surprised too. If others test the shift-register methods we may be able to conclude something.
I tested lot of situations where parallel interface from Arduino wasnt working and got no problems using the shift register. Maybe it´s soon to make conclusions but situation leads me to believe interaction bugs between software and/or hardware.
Im just newb at electronics but thinking of the parallel interface using so many pins towards same component If some kind of undesired loop back noise interfering MCU. Maybe we need decoupling capacitors or some type of protection driving the LCD? Just some wild guess.

In my tests with LiquidCrystal library stated that, starting from a working sketch, inserting Wire.h it begins not working. Same issue in some cases with setting 'Serial.begin(9600)' on the sketch. Other times changing the code "style" even using Wire.h or Serial.begin it starts working. It´s a random stuff.



---- EDITED ----

Doing some searches find this very interesting: http://www.picbasic.co.uk/forum/showthread.php?t=3471

About decoupling capacitor for LCD among other good info


from that thread it sounded like the microcontroller did not have any decoupling on the power supply. If you are using a commercial Arduino board it should have adequate decoupling if your wiring is reasonably short. What board are you using and how long were the wires that were connecting to the LCD in the mode that did not work.


Is it necessary any other component (i mean diode, capaciter, resistances or whatever) between the LCD and the Shift register or between it and the arduino?

By the way, is there any way to change the contrast by software? and by hardware? I suppose that a potenciometer, but where to wire it in the 2-wire or 3-wire configurations?

I have on mind to use a pushbutton to increase decrease the contrast by software in the LCD. Is it possible?

Thanks for your comments and work with the LCD libraries


Sure, use a digital potentiometer.


Oh! i didn´t know about this devices. I will explore this component.


Hello mem,

Thanks for the considerations.
Im using Severino board http://arduino.cc/en/Main/ArduinoBoardSerialSingleSided3
The wire setup in both cases (with the library/setup that works and the library/setup that doesnt work), it´s the same.
Im not using long wires: http://img267.imageshack.us/img267/968/lcdm.jpg


In the example http://code.google.com/p/arduinoshiftreglcd/ for 3 wire connection you dont use anything but the shift-register for the 2 wire connection you use 1k resistor and a diode.




Dec 06, 2009, 01:54 am Last Edit: Dec 06, 2009, 01:55 am by madepablo Reason: 1
Saluti Rodrigo,

Thanks for the link. Just only a couple of very easy questions:
1.- What kind of diode?  1N4001, 1n4007 or .....
2.- Which ones should be the arduino pins...  I suposse thar 1 to 6 or 1 to 5 in the schemes of the link that you provide, are digital ones, is it correct? In that case... any special one? i mean is it the same PMW or normal, rx, tx....?



Dec 06, 2009, 06:51 am Last Edit: Dec 06, 2009, 06:52 am by baltasar Reason: 1
Hi, had the same problem and solve using the wire.h library to talk directly to DS1307 chip as I reported on this topic:


Anyway apart managed to solve the comunications problems, I still have once up a while some strange /garbage caracteres in the LCD.

Going to try the power capacitator solution to see if it helps since the modified .cpp version didn't help and I can't use the LCD4bit library since doesn't have a lot of functions I need to use on the LCD.


Dec 06, 2009, 02:09 pm Last Edit: Dec 06, 2009, 02:10 pm by DanDare Reason: 1

1-> Im using 1N4001 and it´s doing OK
2-> They are ordinary digital pins, dont need to be Rx/Tx or PWM ones.
3-> In the schemes from the link you use 2 wire or 3 wire to the LCD, the others wires on my picture are for tactile switches.
4-> Be aware if you are going to try that shift-register scheme because it dont show the Vcc and Gnd connections of the chip, but you must wire those.

I had same trouble and after managed to have a usable sketch realized that doing/adding modifications on the sketch it starts some strange/garbage on LCD, randomly. I dont know how but it stopped after using the shift-register scheme/library.




Thanks DanDare,

I will try it tomorrow, taking care to connect also the Vcc and GND of the 74LS165. If it runs, later i will try to connect also the ds1307.

Thanks for your inputs!


It doesn´t runt at all for me. :'(

I have this LCD: GDM1602K, and the SN74LS164N shift register. I tried both circuits (2 and tree wires), and nothings happens... The screen remains black, but i runs perfectly when i used the LiquidCrystal library and all the wires...

Go Up