Pages: [1] 2   Go Down
Author Topic: LCD and matrix keyboard - which library?  (Read 2118 times)
0 Members and 1 Guest are viewing this topic.
Croatia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

first, sorry for my bad english  smiley-confuse I'll hope somebody will understand what I need help for.
I'm newbie in Arduino but not in electronics.
I'm developing project for local swim club (my daughter is a member). It is a training light, it is 25 LED at bottom of swimming pool (every meter is a LED). Swim trainer had to input total swim time and number of pool pass and press a button to start. Swimmer swim and watch LED's at the bottom and try to keep his speed accordingly to LED moving speed.

Led's will be controlled via 4pcs. of HC595 (I hope so)  smiley-roll
Delay of led moving will be (input time/number of pass)/25. Number of led on/off's will be 25 x number of pass.
LCD display will be 16x2, keyboard is 3 columns 4 rows - numeric only. What I actually need help for is how to interact keyboard and lcd.
Operator will be noticed on screen to input total time, first minutes (he must write one or two number on keyboard and see it on screen, when input is ok than press * button to move on). Than it must input number of pass (also he must write one or two number on keyboard and see it on screen, when input is ok than press *).
I don't have idea how to do that, is there any library or example how to do that or something similar? I saw lot of devices that have this way of input numbers but never seen any Arduino sketch having such thing.

Hope somebody will understand what I need and help me...  smiley-sweat
This is commercial and very expensive (for local kids swimming club) machine
http://www.myrthapools.com/eng/virtual-trainer.htm
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look in the Development / Other hardware development section. I think liudr might have just what you are looking for.
Logged

Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi
May be i can help you.
I am using a LCD and matrix key board in some proyects
for LCD i have used lyquidcrystal.h library and for the matrix keyboard Keypad.h
I thing are easy to use whit the samples and information that you find in play ground but if you need more help tell me
Logged

Croatia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i'm using those two libraries. I can write on LCD and read form keyboard. But I need some higer level of interaction. And I'm not experienced to program it on my own
Logged

Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok so what kind of interaction??? becouse i don´t understand so well, what you need.
Logged

Croatia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

example what operator must do:
a text on LCD is written "Total swimmer time"
After a second "enter minutes"
operator push one or two buttons on keyboard and numbers are displayed on LCD. Arduino waits for * button to continue or # button to erase a wrong entered number.
After that display shows "enter seconds" and same procedure as before. It will be even better if operator can enter minutes and seconds in format MM:SS and arduino can receive that.
How can I program that ?
Logged

Cadiz (Spain)
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ok step by step

1 LCD
with the lyquidcrystal library you declare that you are using a lcd variable the name is lcd and the pin conection inside the setup() funtion:

Code:
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(41,37,49,47,45,43);


then in the loop funtion you can print like in your serial monitor:
Code:
  lcd.print("hello, world!");

so if you want one way could be

print something
use millis() for count the minute
print another thing

2 keypad

you read the key in a variable so if you use switch- case (you can read a little in reference,if you are not used with this)
so you define a variable key,where you read the key push

char key = keypad.getKey();
and one switch case that works like a menu
switch (key){
case'*':
your code for go on////continue
return;
case'#':
your code ///// print error and go where you need
return;
default:    ///// this is went one key is pressed and it is not necesary,imagine you only need for your code key * and # and someone press number 1
your code//// print invalid stay waiting
return;
}


i hope this help you
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7198
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul,

Thanks for mentioning me.

flega,

What about this thing?

http://www.inmojo.com/store/liudr-arduino-and-physics-gadgets/item/serial-lcd-back-pack---phi-panel/

It is the easiest to program with since you need no library, just do serial.print and serial.read. Both LCD and keypad are connected to the back pack. There are many sample projects for inputting numbers and etc. available.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello.

I just finished doing a trial run with the 20x4 LCD display:  http://www.web4robot.com/SerialLCD.html

It connects via I2C and it includes a simple keyboard interface.  Will support individual keys as well as a matrix.

It took me some time to locate a current lib, but finally found this one that worked:  http://www.web4robot.com/files/LCDI2Cw.zip

The lib should also support the 16x2 LCD which accorindgin to the web page also includes the keyboard interface.

Very simple to use, just two resistors to connect the I2C line, and the keyboard connects directly to the LCD controller.  No other logic is needed.  The instruction sheet is here: http://www.web4robot.com/files/SerialLCDCtrN.pdf


Hope this answers your question.

-al-


Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7198
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello.

I just finished doing a trial run with the 20x4 LCD display:  http://www.web4robot.com/SerialLCD.html

It connects via I2C and it includes a simple keyboard interface.  Will support individual keys as well as a matrix.

It took me some time to locate a current lib, but finally found this one that worked:  http://www.web4robot.com/files/LCDI2Cw.zip

