arLCD - 320x240 color LCD with touch screen

Status
Not open for further replies.

PaulStoffregen

Well-known member
Randy from EarthLCD sent me an arLCD for testing with Teensy.

My first impression of arLCD it's a bit spendy, but you get quite a lot. It's a touch-sensitive 320x240 screen with 16 bit color. There's a GPU that runs separately. The GPU is controlled by serial communication, but it caches fonts, images, even strings, so the messages are short and pretty efficient. I'm actually pretty impressed with how well it performs.

It also has an Arduino ('328 AVR) clone on board. Honestly, for simple projects, you'd probably just use the built-in Arduino clone. Yeah, I should of course try to sell a Teensy, but for simple stuff the on-board AVR is probably fine. For more processor intensive work that's not practical on 8 bit AVR, like real-time music visualization, connecting a Teensy3 could be worthwhile? Maybe I'll give that a try after the upcoming Arduino board and library are released.......

When you first get the arLCD, it's on-board Arduino clone has "arLCDTest" programmed. The code is one of the many examples in their library.

arLCD_hardware_test.jpg
(on all these images, click for full size)

Of course, the thing I'm interested in doing is trying to use it from Teensy3.

First, you'll need these modified files: View attachment arLCD_library_modified.zip. These changes work on Teensy and also the build-in Arduino clone, and they probably also work on other boards. Hopefully EarthLCD will release these changes in a future version.

Before connecting Teensy, you need to program the on-board Arduino clone with a dummy program. The blink from File > Examples > 01.Basics > Blink is fine. As long as it doesn't use Serial.begin() or the library's begin() function, the built-in '328 chip will not drive the serial line, so you can connect a Teensy (or other board) to control the LCD.

It turns out the LCD is able to work fine by applying 5 volts from the Teensy for power. Here's how I connected it. Even though pins 0 to 6 are connected, only 0, 1 and 2 are actually used. 2 is for attachInterrupt() used by some of the examples.

arLCD_teensy3.jpg

Here it is running the "analogMeter" example. That blue trim-pot I connected is supplying the variable voltage to the A0 analog input.

arLCD_meter.jpg

The display can be really bright. My camera didn't capture this too well. It really does look very nice in real life.

One small caveat I ran into is the GPU's bootup time. If you just upload code to Teensy3, it works great. But at powerup, the GPU spends about 2 seconds booting up and displaying a splash screen.

I believe the GPU holds the on-board '328 chip in reset mode while it's busy. But if you connect an external board like Teensy to use the LCD, a delay is needed. Here's the modified setup() function for that analogMeter example.

Code:
void setup()
{
  lcd.begin( EZM_BAUD_RATE ); 
  lcd.cls( BLACK, WHITE );
  lcd.font("0");
  lcd.light(50);
  lcd.xy(55,0);
  lcd.printString("delay for LCD bootup");
  delay(2500);
  
  lcd.begin( EZM_BAUD_RATE );
  lcd.cls( WHITE );
  lcd.fontw( 1, "0" );
  lcd.string( 1, "ALOG_0" ); // stringId 1
  lcd.theme( 1, 155 ,152, 3, 3, 3, 1, 4, 5, 0, 16 );
  lcd.analogMeter( 1, xPos,yPos, width, height, option, 0, 0, 1023, 1, 1, type );
}

As it starts up, you'll see this for a brief moment before the analog meter appears. The delay could probably be less than 2.5 seconds. But without any delay, the GPU doesn't hear some of the initial setup.

arLCD_bootup_delay.jpg

Edit: the arLCD comes with those nice metal mounting posts that are conveniently flush with the surface of the display. It does not come with the screws. I added those as I was working with the display and adding the Teensy3, so the beautiful screen wouldn't rub and scratch on my well-worn workbench. One thing I really like is the holes are big enough for normal 4-40 or M3 screws (most LCDs have tiny holes), which is really nice for putting this display into a nicely assembled project.

If you do buy an arLCD, please tell them you saw it here. ;)
 
Last edited:
I just took it outside. Today is a fairly sunny day for October at 3pm, certainly not as bright as the height of summer, but it is clear and bright out there.

