Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

Lcd With Ez-B

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

#6  
thanks for the info;)
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;)
United Kingdom
#7  
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.
United Kingdom
#8  
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 ARC. 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.
United Kingdom
#9  
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.
United Kingdom
#10  
OK, spent the best part of today playing with this display and figured it all out now.

Positioning of text is simple when you think about it (I think I may have been getting mixed up on the X and Y)

However, one thing I've noticed and I hope someone can point me in the right direction or explain it is this...

If a servo is being held and SendSerial is executed the servo will twitch. Not every time but a lot of the time. I have my test bot displaying the current ping along with the current time on the display, updated every 500ms. The sweep servo is held at 20 but twitches every second or so.

Is it the display causing this or is it a general occurrence?
United Kingdom
#12  
That is the same one, same auction, same everything.

Simple to wire up

Code:


EZB LCD Colour
VCC VCC Red
GND GND Black
SIG RX White


Then plug it in to a digital port on the EZB

Excuse the poor quality it was taken quickly

User-inserted image


Just make sure it comes with an LCD, that picture is of just the "backpack" (or LCD driver)
United Kingdom
#14  
Example Script #1 (yes there will be more)

Code:


# LCD Script Examples
# Time Date

$baud=9600
$port=D14

# Clear the screen and turn off the cursor and position top left
SendSerial($port,$baud,CL,CS0,TP,0,0)
Sleep(100)

# Display welcome message
SendSerial($port,$baud,TP,3,0,TT,"EZ-Builder",0)
Sleep(500)
SendSerial($port,$baud,TP,3,1,TT,"Connected",0)
Sleep(1500)

# Time and Date
SendSerial($port,$baud,CL,TP,1,0,TT,"Time and Date",0)
Sleep(1500)
SendSerial($port,$baud,CL,TP,0,0,0)
# Display Time on Line 1
:loop
SendSerial($port,$baud,TP,6,0,TT,":",0)
# Format the time
# Convert to 12 hour
IF ($hour>12)
$timehour=$hour-12
SendSerial($port,$baud,TP,10,0,TT,"PM",0)
ELSE
IF ($hour=0)
$timehour=12
ENDIF
SendSerial($port,$baud,TP,10,0,TT,"AM",0)
ENDIF
IF (Length($timehour)=1)
SendSerial($port,$baud,TP,4,0,TT," ",0)
SendSerial($port,$baud,TP,5,0,TT,"$timehour",0)
ELSE
SendSerial($port,$baud,TP,4,0,TT,"$timehour",0)
ENDIF
IF ($minute<10)
SendSerial($port,$baud,TP,7,0,TT,"0",0)
SendSerial($port,$baud,TP,8,0,TT,"$minute",0)
ELSE
SendSerial($port,$baud,TP,7,0,TT,"$minute",0)
ENDIF

# Display Date on Line 2

# Format Date UK Style
IF ($day<10)
SendSerial($port,$baud,TP,3,1,TT,"0$day/",0)
ELSE
SendSerial($port,$baud,TP,3,1,TT,"$day/",0)
ENDIF
IF ($month<10)
SendSerial($port,$baud,TT,"0$month/",0)
ELSE
SendSerial($port,$baud,TT,"$month/",0)
ENDIF
SendSerial($port,$baud,TT,"$year",0)
WaitForChange($second)
SendSerial($port,$baud,TP,6,0,TT," ",0)
WaitForChange($second)
Goto(loop)





There may be a better way to format the time & date, I haven't spent long looking in to that but the above way works. It also updates every second with a blinking . which could be changed for every minute if it is eating up the communications.

As always, easy to change for your LCD, port and baud are variables at the top of the script.

As much for reference in to doing anything than as an example for making a clock.

Edit: Minor bug fix made to hour when changing to single digit would have left the leading 1.
United Kingdom
#16  
All code I post will work:)
United Kingdom
#18  
I'm still having the servo twitch issue, even on the new LCD that come today.


I guess I will be moving over to I2C for the new one, hopefully that'll avoid these slight issues (they make Melvin look like he has gone insane).
Netherlands
#19  
Lovely music:D
#20  
weird.

im thinking noise on the ports.

could be that ur ez-b is one of the odd ones.
United Kingdom
#21  
Happens on both EZ-Bs dude. Not a problem, I put the new LCD in I2C mode for Melvin and this one can be put in to I2C mode and I assume the commands are as straight forward. Frees up a digital port too so it's win win.

Just wanted to flag it up since I'd not heard anything about the issue.
#22  
ok fair enough.

you should make your own website for posting projects you've made and posting ideas and scripts.
United Kingdom
#24  
I don't have time to do that, besides it's all on here where everyone can find it:)

Once Melvin is finished (if he ever get's really finished but I suspect he will forever be having upgrades) I may throw the details on a site but for now I don't even have the time to update any of my other sites.
#25  
I'm currently in the process of making one. totally free. will post my projects and tips on it.

thanks so much for the scripting Rich.