Lcd With Ez-b

 
#1

hi i am new to ez-b and whole robotics world but i would like to add a lcd screen to ez-b i have no idea how to do it can someone explain how to do it from start and how enter scripts on lcd thanks

#2

Hello! Welcome Smile

Start by reading this: http://www.ez-robot.com/Tutorials/Hardware.aspx?id=13

There is a link at the bottom to search for compatible devices. Well, the search is accurate as it can be. Many eBay sellers lie or post confusing information. You want Serial/TTL ... That means the LCD at mininum would have an RX

You'll find thousands of LCD's for "arduino". And they will require 8 or 16 wires. They also will require a kabillion lines of confusing code. They will also take up the entire processor capability of the Arduino. So stay away from those! The seller will write a description to have you buy it........ but you won't be able to use it. ever Smile

#3

okay but in the tutorial you talk about only 3 wires (Power, Gnd, Power) in the ebay links they have 5 (GND, SS, SCL/SCK, RX/SDA/SDI, VCC) which one will go in the ez-b board thank you here is a link of the lcd i am thinking of buying

http://www.ebay.com/itm/Serial-UART-I2C-SPI-Adapter-White-Blue-1602-LCD-for-Arduino-PIC-AVR-/370662529906?pt=LH_DefaultDomain_0&hash=item564d355b72

#4

There are a lot of misleading items on ebay. Its easier to keep away from anything that says I2C.

#5

@metaelp97, that LCD will work great! Smile Good find!

You care about the UART mode. So check the manual to ensure the jumper is set for UART.

- Connect the VCC to +5 on EZ-B
- Connect the GND to GND on the EZ-B
- Connect RX to any digital port on the EZ-B
- Use the SendSerial() command to send data to the respective port at the LCD's specified baud rate

Voila Smile

#6

I just bought one myself Smile Been looking for ages for something that works but only ever found the same rubbish I got before which was I2C and had no documentation with it.

@DJ is the SendSerial example in the script manual correct?
"SendSerial(0x09, 'n', 0x00, 244, "This is text"Winky"
or should it be more like
"SendSerial(D1, 38400, "This is text"Winky"

#7

thanks for the info Winky
i will buy that right away i actually thinking of buying 2 and could you give me and example text code for that lcd like "hello world" because i dont really know how to enter texts on ez script and it would be nice if you can tell me how to do tricks like moving "hello world" text to side to side or display diffrent informations

one last thing how can i set the lcd to uart i couldn't find the info i need so it would mean a lot to me if u can tell me here

thank you again Winky

#8

Since I've also bought the exact same item you can expect some examples once mine turns up.

For now though, I will be reading the manual (download here) and figuring it all out.

#9

OK mine turned up today (typically since I ordered a different one yesterday which should be here tomorrow but never mind).

The LCD has it's problems;
1. Connecting to Melvin on port D7 (I don't think the port was the issue) sent Melvin insane... When sending commands to the LCD his neck would on occasion judder (ports D1 & D2) and on one occasion I lost connection and had a frozen EZ-Builder. That said, it's been working fine on Test Bot. (Any ideas why that happened? More than once too.)

2. The commands in the manual are not exactly clear. They look it but when using them it's a whole different ball game.


First of all, there is no mention in the manual that once you are in TT mode that you can't get out of it. For instance;

Code:

SendSerial(D7,9600,TT)
SendSerial(D7,9600,"Hello World")


works great and outputs Hello World on the display.

Follow it up by trying to clear the screen (CL) and you end up with Hello WorldCL on the display.

After a while I stumbled upon using;

Code:

SendSerial(D7,9600,0)


to exit the mode. All commands after this seemed to work... kinda.


The next problem is positioning the text. For my scripts I need to set the static text in 1,1 and 1,2 for the 2 lines. Set static text at 16,1 and 16,2. Then update the variable written at 12,1 and 12,2.

But, the position text command (TPxy) doesn't quite work right. I have no idea at the moment how it works. Using 00, 11, 0,0, or 1,1 doesn't seem to put text in the top left. I thought I had some sucess with 0001 to put it in the top left but when looping it showed that it was coincidentally in the top left anyway, the command was doing nothing.

A bit more playing around and it seemed to be OK with this;

Code:

SendSerial(D14,9600,TP0001)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"ProxSence: $proxsense")
SendSerial(D14,9600,0)
SendSerial(D14,9600,TP0002)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"ProxClose: $proxclose")
SendSerial(D14,9600,0)



Or almost... It would cut the first character off and the lines were around the wrong way... Using 0101 and 0102 didn't give anything like the desired results either...

I did, however have great results doing things the long way... this "Hello World" animation works fine but as much as I like coding I will not be writing any scripts like this if I can help it.

Code:


:helloworld
SendSerial(D14,9600," H")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HE")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HEL")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELL")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO W")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO WO")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO WOR")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO WORL")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO WORLD")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," HELLO WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"HELLO WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"ELLO WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"LLO WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"LO WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"O WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"WORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"ORLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"RLD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"LD ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,"D ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600," ")
SendSerial(D14,9600," ")
Sleep(250)
SendSerial(D14,9600,0)
Return()



Honestly, there must be an easier way. And I will find it. But bear with me on it, I need to play a bit more.

What I do know is I'm glad I ordered the I2C one yesterday, which has easy to understand instructions. I will use that one in Melvin and use this one in something else, or just play around with it.

Keep your eyes peeled for more on this though, I wont give up on it... yet...


Edit: It's on D14 on Test Bot hence the change in port number halfway through.

#10

OK, I have sorted it out. I just needed to step back, have a coffee and then have another go (see how easy it is to blame the device when it was user error?).

The commands are;

CL = Clear Screen
CS0 = Turn Off Cursor
CS1 = Turn On Cursor
BL0 = Turn Off Backlight
BL1 = Turn On Backlight
TP,x,y = Position Text. Example SendSerial(D14,9600,TP,3,1) - Top left = 0,0 bottom right = 15,1
TT = Text Entry
0 = Exit modes.

Quick Example, I will work on more now;

Code:


# LCD Script Examples
# Baud 9600
# Port D14

# Clear the screen and turn off the cursor and position top left
SendSerial(D14,9600,CL)
SendSerial(D14,9600,CS0)
Sleep(100)

# Display welcome message
SendSerial(D14,9600,TP,5,0)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"MELVIN")
SendSerial(D14,9600,0)
SendSerial(D14,9600,TP,4,1)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"START UP")
SendSerial(D14,9600,0)
Sleep(3000)

# Clear The Screen
SendSerial(D14,9600,CL)
Sleep(100)

# Position Some Text
SendSerial(D14,9600,TP,0,0)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"SAMPLE1")
SendSerial(D14,9600,0)
Sleep(100)
SendSerial(D14,9600,TP,0,1)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"SAMPLE2")
SendSerial(D14,9600,0)
Sleep(100)
Sleep(3000)

# Clear The Screen
SendSerial(D14,9600,CL)
Sleep(100)

# Animate Some Text
$posx = 0
:loop
SendSerial(D14,9600,CL)
SendSerial(D14,9600,TP,$posx,0)
SendSerial(D14,9600,TT)
SendSerial(D14,9600,"*")
SendSerial(D14,9600,0)
IF($posx<16)
$posx=$posx+1
Sleep(100)
Goto(loop)
EndIf



Another example of how to make it do it's thing is;

Code:


SendSerial(D14,9600,CL,TP,2,0,TT,"Hello World",0)



That way saves having to write out all of the SendSerial lines.