When I turned the LCD brightness up all the way, the screen is still readable, but not easily so, when sunlight shines directly on it. Of course, it's impossible to see anything if the glass directly reflects the sunlight into your eyes (yes, I managed to do that a few times while looking at it). When viewed with the display rotated so it's not getting sunlight directly shining onto the surface, it's pretty readable. Not as easily as indoors, but still ok.

I don't have any good way to measure, but that's my subjective opinion. It's pretty hard but not impossible to read with direct sunlight, and pretty reasonable but not as vivid and easy as indoors with indirect sunlight.
 
Hello all,

I picked up one of these at Microcenter on a whim because it looked like a neat addition to a project I'm working on. I didn't realize the serial port is utilized by the GPU. My project involves writing to the serial port and displaying data from it. It appeared my only option was the use of software serial but the device the project interfaces with requires ODD parity. |Is there a way to use ODD parity with soft serial?

As for brightness, this thing is nice and bright but I haven't tried it outside yet. I will try to get a decent picture of it in the sun tomorrow for those interested.
 
Last edited:
Are you asking about programming a Teensy connected to arLCD, or programming the Arduino Uno clone that's on the arLCD circuit board?

If you're using a Teensy 3.0, as I did in photos above, it has 2 more serial ports. Serial2 and Serial3 are available.
 
I should have been more specific. I was referring to the on board Uno since they tied up the hardware serial totally with the newest firmware release. I just read on the support email group that they are trying to come up with a solution by using the GPU. I really wish they would have gone with something like a Teensy or at least a Mega from the start. Isolating the product from outside comms seems like a major limitation. To get back to the main point I had planned on using software serial but was unable to resolve the issue of parity settings other than the default of none.
 
Last edited:
I ordered up a couple of Teensy 3.0s and would like to use them with my arlcd. They have since updated their library a bit. Would you consider modifying the current LCD library?
 
Well, looks Earth did not merge my edits the first time around. Is that right?

If they commit to merging the Teensy3 changes into their published code, I might redo this. But it hardly seems worthwhile to go through the effort again, if they're not going to merge it and I'll only have to keep redoing it over and over.

I really need to hear from Randy on this one.
 
Last edited:
Yea I see your point. It doesn't look like the edits are in the current release. I hope they do decide to merge it. I have been trying to use the arLCD to control a device and display information from it via RS232. They were kind enough to work on freeing up a serial port through the GPU but the delays are just too much. When my device responds to a button command and returns updated information for the display there is a delay that accumulates to the point the display has to catch up once the button is released. It would be nice to have the extra horsepower of the Teensy with the advantages their graphics system provides. Then again it could very well be me not knowing what the heck I'm doing. That's likely a safe bet. :p
 
Last edited:
Teensy3 should be perfect for that. There's 3 hardware serial points, all with proper interrupt-based buffering. You can send or receive stuff on the other 2 while using Serial1 for arLCD.

Hopefully Randy will chime in here regarding Earth's intentions with Teensy and arLCD. I'm willing to redo the code, but only if they're going to merge it. Otherwise, I think the best approach would be to recommend a different LCD (I do have a really nice one in mind, with a GPU, and it's about the same price as arLCD). Edit: But arLCD is really quite nice and has some great advantages.... if only Earth would be willing to merge the code.
 
Last edited:
Robermeyer, does the ezLCD313 have an Arduino library that would work with Teensy?

I just downloaded ezLCD313.zip and ezLCD313p.zip from this page, which was linked from here. Neither contains ANY .cpp or .h files, nor anything else that looks like a library which could be imported to Arduino and compiled with Arduino+Teensyduino.
 
As Randy has already mentioned to you, the arLCDLib has evolved a lot since you looked at it.
Considerable changes were made to it. See 2.11 Beta5 on the arLCD/Yahoo site.

Today is the first I have seen of your changes. Most of them are related to changing Serial to arSerial which are not of concern to me.
The other changes relate to the timeout function which testing has shown your delays are not usable. (To small)
Since timeouts are only in place to protect the application should something bad happen, having them long should not be an issue.
The commands end when the CR comes back, not related to timeout. With timeout too short various commands will fail what will seem randomly.
 
