Login Welcome to Works of Rowan Simms
Saturday, July 26 2014 @ 09:14 AM EST
Share

Cat's Whisker's TextStar LCD Display

Arduino

I have been looking for a well thought out LCD display for my Arduino projects for some time and recently came across the TextStar LCD from Cat's Whisker Technologies. After reading the data sheet I immediately ordered one.

The TextStar LCD features four customisable buttons next to the LCD, it is super small and thin (50mm wide x 26mm high x 6mm thick) and has a very cool feature allowing it to handle more than the two lines of data on display. The unit allows the creation of "virtual" lines which means you can write up to 16 lines of information to the unit and scroll the visible display to the consecutive two you wish to have visible. There are plenty of other features of this display, those that use servo's a lot will love some of the onboard monitoring it is capable of. As these are less relevant to my current projects I will not be covering these features here.

I spent a few hours seeing what this thing can do and here are some of my findings with Arduino code for your downloading pleasure.


Initial Setup

It took just a few minutes to have the LCD up and running.

  1. Connect GND to Arduino Ground
  2. Hold the top two buttons on the display
  3. Connect 3V3 to Arduino (or 5V, the LCD will handle up to 20V)

By holding the top two buttons the LCD enters configuration mode. As I am using this LCD to display text and the inbuilt bar graphs I only needed to set two areas.

  1. BAUD rate, I set mine to 9600 as that is ample for my project
  2. Signalling, I set to TTL rather than the default RS232
  3. Attach the RX pin on the LCD display to the TX on the Arduino (PIN 1).

The LCD is now ready to accept input, to prove that, the following Sketch will output, "Hello World".

void setup() {
  Serial.begin(9600);
  delay(2500);  // the LCD takes just over 2 seconds to power up
  Serial.println("Hello World");
}

void loop() {
/* Loop is not used in this example */
}

Obviously this is the most basic of examples. The TextStar LCD offers several great and time saving features.

 

TextStar Features

The TextStar has many great features including full pin protection (protecting the circuit if you plug, say the RX pin to power), chip-on-glass, servo mode, four buttons on-board and so on. By far the two most useful features for a newbie are the 16 Virtual Lines and the inbuilt Bar Graph capabilities.

Virtual Lines

The LCD display is 2 line, 16 characters per line. The internal hardware expands this to be 16 lines which may all be addressed individually then you are able to switch the view to any of these 16 lines (showing two consecutively). This is a fantastic feature as you can have different functions in your project update their own lines and run a "viewer" function that can switch to whichever lines are currently relevant for the user.

For example, my project has a GPS, Battery, Camera and SD Card, all of which I would like to see relevant information from. Thus, I can assign the screen as follows

/*
 * line allocations (1-16)
 *    |----------------
 *  1 |  Starting Up
 *  2 | GPS CAMERA SDC
 *    |----------------
 *  3 |00:00 TUE 31 MAR
 *  4 |
 *    |----------------
 *  5 |GPS    Age: 00ms
 *  6 | 000kmh 360?NNW
 *    |----------------
 *  7 |SD Card Capacity
 *  8 |E[xxxxx_______]F
 *    |----------------
 *  9 |SD Card Capacity
 * 10 |   000 of 512   
 *    |----------------
 * 11 | Battery Status
 * 12 |E[xxxxxxxxxx__]F
 *    |----------------
 * 13 |
 * 14 |
 *    |----------------
 * 15 |ProdName  v xx.x
 * 16 |© rowansimms.com
 *    |----------------
 */


As each function has their own line space, I can allow each master controller() function for my GPS, Battery, Camera and SD Card to update their own lines without worrying what the user is currently seeing. When necessary, I can make a simple call to switch into view the currently relevant lines for the user.

1. the TextStar LCD display starts at line 1 through 16, it is not zero indexed
2. when addressing the LCD, some commands require a command-bit to be sent first, others do not. An example of this is below

Bar Graphs

Another great feature of the TextStar LCD is the ability to create bar graphs without any complex coding. Notice in the above table I have a bar graph on lines 8 and 12. These are created onboard the LCD and are very simple to code for.

 

Programming for the TextStar LCD

The TextStar interfaces through the Serial ports of your Arduino (pins 0 and 1). To send information to the screen we communicate on the Arduino TX port (pin 1) and the button presses from the screen are send to RX port (pin 0). This article does not cover these buttons.

Command sets are used to instruct the LCD of the action you are about to take, the preference you wish to set and other general behaviour. These command sets are documented here: TextStar LCD Datasheet (PDF). For most functions there are multiple bytes that need to be sent. Ensure the last byte of the command is terminated, ie println rather than just print. For example in the code segments below lcd_WriteLine is not terminated as we have yet to write the actual text we wish to display whereas lcd_ShowLine is a complete command so we terminate the command set by sending the last byte segment with a println.

To make life easier, I wrote a few functions to address the LCD in a consistent manner.

Each time I boot this project up I wish to initialise the LCD in the same manner, that is to a) clear the screen, b) set the cursor to no cursor. lcd_init() function is called in setup().

void lcd_init() {
    delay(2500); // let the screen initialise if it has only just been powered up

    /* Clear the display and take us to line 1 cell 1 
     * Notice that this instruction to the LCD does not
     * require a command-bit to be send first
     */
    Serial.println(12,BYTE);

    /* Setup the Cursor Style */
    Serial.print(254,BYTE);  // we are sending a command
    Serial.print(67,BYTE);   // we wish to set the cursor style
    Serial.println(0,BYTE);  // we wish to have no cursor
}

The next function I wrote was a common function to tell the LCD I would like to write to a particular line. The sole argument of the function is the line number I wish to write to (remember the LCD is indexed at 1, not 0).

void lcd_WriteLine(int lineNum) {
    Serial.print(254,BYTE);       // we are sending a command
    Serial.print(76,BYTE);        // goto line n command
    Serial.print(lineNum,BYTE);   // clears the line the line number (1-16)
}

Of course having the 16 lines available, I needed a way of switching the view controller, that is to say, which two lines is actually displayed on the LCD. This simple function takes the line number to be at the top of the display and switches the view.

void lcd_ShowLine(int lineNum) {
    Serial.print(254,BYTE);       // we are sending a command
    Serial.print(71,BYTE);        // display the following line number
    Serial.println(lineNum,BYTE); // the line number (1-16)
}

Using the lcd_WriteLine(int lineNum) and lcd_ShowLine(int lineNum) means that writing to the display and then viewing it is very easy.

    lcd_WriteLine(1);
    Serial.println("Hello World");
    lcd_ShowLine(1);

To play around, try this

    lcd_WriteLine(4);
    Serial.println("Hello Line 4");
    lcd_ShowLine(3);

What happens? We wrote the text out to line 4, then switched the display to line 3, so the Hello Line 4 is at the bottom of the screen. You can play around further remembering that line numbers allowable are 1 through 16.

 

Arduino Demonstration Sketch

Let's put this into a Sketch to make things easy.

Download Code: TextStar LCD - Example 1

/* 
 * Demonstration of Cat's Whisker TextStar LCD Display 
 * This is a basic example demonstrating how to setup and run the TextStar LCD with an Arduino.
 *     Link to Manufacturer's page: http://cats-whisker.com/web/node/7
 *     Link to Tutorial where this code comes from: http://rowansimms.com/?topic=arduino
 *
 * 2010-03-16  Code version: 0.0.1
 * Rowan Simms <arduino-code@rowansimms.com>
 * http://rowansimms.com/?topic=arduino
 * 
 * Basic Setup:
 *    Connect GND from TextStar LCD to Arduino Ground
 *    Hold the top two buttons on the display
 *    Connect 3V3 to Arduino (or 5V, the LCD will handle up to 20V)
 *        By holding the top two buttons the LCD enters configuration mode, change the following:
 *        1. BAUD rate for RX and TX, I set mine to 9600 as that is ample for my project
 *        2. Signalling, I set to TTL rather than the default RS232
 *    Attach the RX pin on the LCD display to the TX on the Arduino (PIN 1).
 *
 *    NB: You should only need to set the baud and signalling once, unless you re-use the LCD for
 *          a different project with different settings.
 */

void lcd_WriteLine(int lineNum);
void lcd_ShowLine(int lineNum);
void lcd_init();

void setup() {
    Serial.begin(9600);
    lcd_init();
	
    lcd_WriteLine(1);
    Serial.println("Hello World");
    lcd_ShowLine(1);
	
    delay(3000); 		// give you a chance to see the result
	
    lcd_WriteLine(4);
    Serial.println("Hello Line 4");
    lcd_ShowLine(3);
}
void loop() {
/* Loop not used in this example */
}

