Cat's Whisker's TextStar LCD Display

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.
- Connect GND 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. As I am using this LCD to display text and the inbuilt bar graphs I only needed to set two areas.
- BAUD rate, I set mine to 9600 as that is ample for my project
- 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).
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
Download the code used in this article: TextStar LCD - Example 1

What's Related