The ezLCD313 can simply be connected to the Teensyduino primary serial port and use the same arLCDLib files. No Arduino required.
The connections are the same for all of our ezLCD3xx displays. I am not clear on how you get to Serial1 so your library tweeks might be required.
You need to connect, TX, RX, RESETn, 3.3V and GND.

There is a new board called EarthMake+ that does it for you if you don't want to wire it up.
I would think connecting your Teensyduino would be a perfect match since the Arduino is redundant and much slower.
With the file system additions in 2.11 this would be a pretty nice combination.
 
One small caveat I ran into is the GPU's bootup time. If you just upload code to Teensy3, it works great. But at powerup, the GPU spends about 2 seconds booting up and displaying a splash screen.

I believe the GPU holds the on-board '328 chip in reset mode while it's busy. But if you connect an external board like Teensy to use the LCD, a delay is needed. Here's the modified setup() function for that analogMeter example.

The arLCD does not hold or change the Atmel CPU reset except when it is used to program the Atmel (FTDI emulation). The Arduino has a delay of ~3.5 seconds on reset. If the Teensy does not have that delay it will come up before the GPU expects. The GPU can reset the Atmel and/or Teensy by connecting IO1 to RESETn. Then in the startup file drive IO1 low and then high for 10msec and it will all be in sync.
"
CFGIO 1 OUTPUT
IO 1 LOW
pause 10
IO 1 HIGH
CFGIO 1 INPUT
 
Last edited:
Today is the first I have seen of your changes.

It's unfortunate Randy didn't forward my work to you. I put in a least a few hours editing the code and testing Teensy3 with arLCD, with the expectation we could look forward to have these 2 products work together nicely.

Most of them are related to changing Serial to arSerial which are not of concern to me.

I'm trying to understand what you mean by this? When you say it's "of no concern", does that mean you'd be willing to merge those changes into the arLCD library? Or does it mean you couldn't care less?

The change from Serial to arSerial, where arSerial can be either Serial or Serial1, is necessary for Teensy. On all Teensy boards, and on Arduino's Leonardo and Yun and others, "Serial" is a USB virtual serial port which can't be connected to those 2 pins on an arLCD. If the library can't adapt to using Serial1, then it's simply not possible to use Teensy with arLCD (nor Leonardo, Yun & others), because all the commands that ought to go to arLCD would be send to the USB port.

The other changes relate to the timeout function which testing has shown your delays are not usable. (To small)
Since timeouts are only in place to protect the application should something bad happen, having them long should not be an issue.

I tried to measure the timing and substitute code that would give the same timeouts. Looks like I got it wrong?

The trouble I saw was that the timeouts, at least in the code I edited weeks ago, were based on the number of times a busy loop executes. That's perfectly fine if the library always runs on the exact same AVR chip. But when running this code on a much faster ARM processor, like the one on Teensy 3.0, the loop will execute in less time, thereby shortening the timeout.

My intention was never to shorten or change the timeout length in any way. I only wanted to change it from depending upon the CPU speed to relying on Arduino's millis() function, so the timeout will remain exactly the same when the code runs on different Arduino compatible boards.

The ezLCD313 can simply be connected to the Teensyduino primary serial port and use the same arLCDLib files.

That's great.

But if arLCDlib is missing these changes, how could anyone who wants to buy a ezLCD313 expect to use it with a Teensy?

That's the main issue here. I made these changes so people could use arLCD or ezLCD with Teensy 3.0. Sadly, it seems Randy did not communicate these changes to you, and now much more development has happened on arLCDlib without these changes included, which means people can't use arLCD with a Teensy 3.0.
 
I have perhaps a silly question, so please bear with me.

For the price point involved, it seems that there are alternatives out there. Specifically, I would consider the combination of the $40 800x400 TFT, a optional $10 touch screen controller, and a $35 driver board to achieve something that on paper has better specs and which does much of the work in hardware for you. This combination does not come with a nice flush-mount system but offers a higher resolution. Mount the TFT in a appropriate enclosure and you have yourself a very sleek 5" touchscreen with a 800x400 resolution for about $80 (plus 4 analog pins your teensy 3 board).
 