/* Sends LCD command sequence to initialise the LCD
 * Sets cursor style to 'no cursor'
 */ 
void lcd_init() {
    delay(2500); // let the screen initialise if it has only just been powered up

    /* Clear the display and take us to line 1 cell 1 
     * Notice that this instruction to the LCD does not
     * require a command-bit to be send first
     */
    Serial.println(12,BYTE);

    /* Setup the Cursor Style */
    Serial.print(254,BYTE);  // we are sending a command
    Serial.print(67,BYTE);   // we wish to set the cursor style
    Serial.println(0,BYTE);  // we wish to have no cursor
}

/* Sends LCD command sequence to write to LCD line n
 * @param  int   lineNum   Line Number to write to
 */
void lcd_WriteLine(int lineNum) {
    Serial.print(254,BYTE);       // we are sending a command
    Serial.print(76,BYTE);        // goto line n command
    Serial.print(lineNum,BYTE);   // clears the line the line number (1-16)
}

/* Sends LCD command sequence to display to LCD line n
 * @param  int   lineNum   Line Number to display (top of screen)
 *                         will show n and n+1
 */
void lcd_ShowLine(int lineNum) {
    Serial.print(254,BYTE);       // we are sending a command
    Serial.print(71,BYTE);        // display the following line number
    Serial.println(lineNum,BYTE); // the line number (1-16)
}

As you can see, programming for the TextStar LCD is really simple and by taking the time to write a few common functions to help address the advanced functions of this LCD you can program with ease and keep your code neat and tidy.

 

Tutorial #2 - TextStar Bar Graphs and some more code

There is a second tutorial regarding the TextStar LCD that extends both the knowledge of the LCD, such as the bar graph capability, and of easy methods to help programming for it including a controller function that will handle all writing and viewing of the LCD screen. This makes handling the 16 lines on the screen very easy for large projects. This is due for release shortly after my next holidays, check back mid-April or subscribe to the RSS Feed of all Articles.

 

Links

Manufacturers page for TextStar LCD

TextStar LCD Datasheet (PDF)

Download the code used in this article: TextStar LCD - Example 1

RSS Feed of all Articles

 

Tag: arduino textstar lcd code

Trackback

Trackback URL for this entry: http://rowansimms.com/trackback.php/20100317004217872

No trackback comments for this entry.

39 comments

The following comments are owned by whomever posted them. This site is not responsible for what they say.
Authored by: Anonymous on Thursday, March 18 2010 @ 12:00 AM EST Cat's Whisker's TextStar LCD Display

 

Very helpful tutorial. I think I might need to buy one of these now. Looking forward to tut #2.

