16x2 LCD nearly works - but has a few strange characters. Why???


hi everyone,

i beginner please excuse lack of knowledge how lcd's work (let alone i2c lcd's).

project aim:
display serial number of rfid tag onto 16x2 i2c lcd.

hardware:
1) arduino uno smd r2;
2) innovations id-20la rfid reader , 1 rfid card (to wave in front of it);
3) 16x2 serial clear victory 1602-1 lcd module i2c backpack (gy-iiclcd).  both cheap off ebay;

software:
1) arduino ide 1.0.5 (and use serial monitor display rfid card number);
2) new liquidcrystal library (by f malpartida).

what happens:
when wave rfid card in front of rfid reader, beeps indicate successful read, rfid card number displayed via serial monitor correctly, when appears on lcd screen has 1 x strange character before it, , 3 strange characters after it.  the actual rfid number in between strange characters correct however.

my code:
as new, found 2 pieces of code , put them try , achieve aim - did not write of it.  i assume there problem in way have combined 2 sketches.  code below:

code: [select]
/* yourduino.com example software sketch
16 character 2 line i2c display
new type marked "arduino-iic-lcd gy-lcd-v1"
terry@yourduino.com */
/*-----( import needed libraries )-----*/
#include <wire.h>
#include <lcd.h>
#include <liquidcrystal_i2c.h>  // f malpartida's newliquidcrystal library
#include <softwareserial.h>
softwareserial id20(3,2); // virtual serial port
char i;


/*-----( declare constants )-----*/
#define i2c_addr    0x20  // define i2c address pcf8574a
//---(following pcf8574 pin assignments lcd connections )----
// different earlier/different i2c lcd displays
#define en_pin  4
#define rw_pin  5
#define rs_pin  6
#define d4_pin  0
#define d5_pin  1
#define d6_pin  2
#define d7_pin  3


/*-----( declare objects )-----*/  
liquidcrystal_i2c  lcd(i2c_addr,en_pin,rw_pin,rs_pin,d4_pin,d5_pin,d6_pin,d7_pin);

void setup()   /*----( setup: runs once )----*/
{
 lcd.begin (16,2);  // initialize lcd
 serial.begin(9600);
 id20.begin(9600);

}// end setup

void loop()   /*----( loop: runs on , on again )----*/
{

// reset display  
 if(id20.available())
   {
   i = id20.read(); // receive character id20
   serial.print(i); // send character serial monitor
   lcd.print(i);
   }


} // end loop


any feedback appreciated.

i have attached photo of lcd screen looks (note single garbage character before , 3 garbage characters after correct rfid card number).

best regards
john

it looks you've done job of getting lcd communicate , display.  suspect serial input source of garbage characters.

have checked output = id20.read(); // receive character id20 ?

are garbage characters same?  check incoming string , ignore characters or ignore characters not alpha-numeric?


Arduino Forum > Using Arduino > Displays > 16x2 LCD nearly works - but has a few strange characters. Why???


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support