Paul,
You and I are not in disagreement here. Randy keeps me busy pretty much 24/7. He is extremely busy as well. They say the squeaky wheel gets the grease. I got this link from Randy today with a discussion to look it. My comments were based on what I saw here. I did not do any testing of your library because of time constraints.
Since our library is way ahead of what you had it only makes sense to update the latest instead of me trying to backup 2 months and try and merge anything. I will not be making any changes to that library for a week or so. This would allow time to tweak the library and test it as the new formal release.

My comments of no concern means, I have no concerns about those changes. I see no reason your changes would not work. You probably have more idea of the impact on products beyond the arLCD than we do. Your timeout changes based on a timer make more sense but when your comments in the library indicate a delay of half year I am concerned. We only need 500ms delay max. However that comes out in your timer routine should work. The function waitforcrno means wait for CR with no time out. Your comments indicated you think we want a timeout.

Bottom line is if you make the updates to the new library I will test and release it if it gets done in time.
I will also release an app note showing how to connect the complete ezLCD3xx line to the Teensy including the startup files and libraries. With the 2.11 release we will be including the Arduino library with the ezLCD3xx products too.

Constantin,
Your solution is not the same functionality as an arLCD. The widgets and messaging for that solution is not complete. It's going to take a lot of work by the user to make it useful.
 
Last edited:
Since our library is way ahead of what you had it only makes sense to update the latest instead of me trying to backup 2 months and try and merge anything.

Ok, I'll give this another try. If I turn this around within the next week, it's not going to be forgotten or go unused, right?

Can you please post the latest code I should use?

EDIT: I do not have access to whatever yahoo group you're using. I do not even know its name. I found this, but nothing is visible and clicking the "Group Website" link says the page doesn't exist. Can you please post the zip file here? This forum allows zip files to be attached to messages. When replying, click the "Go Advanced" button, then the page will have a button you can use to attach a zip file. You can also email the code directly to me (paul at pjrc dot com), if it's confidential. But I'd prefer if you posted the 2.11 beta5 (or whatever version I should use as a starting point) zip file here, if that's ok?
 
Last edited:
Constantin,
Your solution is not the same functionality as an arLCD. The widgets and messaging for that solution is not complete. It's going to take a lot of work by the user to make it useful.

I just took a quick look. Limor & Kevin appear to have written a pretty nice Arduino library for this chip+LCD, which builds on top of their GFX library that provides a pretty complete set of drawing features. I imported the 2 libraries into Arduino 1.0.5 and both compile without error for Teensy 3.0. I don't have the actual LCD to verify if it actually works with Teensy3, but maybe I ought to buy one? I looked briefly at their code. It appears to be built very cleanly on top of the SPI library (no AVR SPSR & SPDR as many of their older libs... which work on Teensy3 anyway), so I'm pretty sure it will "just work" on Teensy 3.0 and any other Arduino compatible board with SPI.

So far, Adafruit's library has only 3 pretty minimal examples, whereas arLCD has many. It's not clear to me if Adafruit's code really leverages the GPU and display buffer for bitmaps or custom font. The code seems to GPU optimize only text with 4 sizes of a built-in font and basic shapes.
 
I don't have the actual LCD to verify if it actually works with Teensy3, but maybe I ought to buy one?

Adafruit order #391239 should arrive at your doorstep sometime next week. It's the least I can do after all you have done for the community here. Yet another project that you can add to the large stack you already have but if it works, it would fill a hole in terms of the product offerings that people can assemble with a Teensy 3. Merry Christmas, Fröhlicher Advent, Happy Hannukah, Joyous Kwanzaa, and all that. :D
 
Last edited:
arLCD2.11Beta5

Paul here is the latest beta version from the yahoo arlcd site.
i think it should be pushed to Github after the update. Are you familiar with that process?

we should consider making a cable to connect any ezLCD3xx to the Teensy.
what is that second ARM processor on the Teensy3.0 for?
How do you connect up the power? 5V or 3.3
 

Attachments

  • arLCD2.11Beta5.zip
    462.9 KB · Views: 207
Status
Not open for further replies.
Back
Top