The lib should also support the 16x2 LCD which accorindgin to the web page also includes the keyboard interface.

Very simple to use, just two resistors to connect the I2C line, and the keyboard connects directly to the LCD controller.  No other logic is needed.  The instruction sheet is here: http://www.web4robot.com/files/SerialLCDCtrN.pdf


Hope this answers your question.

-al-




Do you know how much extra memory the I2C Lcd library is using on your arduino? Do you know the library will be maintained and updated for new arduino versions? Do you think one has to struggle through similar set up process as yo had? smiley-wink

The real quality serial Lcd like mine raises none of the above questions.smiley Only the cheap ones do.

FYI, there are over 3,000 lines of C++ code on my serial lcd, that alone means something.
Logged


Croatia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul,

Thanks for mentioning me.

flega,

What about this thing?

http://www.inmojo.com/store/liudr-arduino-and-physics-gadgets/item/serial-lcd-back-pack---phi-panel/

It is the easiest to program with since you need no library, just do serial.print and serial.read. Both LCD and keypad are connected to the back pack. There are many sample projects for inputting numbers and etc. available.

I think this is right thing for me! I have read most stuff on your blog and this is really good work, not expensive too. It is best that it use only two pins on arduino and no memory. I'll buy it today!
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7198
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Alright then! There might be a bit delay with some of my parts being restocked.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you know how much extra memory the I2C Lcd library is using on your arduino? Do you know the library will be maintained and updated for new arduino versions? Do you think one has to struggle through similar set up process as yo had? smiley-wink

The real quality serial Lcd like mine raises none of the above questions.smiley Only the cheap ones do.

FYI, there are over 3,000 lines of C++ code on my serial lcd, that alone means something.

Well, you do have a nice solution there.  Being a bit new to Arduino, some of your questions I can not fully answer. But I do know the default .print libs use a tremendous amount of time, and in some programs would be unsuitable to be part of the main loop.

I think there are many ways to approach a given problem, glad to see you have one so well thought out smiley

-al-
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7198
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

But I do know the default .print libs use a tremendous amount of time, and in some programs would be unsuitable to be part of the main loop.
What amount of time are you talking about? What's going on in your main loop?
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Noting to do with what is in 'my' loop, this is simple the default libs.   

try the following:

Code:
/*
  Testing timing needed for Serial output
 
     RS-232  vs I2C using common libs.
     
     
 */
 
// include the library code:
#include <LCDI2Cw.h>
#include <Wire.h>

#define LOOP_COUNT    100        // Do 100 examples of each output and time the total time needed.

long  I2C_TIME;
long  SERIAL_TIME;


unsigned char i2cAddress = 0x4C;  // LCD module I2C address

// initialize the library with the number of columns and rows
LCDI2Cw lcd(20, 4, i2cAddress);

void setup() {
  // Set up the Output ports.
  lcd.begin();
  Serial.begin(9600);
   
 
}

void loop() {
 
  // Do the I2C 1st
 
  I2C_TIME = millis();
  for (int i=0; i <= LOOP_COUNT; i++) {
      lcd.print("  hello, world!  ");  // Print a message to the LCD.
      lcd.print(i);
      lcd.keypad();                    // Just check if there is any LCD key pressed.
 
  }
  I2C_TIME = millis() - I2C_TIME;
 
 
  // Now do RS-232 output
 
  SERIAL_TIME = millis();
  for (int i=0; i <= LOOP_COUNT; i++) {
      Serial.print("  hello, world!  ");  // Print a message via the RS-232.
      Serial.println (i);
      Serial.available();                 // Just check to see if a serial key is available.
  }
   SERIAL_TIME = millis() - SERIAL_TIME;
   
   
  // set the cursor to line 1, column 0
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  lcd.print("I2C Time = ");
  lcd.print(I2C_TIME);

  lcd.setCursor(0, 2);
  lcd.print("Serial Time = ");
  lcd.print(SERIAL_TIME);
 
  Serial.print("I2C Time = ");
  Serial.println(I2C_TIME);
  Serial.print("Serial Time = ");
  Serial.println(SERIAL_TIME);
 
}


You will see that with default setting the Serial.print function takes almost 7x the time as the I2C functions.  (No need to connect an I2C for the above to run, just give it a try).

Now of course one could play with the serial timing - bump it up to 57,600 and close the gap, but then the I2C could also be bumped up from the default 100Khz to Fast-Mode (400Khz).  But now we are into the 'modifying' space on both serial attachment methods. 

For many application this likely will be a non-issue.  But if one is doing any type of process control, the time needed to update the display can be a factor.  It all depends on the application. . . .

-al-
Logged

Pages: [1] 2   Go Up
Jump to: