USB and serial enabled LCD backpack design overview

From DP

Revision as of 11:39, 17 October 2011 by Arakis (Talk | contribs)
Jump to: navigation , search

Pic-lcd-backpackv5 .jpg

Available for $16.95 at Seeed Studio.

Prototype PCBs are available in the free PCB drawer.

This is a USB and serial backpack for simple HD44780 character LCD screens. It has a few nice features that set it apart from the serial-only LCD backpacks at SparkFun and Adafruit:

  • USB and serial control of characters LCDs
  • Supported in common software (LCD Smartie) as 'matrix orbital' display
  • Adjust contrast and backlight from software
  • Couple extra pins for buttons
  • 500mA fuse
  • USB upgradable

Contents

Overview

PIC LCD backpack.png

We wanted something that was like the serial only backpack that Adafruit and Spark Fun sell. But we wanted to make it USB too, and make it the same price with some extra features.

Hardware

Cct-LCD-Backpack-PIC-HD44780-v1a.png

Click for a full size schematic image. Schematic and PCB were designed with the freeware version of Cadsoft Eagle, download the latest project files from our Google Code project page.

PIC18F2550

LCD-BackPack-MCUpic-600.jpg

The LCD Backpack uses a PIC18F2550 MCU (IC1), it is powered directly by USB 5v power supply trough a 500mA fuse (F1). The power supply is decoupled using a 0.1uF capacitor (C4), while the internal 3.3v USB power supply (VUSB) is decoupled using a 0.22uF capacitor (C3). The external clock is provided with a quartz crystal (Q1) and two capacitors (C1 and C2).

A ICSP programing header is provided and the MCLR pin is connected through a diode (D1) and a pull up 10K resistor (R1) to the power supply. This insures that the MCU is kept in reset until an adequate power supply is available. The diode stops any voltage feeding back into the pic power supply during high voltage programing.

HD44780 LCD compatible header

HD44780-600.jpg

Our LCD backpack provides the full 8bit data protocol(D0-D7), as well as full control over the Reset (RS), Read/Write (R/W), and Enable (E) pins.

  • Backlight
We added a 100ohm potentiometer (BACKLIGHT) which can be used to adjust the specific backlight settings your display has, please check the datasheet of your LCD for the correct value. The backlight is software dimmable trough the transistor (T1) and the 1K base resistor (R2).


  • Contrast
Contrast is adjustable through a 10k potentiometer by soldering pads 2 and 3 of the solder jumper (SJ1), or trough software by soldering pads 1 and 2.

PCB

PIC-lcd-backpack-pcb.jpg

We used the freeware version of Cadsoft Eagle to make the schematic and PCB. Download the latest designs and firmware from the project Google Code page.

  • PCB and placement notes
  • soldering advise

Partslist

PIC-lcd-backpack-HD44780-v1a-brd.png

PIC HD44780 LCD backpack
PartQuantityValuePackage
BACKLIGHT1100RB25P
C1,C2227pfC0805
C31220nFC0805
C410.1uFC0805
CONTRAST110KB25P
D11BAS16JSOD2514X100N
F11500mARCL_L1812
IC11PIC18F2550_28WSO28W
ICSP11X05
J11USBSMDUSB-MINIB
LCD11X16
Q1120MHzHC49UP
R1110kR0805
R211KM0805
RB4,RB521X01
SJ11SJ_2
T11BC818SOT23-BEC
UART,USB21X04

The latest sources and distributors are in the master partlist. See something missing? Please let us know.

Firmware

The firmware is written in C and compiled with the free Microchip C18 compiler. You can download the latest files from our Google Code project page.

  • Operating modes
  • extra software required

We used the Microchip USB stack to run the 18F2550 as a virtual serial port. Microchip's code is open but not redistributable. If you want to compile the source, download the stack from Microchip, then drag the source code into the install directory. See the detailed instructions in the PIC compiler how-to.

.inf installation

The virtual serial port (CDC) is an open standard, it should work on any modern operating system.

You don't need a driver, but you will need a .inf file to tell Windows how to use the device. A suitable .inf is included in the project archive.

Commands

The controller implements a (subset) of the serial interface provided by Matrix Orbital Serial LCDs.

To send a command, first send the START_COMMAND byte (0xFE), followed by the command (with any parameters), followed by the END_COMMAND byte (0x9A).

For example, to turn on the backlight, send 0xFE, 0x42, 0x00, 0x9A.

Name Decimal Hex Parameters
MATRIX_ORBITAL_COMMAND 254 0xFE None
BACKLIGHT_ON 66 0x42 1 (minutes, 00=forever)
BACKLIGHT_OFF 70 0x46 None
CLEAR 88 0x58 None
HOME 72 0x48 None
POSITION 71 0x47 2 (col, row)
UNDERLINE_CURSOR_ON 74 0x4A None
UNDERLINE_CURSOR_OFF 75 0x4B None
BLOCK_CURSOR_ON 83 0x53 None
BLOCK_CURSOR_OFF 84 0x54 None
BACKLIGHT_BRIGHTNESS 152 0x98 1 (brightness)
CUSTOM_CHARACTER 78 0x4E 9 (character #, 8-byte bitmap)
NETWORK_CONFIG 153 0x99 None
END_COMMAND 154 0x9A None

Bootloader

600px

The LCD backpack can be upgraded over the USB connection. It uses a modified version of the Diolan USB PIC bootloader. This bootloader, written in ASM and released under the GPL, enumerates as an HID device. The bootloader app is included in the project archive.

Taking it further

Here's some ideas for the future:

  • Enable and test software LCD contrast control. Solder jumper SJ1 near the contrast adjustment can be cut and resoldered so the PIC pulse-width modulator drives the LCD contrast. This should enable software control of contrast, but we have not yet tested it.

We'll post the most recent firmware updates on our blog. You can also join the discussion in the [forum].

Get one!

You can get one for $16.95.

Your purchases at Seeed Studio keep the open source project coming, we sincerely appreciate your support!