Sei sulla pagina 1di 5

Cheap Arduino 2 Wire LCD Display | 3guys1laser.

com

http://3g1l.com/blog-cheap-arduino-2-wire-lcd-display-0

Home Blogs flo's blog

about 3guys1laser
Wie der Name schon sagt, sind wir 3 Typen, die Zugang zu einem Laser haben und damit herumexperimentieren. Alles was damit einher geht, und ein bissl mehr, posten wir hier.

Cheap Arduino 2 Wire LCD Display


Sat, 12/31/2011 - 15:40 by flo

Like

One person likes this. Be the first of your friends.

follow us or get laserd! ;)

sponsoren
ein groes Danke und fr unsere Untersttzer!

Section
Electronics Laser

Topics
Fun Stuff Material Off Topic Promotion Prototype Serial Displays are expensive, so lets use a paralell display and a shift register!

Recent posts
2D 3D-Schrift Schachfiguren Hochzeitseinladung aus Holzfurnier techNIKE Metallfiguren Bringing Shift1 to Arduino Burn a bootloader to a blank atmega328/atmega328p with an Arduino UNO Cheap Arduino 2 Wire LCD Display Nach dem Fest ist vor dem Fest Laserkeks - Laserbox Solar - Laser Size matters Laser-Giger laserbox.net DrupalAT Laserei! More

This circuit is based on the work of raron . I just added a Potentiometer to regulate the Contrast. You need: 74LS164 shift register HD44780 Compatible Display 1K Resistor Diode Wires (flexible preferred) Stripboard (of cource you can do it on a breadboard/perfboard/whatever too) 10k PCB Potentiometer (could be replaced by a single resistor, but thats specific to the display) This is how you solder together the parts:

1 of 5

9/7/2013 8:01 PM

Cheap Arduino 2 Wire LCD Display | 3guys1laser.com

http://3g1l.com/blog-cheap-arduino-2-wire-lcd-display-0

Dont forget to cut the copper lanes beneath the shift register along the red line. If your done with it it will probably look like this:

2 of 5

9/7/2013 8:01 PM

Cheap Arduino 2 Wire LCD Display | 3guys1laser.com

http://3g1l.com/blog-cheap-arduino-2-wire-lcd-display-0

Now you have to choose a library, there are at least 2 availabe: ShiftRegLCD - which has been deprecated by its author. new LiquidCrystal At time of this writing ShiftRegLCD was not compatible with Arduino 1.0, so if you want a compatible version you can get it from here. But i would recomend using new LiquidCrystal.

Go to the download section and grab V 1.1.5 or later. Earlier versions migt also work but 1.1.5 introduces some performane tweak for the Shiftregister Class.

3 of 5

9/7/2013 8:01 PM

Cheap Arduino 2 Wire LCD Display | 3guys1laser.com

http://3g1l.com/blog-cheap-arduino-2-wire-lcd-display-0

if you need advice on installing the library check out its documentaton here. Here is a code example:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

#include <LiquidCrystal_SR.h> LiquidCrystal_SR lcd(8,7,TWO_WIRE); // | | // | \-- Clock Pin // \---- Data/Enable Pin // Creat a set of new characters byte armsUp[8] = { 0b00100,0b01010,0b00100,0b10101,0b01110,0b00100,0b00100,0b01010}; byte armsDown[8] = { 0b00100,0b01010,0b00100,0b00100,0b01110,0b10101,0b00100,0b01010}; void setup(){ lcd.begin(16,2); lcd.createChar (0, armsUp); lcd.createChar (1, armsDown); // initialize the lcd // load character to the LCD // load character to the LCD

// go home lcd.home (); lcd.print(F("LiquidCrystal_SR")); } void loop() { // Do a little animation for(int i = 0; i <= 15; i++) showHappyGuy(i); for(int i = 15; i >= 0; i--) showHappyGuy(i); } void showHappyGuy(int pos){ lcd.setCursor ( pos, 1 ); // go to position lcd.print(char(random(0,2))); // show one of the two custom characters delay(150); // wait so it can be seen lcd.setCursor ( pos, 1 ); // go to position again lcd.print(F(" ")); // delete character }
view raw

lcd_example.c hosted with by GitHub

Tags: arduino lcd shift register 2 wire tutorial ShiftRegLCD new LiquidCrystal_SR

Add new comment

Comments
I've been working with the

4 of 5

9/7/2013 8:01 PM

Cheap Arduino 2 Wire LCD Display | 3guys1laser.com

http://3g1l.com/blog-cheap-arduino-2-wire-lcd-display-0

Permalink Submitted by Marc MERLIN on Wed, 01/25/2012 - 09:04.

I've been working with the folks responsible for the shift register code to talk to LCD (3 different sources) and we're integrating all the work in one place (soon to be in NewLiquidCrystal hopefully). could I ask you to update your blog post to point people to http://marc.merlins.org/perso/arduino/post_2012-01-23_LiquidCrystal-driversupport-LCD3Wire-hardware-_pebble-and-others_.html I give my code for people who have latching shift registers, and code from Ragnar, now integrated by Francisco for non latching shift registers (along with a 2 wire only hack). If you could help repoint people, it will help reduce confusion and let people chose the most appropriate of the 2 wiring setups and get arduino 1.0 compatible code. Thanks, Marc
reply

100% Works on Arduino


Permalink Submitted by Qdlaczian on Wed, 04/04/2012 - 18:18.

100% Works on Arduino Duemilanove. Thanks.


reply

Hey Flo,
Permalink Submitted by Gus on Sun, 01/20/2013 - 00:07.

Hey Flo, I did a 2-wire connection and works like a charm, thanks for the post. My next task is to connect up to 4 LCDs to same arduino. I found this forum post - http://arduino.cc/forum/index.php/topic,5014.0.html - that explains that you may use same RS, R/W & Data lines if you change the Enable Line. Just have to declare a new instance of the function (i.e.: lcd1 & lcd2). I was wondering, If its possible to use the same shift register or I need to double the design? If I have to X2, using a shift reg for 4 LCDs will require 8 pins, 4 shift regs, 4 diodes and 4 resistors instead of just 9 wires, so its a waste of money... may I know what would you do?
reply

5 of 5

9/7/2013 8:01 PM

Potrebbero piacerti anche