Low-Power LCD: Adafruit Breakout Board With the Sharp Memory Display
Your displays tend to eat up a lot of your power, which limits your options. The Sharp Memory Display, however, takes little power and could solve your problems.
Join the DZone community and get the full member experience.
Join For FreeMany projects benefit from a small display as a user interface. For very low power applications, this is usually a no-go, as the display needs too much energy. I have used e-paper displays from Kent, and while these e-paper displays do not need any power to keep the image up, changing the display content comes with a cost and is very slow (around 1 second needed to update the display). So I was looking for something low power and fast for a long time until I was pointed to a display from Sharp: both very low power and fast.
Font test with Sharp memory display
And even better: Adafruit has a breakout board for that display available. The display on the board is the Sharp LS013B4DN04 with 96×96 monochrome pixel resolution. The display is a cross between e-paper and a normal LCD. The ‘background’ color is a nice silver color. What looks cool with this display is that the pixels show up like a little mirror:
Sharp Memory display mirror effect
The display has no backlight: readability is excellent under daylight (although somewhat view-angle-dependent). Under darker conditions, extra illumination is needed. Still, it has very good contrast between the pixels:
Sharp memory display lines and box demo
Wiring
The Adafruit breakout board comes with a level shifter, so it can be used with 3.3V-5V. I’m using it with 3.3V and only need five wires connected to the display:
- VIN: 3.3-5V.
- GND: Ground.
- CS: SPI chip select, HIGH active.
- CLK: SPI clock (up to 1 MHz).
- DI: SPI MOSI with clock idle polarity low (CPOL=0) and Data valid on clock leading edge (CPHA=0), with bits sent MSB (Most Significant Bit) first.
The other pins can be left unconnected. The display is ‘write only’, so there is no way to read back the data on the display.
External Clock and VCOM
One special thing with the Sharp memory display is that it needs a special clock signal to generate the VCOM — an alternating signal that prevents a DC bias from being built up within the display panel. Depending on the display used, that signal or clock needs to supplied in the range of 0.5 to 60 Hz. That signal can be supplied either externally or by software, depending on the EXTMODE pin:
Sharp memory display EXTMODE (source: Sharp)
On the Adafruit breakout board, EXTMODE is pulled LOW: The clocking has to be provided by software. With software, a special ‘VCOM’ command is sent to the display:
The V bit is then toggled.
void SHM1_UpdateLine(uint8_t line, uint8_t *dataP) {
int i;
/* Send the write command */
SCEpin3_SetVal();
WriteData(SHM1_BIT_WRITECMD | SHM1_sharpmem_vcom);
SHM1_TOGGLE_VCOM;
/* Send the address for line */
WriteData(SHM1_RevertBits(line+1));
/* line starts with 1 */
/* Send data byte for selected line */
for (i=0; i<(SHM1_HW_WIDTH/8); i++)
{
WriteData(*dataP);
dataP++;
}
/* Send trailing 16 bits */
WriteData(0x00);
WriteData(0x00);
SCEpin3_ClrVal();
}
On a logic analyzer, this looks like this:
VCOM bit high
In the next call, the bit is toggled:
VCOM bit low
The ToggleVCOM() function only needs to be called if there are no other display commands sent, as the VCOM bit can be toggled while writing to the display.
Clearing the Display
There is a special ‘clear’ command to clear the display:
Clear display command (source: Sharp)
The following code does a clear:
void SHM1_Clear(void)
{
/* send clear command */
SCEpin3_SetVal();
WriteData(SHM1_sharpmem_vcom | SHM1_BIT_CLEAR);
WriteData(0x00);
SHM1_TOGGLE_VCOM;
SCEpin3_ClrVal();
}
Here again, the VCOM bit is toggled after each command. And this is how things are sent over the wire, with the VCOM bit set:
Display clear command
Updating the Display Line
Each line of the display can be updated with a command: sending line number, then the number of bytes (12 for the 96 bits), followed by a trailing 16 zero bytes:
Writing single line (source: Sharp)
void SHM1_UpdateLine(uint8_t line, uint8_t *dataP) {
int i;
/* Send the write command */
SCEpin3_SetVal();
WriteData(SHM1_BIT_WRITECMD | SHM1_sharpmem_vcom);
SHM1_TOGGLE_VCOM;
/* Send the address for line */
WriteData(SHM1_RevertBits(line+1));
/* line starts with 1 */
/* Send data byte for selected line */
for (i=0; i<(SHM1_HW_WIDTH/8); i++) {
WriteData(*dataP);
dataP++;
}
/* Send trailing 16 bits */
WriteData(0x00);
WriteData(0x00);
SCEpin3_ClrVal();
}
One confusing thing is that the line number has to be sent in LSB first format!
Below is an example writing to line number 1:
Updating single line (click to enlarge)
Multiple Lines
Writing multiple lines (or even all lines) is not much different from writing a single line:
Writing multiple different lines (source: Sharp)
- Send Write command followed by line number and data, end with eight trailing zero bits.
- Continue to send line number with data and eight trailing zero bits.
- Finish the last line of data with 16 trailing zero bits.
void SHM1_UpdateFull(void) {
uint16_t numBytes = sizeof(SHM1_DisplayBuf);
int i, currentline, oldline;
uint8_t *data = (uint8_t*)SHM1_DisplayBuf;
/* Send the write command */
SCEpin3_SetVal();
WriteData(SHM1_BIT_WRITECMD | SHM1_sharpmem_vcom);
SHM1_TOGGLE_VCOM;
/* Send the address for line 1 */
oldline = currentline = 1;
WriteData(SHM1_RevertBits(currentline));
/* Send image buffer */
for (i=0; i<numBytes; i++) {
WriteData(*data);
data++;
currentline = ((i+1)/(SHM1_HW_WIDTH/8)) + 1;
if(currentline != oldline) {
WriteData(0x00);
/* send 8 trailing bits to finish current line */
if (currentline <= SHM1_HW_HEIGHT) {
/* send new line number */
WriteData(SHM1_RevertBits(currentline));
}
oldline = currentline;
}
}
/* Send another trailing 8 bits for the last line */
WriteData(0x00);
SCEpin3_ClrVal();
}
Processor expert component
Of course, I have created a new processor expert component for using that display. With that, it's only a matter of minutes to get the display up and running:
SharpMemDisplay component
Using that component, all the other drawing and font components can be used. The component supports both bit banged and hardware SPI:
SharpMemDisplay settings
Low Power
The display needs around 16 μA while not updating the image:
Current used by display
Making full updates of the display every 20 ms (50 images per second) requires 41 μA. Of course, the less frequently the image updates or the fewer lines updated, the better.
Summary
That Sharp Memory Display is really cool, and the Adafruit breakout board has its price ($39.95). It took me a while to get the protocol right, but now I have very low power display and driver in my inventory. There is an example project on GitHub, and the SharpMemDisplay component is available on GitHub and will be part of the next McuOnEclipse component release. If you are just interested in the sources, they are available on the McuOnEclipseLibrary project.
It seems that the 96×96 (LS013B4DN04) display is obsolete now, but there is a newer 128×128 (LS013B7DH03) for $20.
Happy Sharping!
Links
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments