You are on page 1of 9
srtano%s LCD KeyPad Shield For Arduino SKU: DFR00OS - OFRobet Electronic Product Wik and Tutor Arduino and Robot WiKI-DFRobot com LCD KeyPad Shield For Arduino SKU: DFROO09 Il Contents 1 Inroduetion 2 Specitication 3 Pinout 4 Library Explanation 4.1 Funetion Explanation 5 Tutorial 5.1 Example 1 5.2 Example 2 5.2.1 Connetion Diagram (ntps:/iwwn.tobol.comproduct-51.htmi) 5.22 Sample code 1602 LCD Keypad Shield For Arauino 5.2.3 Result (htipslinww.dfrobot.comiproduct-5.htm) 6 Trouble shooting 7 More Introduction This isa very popular LCD Keypad shield for Arduino (htipsiliwwy.cfrobot.comiproduct-51.himl) or Freeduino board. It includes & 2x16 LCD display and & momentary push buttons. Pins 4 6,6, 7, 8, 9 and 10 are used to interface with the LD. Analog Pin O is. sed to read the push buttons, The LCD shield supports contrast adjustment and backit on/off functions. It also expands analog pins for easy analog sensor reading and display. ‘The LCD Keypad shield is developed for Arduino compatible boards (hips:livwwrdfrobol.conveategory-104 him), to provide a User-frienly interface that allows users to go through the menu, make selections et. It consists of a 1602 white character blue backlight LCD. The keypad consists of § keys — select, up, right, down and lef. To save the digtal IO pins, the keypad interface uses only one ADC channel, The key value is read through @ § stage voltage divider, Specification © Operating Voltage:5V © 5 Push buttons to supply a custom menu control panel © RST button for resetting arduino program © Integrate potentiometer for adjusting the backlight © Expanded avaliable VO pins © Expanded Analog Pinout with standard DFRobet configuration for fast sensor extension © Dimension: 80 x 88 mm Pinout htpsshwww-dtrobot.comiwikiindex phpiLCD_KeyPad_Shield_For_Arduino_SKU:_DFR0009 19 sitanos Lep_tcab02 Module (Controled by Digital Pin D4~D9s i 2 RSDS LCD KeyPad Shield For Arduino SKU: DFR00OS - OFRobet Electronic Product Wiki and Tutor Arduino and Robot WKI-DFRobot com Lop Potentioneter | Progransing E09 87:07 DBL:Db DBS:D5 DB4:DY RU:GND Contrast In Circuit Serial apcest 5 Keys connect to ‘analog Input Ao has been occupied Apalog Pin (AD=AS) with Gnd and Power Ao“has been occupiec Instruction for D4 To D10 and Analog Pin 0 Pin Function Digital 4(04) Diam S(08) D4-D7 are used as Digital 6(06) DB4~DB7 Digital 7(07) Digital 9(08) RS Digital 9(08) Enable Digital 10(010) LCD Backlight Control Analog 0(A0) Button select Instruction Four high order bidirectional tristate data bus pins. Used {for data transfer and receive between the MPU and the LCD. Choose Data or Signal Display Starts data readiwrite Select, up, right, down and left (wikilindex.phpiFile;DFROO0S-PINZ.png) Library Explanation Function Explanation LiquidCrystales, enable, 4, d5,d6, 47) Creates a variable of type LiquidCrystal. The display can be controlled using 4 or 8 data lines I the former, omit the pin numbers for d0 to d3 and leave those lines unconnected. The RW pin can be tied to ground instead of connected to a pin on the Arduino; if ', omit it from this function's parameters. for example: Liguidcrystal 1ed(8, 9, 4, 5, 8 75 led.begin(cols, rows) Initializes the interface to the LCD screen, and specifies the dimensions (with and height) ofthe dsplay. begin() needs to be called before any other LCD library commands.for example: ed. begin(16, 2); htpsshww-dtrobotcomiwikiindex phpiLCD_KeyPad_Shield_For_Arduino_SKU:_DFR0009 29 srtano%s LCD KeyPad Shield For Arduino SKU: DFR00OS - OFRobet Electronic Product Wiki and Tutor Arduino and Robot WKF-DFRobot com led.sotCursor(col,row) ‘Set the location at which subsequent text written to the LCD will be displayed. for example: ed, setCursor(0,0); led. print(data) Prints text to the LCD. for example: Led.print(*hello, worle!"); led.write(data) Wiite a character to the LCD. More function can see: * qurystal brary (ntos:/gthub con/Cain2LiquldCrstalrawimasterLiqudCrystal2i) Tutorial Example 1 This example wil test the LCD panel and the buttons. When you push the button on the shield. the screen will show the corresponding one. Connection: Plug the LCD Keypas to the UNO(or other controllers) htpshwww dtrobotcomiwikiindex phpiLCD_KeyPad_Shield_For_Arduino_SKU:_DFR0003 a9 srtanos LCD KeyPad Shield For Arduino SKU: DFRO0OS - OFRobet Electronic Product Wik and Tutor Arduino and Robot WKF-DFRobot com Mork Bramwell, July 2018 This program wilt test the LCD panel and the buttons.tihen you push the button on the shield. the screen will show the corresponding one. Connection: Plug the L&D Keypad to the UND(or other controLlers) seeeesesesteceeteneneteesestsnneseneneseseeeieseeneteteesestarersesenenesenenetenenst/ include Liquidcrystal 1e4(8, 9, 4, 5, 6 5 UZ select the pins used on the LOD panel U1 define some values used by the panel and buttons int ledkey = 8; Ant ade“key_in = 8; define benRIGHT define brn ‘define benDoaN define benLEFT define benseLect ‘define benNon Ant read_LCo_buttons(){ U1 read the buttons adc Key_in = analogread(@); _—_// read the value from the sensor // my buttons when read are centered at these valies: @ 144, 329, S04, 741 1 we add approx 58 to those values and chech to see if we are close 1 We make this the 1st option for speed reasons since 4t will be the most Likely result Af (ade_Key_in > 1000) return benNones 11 For Vit us this threshold AF (ade_key_in < 58) return btnRIGHT; Af (ade_key_in < 250) return btn; AF (ade_key_in < 450) return btnbObN AF (ade_key_in < 650) return btnLEFTS Af (ade_key_in < 858) return benSELECTs U/ For V1.8 conment the other threshold and use the one below: ie if (ode_hey_in < 50) return benRIGHT; if (ade hey in < 195) return benuP; if (ode hey in < 380) return benDOMW; Ef (ode_hey_in « 555) return beaLEFT; if (ode_hey_in < 798) return btaSELECT; ” rretuen btanoNe; // when all others Foil, return this. > void setup({ ed. begin(36, 2); UW start the Library ed. setcursor(®,0); W/ set the LED cursor position lcd.print("Push the buttons"); // print a simple message on the LCD y void 1o0p()¢ led. setcursor(3,1); // move cursor to second Line "1" and 8 spaces over led. print(ailis()/1000); // display seconds elapsed since power-up Led. setcursor(@,1); 1 move to the begining of the second Line hpshww dtrobot com/index php .CD_KeyPad_Shild_For_Arcuino_SKU:_DFR0009 49 artanos LCD KeyPad Shield For Arduino SKU: DFR00OS - OFRobet Electronic Product Wik and Tutor Arduino and Robot WKF-DFRobot com led key = read_Lco_puttons(); // read the buttons suiten (led key)< // depending on which button was pushed, we perform an action case beaRIGHT:( 17 push button "RIGHT" and show the word on the screen ed.print ("RIGHT"); break; case DEALEFT:{ cd.print(*LEFT "); // push button “LEFT” and show the word on the screen break: case btnuP:{ ed. print ("UP break; push button “UP” and show the word on the screen case btavOw:{ ded. print(“D04N break; /7 push button “DOKN” and show the word on the screen case DUNSELECT:( ed. print *SELEC break; 11 push button “SELECT” and show the Mord on the screen case btoNONe:{ Led.print ("NOME "); // No action wit show “None” on the screen break; Example 2 This example shows that reads an analog input on pin 1, prints the result to the LCD. This program t M35 for example. £05 the temperture sensor What you need 1, DFR¢uino UNO R3 (hitps:tivww.dfrobot.com/product-838. html} 2, LCD Keypad Shield For Arduino (https:/¥nvw.cfrobot.comiproduct-51.himl) 3, Analog Linear Temperature Sensor (hitps:iwww.dfrobot.comiproduct-76,ntml) Connection: Plug the LCD Keypad to the UNO(or other controllers) Temperture sensor: S(blve) ~ A1() Note: Ad has been occupied. veo(ted) - veo GND(black) - GND Tricks for changing sensor cable pin mapping (hitp:/iwww.dfrobot.com/communityitrick-for-changing-sensor-cable-pin- ‘mapping.htr) Connection Diagram htpshwww dtrobotcomiwikiindex phpiLCD_KeyPad_Shield_For_Arduino_SKU:_DFR0003 59 sitanois LCD KeyPad Shield For Arduino SKU: DFR00OS - OFRobet Electronic Product Wik and Tutor Arduino and Robot WiKI-DFRobot com Se se, CRUEL (Owikfindex phy [DFRO009%28LM35 png) ‘Sample code htpsshwww-dtrobotcomiwikiindex phpiLCD_KeyPad_Shield_For_Arduino_SKU:_DFR0003 69 srtanos Description ‘Reads on analog input on pin 3, prints the result to the LCD. This program takes the tenperture sensor LIBS for example. connection Plug the LCD Keypad to the UNO(or other controters) Temperture sensor: S(blue) ~~ A1() Note: A® has been occupied. vec(red) ~~ vee nDcoLack) -- no include Lquidcrystal 1eé(8, 9, 4, 5, 6, 7); U/ select the pins used on the LOD ponel unsigned long tepriner 5 void setun(){ ed. begin(1s, 2)3 U1 start the Library y void 100p()¢ Led. setCunsor(®, 0)5 U/ set the LCD cursor position Ant val 1 vartable to store the value coming from the analog pin double data; // variable to store the temperature value coming from the conversion valeanalogtead(2); 1/ ead the analog in value: data = (couble) val * (5/10.24); 1/ tenperature conversion formita Af(@121s() - teptiver > 580){ U/ output 0 temperature value per S0Qes tepriner = nillis(); U1 print the results to the Led Led. print ("Ts") cd. print(data); ed. print(*C"); Result htpshwww dtrobotcomiwikiindex phpiLCD_KeyPad_Shield_For_Arduino_SKU:_DFR0003 LCD KeyPad Shield For Arduino SKU: DFRO0OS - OFRobet Electronic Product Wik and Tutor Arduino and Robot WKF-DFRobot com 719 sig2018 LCD KeyPad Shield For Arduino SKU: DFR000S - OFRobet Electronic Product Wiki and Tutor Arduino and Robot WKF-DFRobot com ‘(wikvindex.phpFle:DFR0009%28TEM,Jpg) Trouble shooting {Q1. Why my LCD keypad cannot display anything on the Intel Edison (hip:/faww. (wikvindex.phpiFle:Noxtredrectte-png)Go Shopping 1602 LCD Keypad Shield For Arduino (btas:www dfobot com/produet-51.htm! Category: DERobot (httss:/nww.dtrobot. com) > Sensors & Modules (https:/hmw.dfrobot.com/category-156.html) > LCDs, Categories (hwikilindex php/Special:Categories): Product Manual (jwklindex.php/Categary:Product_ Manual) DER Series (wikiindex.php/Category:DFR_Series) | Shields (!wikilindex.php/Category:Shields) LCDs (wikiindex.phpiCategory:LCDs) ‘This page was last modifed on 19 June 2017, at 10:01 Content is available under GNU Free Documentation License 1.3 orale (hitpsihwwn.gru.orglcopyleta. Mimi) unless otherwise noted renu FOL (htpsiwowgnu.orleopsetal html) ii (hww.mediawikorg) htpsshwww dtrobotcomiwikiindex phpiLCD_KeyPad_Shield_For_Arduino_SKU:_DFR0009 99

You might also like