Authored by: Skippic on Sunday, September 25 2011 @ 03:28 PM EST Cat's Whisker's TextStar LCD Display
Is there any way to get the BAUD rate with Arduino Nano above 19200? I need to spend as little time as I can writing on the screen and apart from other strategies I'm using, rising the BAUD rate would be very helpful. Should I try shielding the Rx and Tx wires?
Authored by: Anonymous User on Wednesday, June 26 2013 @ 11:24 PM EST Cat's Whisker's TextStar LCD Display
I wasn't really that familiar with those stuffs, but I guess I really have to check my references such as those custom essay writing.
Authored by: Masud01 on Wednesday, September 04 2013 @ 06:08 PM EST free essay editing
Free essay editing is really a support that will normally takes this dissertation which you have organized along with reviews the item so that you can talk with one to allow it to be better. Why's that essential? If you are attempting to achieve admission in to a school as well as grad college it is sometimes any well written dissertation that could create as well as separate the job.
Authored by: Alim on Wednesday, September 04 2013 @ 08:59 PM EST Essay
You need to locate a services having professional and also skilled internet writers. Skilled internet writers can emphasize with your benefits, http://uk.bestessays.com/uk_writing_service.html capabilities and also expertise for that employment successfully within your cv.
Authored by: Azim on Tuesday, September 10 2013 @ 05:01 PM EST Qualityresearchpaper.com thesis statement help
The first task in the direction of writing a good exploration papers is usually to arrange what is to be created. It is usually wonderful Qualityresearchpaper.com thesis statement help to produce an outline to help to keep on track even as we write, discovering the main details and what is to be the conclusion.
Authored by: Milon on Tuesday, October 22 2013 @ 05:30 PM EST smartcustomwriting
In some cases, a customer will pay further to select a particular article author or perhaps choose a article author with larger references. Presently there may also be a solution for you to upload data, like particular essay on customer service linked here by smartcustomwriting.com reference materials, through the set of questions kind. The actual article author will probably upload this data file, along with it will be provided for the e-mail deal with about declare the client.
Authored by: NaimurRahman on Monday, October 28 2013 @ 06:15 AM EST lue lisää
Great! Truly affluent content and incredibly practical in a row. I got it my explanation from over here. I extremely advise his/her works with the functional enlightening information. Thanks a lot……….. lue lisää
Authored by: sabbir on Monday, October 28 2013 @ 06:44 PM EST literature review writing services
The main concentration of literature review writing services is how to make writing attractive as well as efficient that draws the attention of student with intention of maintaining leading position. Therefore, these sorts of services leave no rest to bring the ultimate output by ensuring the quality of work.
Authored by: Sunny on Monday, November 04 2013 @ 09:16 PM EST smartcustomwriting
Finding strategies to produce and boost purchaser visitors for you to a person's on the net internet site and ultimately strengthen sales is usually a very important undertaking that online businesses have to do and discover achievement. Of this type, useful and favorite custom written essays http://www.smartcustomwriting.com/custom-dissertation approaches are very important .
Authored by: Anonymous User on Monday, November 18 2013 @ 07:57 PM EST Cat's Whisker's TextStar LCD Display
it better than what I expected and all but bring your information is very interesting, thanks http://www.friv10game.org | http://www.friv3game.net | http://www.kizi2game.com
Authored by: Anonymous User on Monday, November 18 2013 @ 08:01 PM EST Cat's Whisker's TextStar LCD Display
I love the sweet and I love sharing interesting things above.thank you for sharing lots of interesting information. http://www.kizi1.org | http://www.yepi2.info | http://www.friv3.org.in
Authored by: Anonymous User on Saturday, November 30 2013 @ 10:22 PM EST Cat's Whisker's TextStar LCD Display
I am trying to imply this. I am greatful to you for sharing this here. I am looking forward to grab more tips like this from you. This coding is not easy to understand. You nicely presented this but still i need to know more about this.
Authored by: Anonymous User on Monday, December 02 2013 @ 09:59 PM EST Cat's Whisker's TextStar LCD Display
- Yet, trust remains one in every of the additional elusive parts of structure management. Therefore, modification inside a company must be fueled by trust. army to civilian resume
Authored by: Steven on Sunday, January 26 2014 @ 06:22 PM EST topessaywriting
To be powerful, you will need to highlight information and hot control buttons with assurance. While your lecturer may allocate you the topic for http://www.topessaywriting.org/paper-writing-service your essay dealing with a particular perspective relevant to the topic that conveys your area of information and emotions will help you with composing a powerful essay.
Authored by: friv on Monday, February 17 2014 @ 09:02 PM EST friv 2
it better than what I expected and all but bring your information is very interesting
http://www.friv2friv3friv4.com/
Authored by: Anonymous User on Tuesday, February 18 2014 @ 10:34 PM EST Cat's Whisker's TextStar LCD Display
To inspired additional development of entrepreneurs from the university. With this policy, universities became the middle to foster entrepreneurship. Singapore Personal Loans
Authored by: friv 2 on Friday, February 21 2014 @ 02:24 AM EST game online
Great! Truly affluent content and incredibly practical in a row. I got it my explanation from over here. I extremely advise his/her works with the functional enlightening information. Thanks a lot………
http://www.friv2friv3friv4.com/
http://www.flappybirdnew.com/
Authored by: http:online-casino-canada.co on Thursday, February 27 2014 @ 12:01 AM EST http://online-casino-canada.co
Hello my friend! I want to say that this article is amazing, great written and come with approximately all significant info’s. I would like to see more posts like this. That’s http://online-casino-canada.co gaming site it has lot of games so visit and enjoy……..
Authored by: Babygirl on Thursday, February 27 2014 @ 05:14 PM EST Cat's Whisker's TextStar LCD Display
Hi, I'm so excited that I have found this your post because I have been searching for some information about it almost three hours. You helped me a lot indeed and reading this your article I have found many new and useful information about this subject. Thanks for sharing this!
http://www.kizi2games.us | http://www.yepi10.info | http://www.friv4games.us
Authored by: Tamim on Thursday, February 27 2014 @ 05:35 PM EST Essay
Another facet which in turn must be regarded as at the same time of Dissertation Review is usually visit this site right here checking the analysis operate. Carry out verify the actual books and also the important specifics associated with the actual thesis during modifying.
Authored by: gambling in new zealand on Wednesday, March 26 2014 @ 04:19 AM EST gambling in new zealand
It's very nice website. I will search this page again & again great list. I appreciate your efforts to bring such a huge list for us. Great list for those who are looking for blog commenting sites gambling in new zealand. Your blog provided us with valuable information to work with. Thanks a lot for sharing.
Authored by: onlinecasino777 on Wednesday, April 02 2014 @ 06:19 AM EST onlinecasino777
Online evening Parties are very intriguing when it has correct lighting. Lighting performances wide function in evening parties. Brilliant onlinecasino777 lighting style can actually put a damper on the evening time.
Authored by: Anonymous User on Friday, April 04 2014 @ 12:34 PM EST Cat's Whisker's TextStar LCD Display
I've observed in the world of today, continue video games include the latest popularity with kids of all ages. There are occassions when it may be difficult to drag your children away from the games. If you want the best of both worlds, find out there are plenty of educational video games for kids. Interesting post. find more
Authored by: friv 4 on Wednesday, April 16 2014 @ 07:59 PM EST Cat's Whisker's TextStar LCD Display
TextStar LCD screen, I have used it and was great. Everything was assessed nearly as good and we can verify. [http://www.friv4go.com]
Authored by: Anonymous User on Saturday, May 10 2014 @ 11:35 PM EST Cat's Whisker's TextStar LCD Display
Thank you so much! Really rich content and very useful information. I found my problem’s solution starting over here. I exceedingly advocate his/her machinery by means of the valuable enlightening information.
http://www.friv2g.com/
http://www.friv10.co.uk

Authored by: Anonymous User on Sunday, May 11 2014 @ 08:13 PM EST Cat's Whisker's TextStar LCD Display
Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration. friv juegos | ducks
Authored by: Anonymous User on Tuesday, May 13 2014 @ 12:57 AM EST Cat's Whisker's TextStar LCD Display
Thank you so much! Really rich content and very useful information. I found my problem’s solution starting over here. I exceedingly advocate his/her machinery by means of the valuable enlightening information. juegos de | game friv | huz
Authored by: This website on Saturday, May 31 2014 @ 06:42 PM EST This website
I found this post very exciting. I think you will have any other post on this topic? I am also sending it to my friend to enjoy your working style. Cheers!
<a href="http://neviditelnapodprsenka.cz/">neviditelná podprsenka</a>
Authored by: friv on Thursday, June 12 2014 @ 01:30 PM EST friv
I'm happy with what is there
http://www.friv4game.org
Authored by: This website on Thursday, June 12 2014 @ 05:18 PM EST This website
Ha ha, this website is too great, make me happy. Website decoration is very elegant, content is very full, continuously outstanding theme, let a person gutty want to continue down at feeling, and I am enjoying it.
<a href="http://www.fondsuebersicht24.de/energiefonds/">Energiefonds</a>;
Authored by: This website on Thursday, June 12 2014 @ 06:33 PM EST This website
So beautiful article. I visit this site. It gives me lots of pleasure and interest. It’s a most important post. Please every one visit this site quickly. Thanks
<a href="http://plak-beha.be/silicone-bh/">silicone bh</a>
  • This website - Authored by: Anonymous User on Thursday, June 26 2014 @ 05:38 PM EST
Authored by: Anonymous User on Wednesday, June 25 2014 @ 01:40 PM EST Cat's Whisker's TextStar LCD Display
Useful information. Fortunate me I found your site by accident, and I am surprised why this coincidence didn’t took place earlier! I bookmarked it. gazo | friv 2 | juegos friv 2 | Emzi | Huz | Elsa games
Authored by: Anonymous User on Friday, July 04 2014 @ 03:47 AM EST Cat's Whisker's TextStar LCD Display
Search engine optimization isn’t just for the big companies. People look online for nearly everything, from flower shops to pharmacies utah seo
Authored by: Anonymous User on Saturday, July 19 2014 @ 11:06 PM EST partytent huren schiedam
Very informative post. I was looking for information about this topic and this post really helped me a lot.
<a href="http://partytent-schiedam.nl">partytent huren schiedam</a>