Tecnologia

Disponível somente no TrabalhosFeitos
  • Páginas : 5 (1123 palavras )
  • Download(s) : 0
  • Publicado : 12 de abril de 2013
Ler documento completo
Amostra do texto
Thi s tutorial shows how to connect the 1602A LCD di splay and a light sensor to your Ardui no
(UNO) and di splay the li ght intensi ty on the screen. I am using only parts from the Ardui no starter
kit I got from Deal Extreme.

Thi s is one of the fi rst thi ngs I try wi th the Ardui no, but si nce I could not find one tutori al that
covered the combinati on of usi ng the LCD screen ánd theli ght sensor, I decided to wri te one
beginner tutori al. Also there are many different versi ons of the 1602 LCD display with di fferent
pi nouts and I couldn't really find whi ch the DX version exactly was.

MATERIALS USED
1 x Arduino UNO
1 x Breadboard (63 columns)
1 x Light sensor
1 x 50K pot meter
1 x 1602A LCD display
1 x 10K resi stor
1 x Connector (16 pins)
1 x USB cable THE LCD DISPLAY
The LCD di splay comes with no connector by default. This way you can solder wi res to i t, solder
a connector on it, whatever you want. I choose to solder the connectors to the back so I could
press the LCD di splay on the breadboard. To do thi s, snap of a row of connectors (16 pi eces)
and stick them (short pi n up) trough the LCD display connectors.

Sti ck the LCD display i n the breadboard, somewhere on the ri ght in the lowest row of holes so
you can connect the breadboard wires above and the di splay rests on the unused rows of the
breadboard.

CONNECTING THE DISPLAY AND BREADBOARD
Fi rst you need to power the display and i ts backlight. Connect two wires from +5v and GND to
the plus- and mi n rows of the breadboard.
Connect: Ardui no 5v (pin 3) >plus column on breadboard
Connect: Ardui no GND (pi n 4 or 5) > mi n column on breadboard

Then connect the LCD power and the backli ght power to the plus- and mi n rows.
Connect: GND row (mi n) on breadboard > pi n 1 on LCD (VSS)
Connect: +5v row (plus) on breadboard > pin 2 on LCD (VDD)
Connect: +5v row (plus) on breadboard > pin 15 on LCD (A)
Connect: GND row (mi n) on breadboard > pi n 16on LCD (K)

When we power up the Arduino (by plugin in the USB cable connected to the computer) we'll
see the LCD screen li ghti ng up:

Next up i s the pot meter. We use the potmeter to set the contrast of the display. In most LCD
tutorials a 10K pot meter i s used, but a 50K i s also good. Fi netuning gets a li ttle harder
because the range is bigger, but that's no problem for thistutorial. Plug the pot meter i n the
breadboard, somewhere left of the LCD di splay and connect the three pi ns.
Connect: fi rst pi n of the potmeter > GND of the breadboard
Connect: mi ddle pi n of the potmeter > pi n 3 of the LCD display (VO)

When you power up the Ardui no now, you will see the di splay having square characters on the
fi rst row. Of you don't see them, turn the pot meterslowly from left to ri ght to adjust the contrast.
You can finetune thi s setting when we've got characters on the di splay later. If your di splay looks
li ke thi s, you're doi ng fi ne:

In the next few steps we'll connect the display further to the Ardui no to let the ardui no
communi cate wi th the LCD screen and put some characters on i t.
Connect: pin 4 of the LCD di splay (RS) > pi n 7of the Arduino (di gital out, PWM, yellow wi re)
Connect: pin 5 of the LCD di splay (RW) > GND row of the breadboard (black wi re)

Connect: pin 6 of the LCD di splay (E) > pi n 8 of the Ardui no (PWM)
Connect: pin 11 of the LCD di splay (D4) > pi n 9 of the Ardui no (PWM)
Connect: pin 12 of the LCD di splay (D5) > pi n 10 of the Ardui no (PWM)
Connect: pin 13 of the LCD di splay (D6) > pin 11 of the Ardui no (PWM)
Connect: pin 14 of the LCD di splay (D7) > pi n 12 of the Ardui no (PWM)

THE CODE
Now open a new sketch i n the Ardui no edi tor, copy-paste thi s code and upload it to the Ardui no:
Selec t c ode
#inc lude
LiquidCry s t al lc d(7, 8, 9, 10, 11 , 12);
void s et up() {
lc d. begin(16, 2);
lc d. s et Curs or(0,1);
lc d. writ e(" LIGHT: " );
}
void...
tracking img