LCD2USB. Part 1

HD44780

Till Harbaum

Overview

LCD2USB is a open source/open hardware project. The goal of LCD2USB is to connect HD44780 based text LCD displays to various PCs via USB. LCD2USB was meant to be cheap and to be made of easily available parts. It is therefore based on the Atmel AVR Mega8 CPU and does not require any difficult to obtain parts like separate USB controllers and the like. The total cost (without display and pcb) are about 5 to 10 Euros. LCD2USB currently comes with a simple demo application that works under Linux, MacOS X and Windows.

Hardware

 

The final pcb mounted on a 4×20 display The USB connector is mounted on the rear PCB side

The hardware of the LCD2USB interface consists of the Atmel AVR Mega8 CPU, a cheap and easy to obtain microcontroller with 8 KBytes flash (of which ~3k are used in this application) and 2 KBytes RAM. The processor is surrounded by few parts, mainly connectors to interface to the PC and the LCD.

A power LED (LED1) indicates that the system is powered via USB. The system clock is derived from a 12Mhz crystal. This frequency is necessary due to the fact that the software USB implementation requires a precise timing with respect to the USB.

The USB interface

The USB interface of the LCD2USB interface is based on a pure software implementation and uses three pins of the AVR (PC0, PC1 and PD2). This software implementation supports low speed USB only which is signalled to the PC by resistor R1.

The USB connection may be done via a USB B style connector. This is the square connector that is typically used for USB devices (unlike the flat A style connector used at USB hosts). The USB connector is to be mounted at the solder side (the rear side of the PCB without the white printing). Mounting it to the component side may damage the LCD2USB or even the PC when plugging it in. Alternally a cable may directly be attached to the component side of the board as depicted in the image below.

 

 

Direct attachment of an USB cable The minimum working setup for pre-flashed CPUs

 

 

The whole device a so called bus powered device. This means that the complete device is powered directly from USB. Therefore the AVR and the LCD are powered from the USB VBUS signal. This signal can deliver max 500mA to a device. The power supply is filtered and buffered by C3 and C6.

The LCD interface

The LCD2USB interface supports several different HD44780 based text displays. It supports single controller displays (tested with 16×2, 20×2 and 20×4) and dual controller displays (tested with 27×4 and 40×4). The LCD2USB interface uses the 4 bit interface provided by the HD44780.

Two different connectors (JP1 and JP2) are present to interface to most common HD44780 displays. The extension connector JP6 expands JP2 for the dual controller display connectors as used on e.g. 40×4 displays. See figures for details. Since the power supply of the 40×4 connection varies from the 20×2 connector style, the solder bridges SJ2 and SJ3 allow to adjust the power supply polarity on JP2. The default setting is for the 20×2 style connection. The following image shows how to change the settings for a 4×40 display:

Warning: Using the wrong polarity will most likely destroy the LCD, the interface and may even damage the PCs USB port. Please make sure, that the connector of the display matches the signal layout on the LCD2USB board. You might want to use a USB hub between the LCD2USB and your PC during the first trials. This lowers the risk of damanging the PC if you didn't get the LCD power supply correctly. However, you may still damage the LCD2USB, the LCD and your hub.

 

Display: 2×16, 4×16, 4×20 Display: 2×20, 2×40 Display: 4×40 (adjust solder bridge!)

Power supply considerations

Special care has to be taken with displays with backlighting. The LCD2USB has been designed to draw at most 75mA which is fine for typical LCDs with LED backlighting. This value is also reported to the host PC via the USB configuration. The LCD2USB interface hardware is able to supply up to 100mA via its software adjustable backlight control. This is a limitation of the transistor T1. If the backlighting draws more than 100mA, transistor T1 has to be replaced (see the section "part list remarks" below for more details) and special care has to be taken not to overload the USB which can source at most 500mA in total to a bus powered device. An increased backlight current should be reflected in the USB configuration of the device by adjusting the value of USB_CFG_MAX_BUS_POWER in the file usbconfig.h of the firmware sourcecode. You'll then have to recompile the firmware to make it signal its increased power consumption via USB. These firmware changes may not be necessary with all PCs but some may even shut down the power supply for a device that actually draws more current than its USB descriptors indicate.

Programming interface (ISP)

The firmware is uploaded using the standard 10 pin AVR ISP connector (SV1). A separate programming cable is required to load the firmware onto the LCD2USB. A simple do-it-yourself cable will be sufficient. A PC software like e.g. Ponyprog or UISP will then be used to upload the firware via this cable to the AVR on the LCD2USB device.

The serial interface

Connector JP3 provides the serial interface of the AVR. This connector is meant for debugging purposes only and must not be directly connected to a PCs RS232 interface. Instead a level shifter (e.g. MAX232) must be inserted.

Schematics and PCB layout


Click to enlarge


Click to enlarge

Part list

 

Part

Qty

Name

Q1

1

12Mhz crystal, HC49U package

R1

1

2.2k ohm resistor ¼W

R2, R3

2

68 ohm resistor ¼W

R4

1

47 ohm resistor ¼W

R5

1

220 ohm resistor ¼W

R6

1

4.7k ohm resistor ¼W

C1, C2

2

22pF ceramic capacitor, 2.54mm

C3, C5

2

100nF capacitor, 5.08mm

C6, C7

2

10μF electrolytic capacitor

T1

1

BC547C transistor

L1

1

10μH inductor

S1, S2

2

push button

SV1

1

10 pin ISP connector

JP1

1

display connector

JP2, JP6

1

display connector

--

1

display side connector for JP2/JP6

JP3

1

4 pin debug connector, display side connector for JP1

LED1

1

LED 3mm green

--

1

USB-B print connector

IC1

1

Atmega8-16 DIP

--

1

socket for IC1

D1, D2

2

3.6V zener diode

Additionally required: Display, USB cable

Part list remarks

The crystal should be in the small HC49U package. You can use a crystal in HC18 package, but you'd then have to mount it from the rear pcb side.

C1 and C2 should have their pins 2.54mm (1/10 inch) apart, C3 and C5 have their pins 5.08mm (2/10 inch) apart.

Although T1 is labeled BC547C, a BC547A or BC547B will be fine as well.

The cathode of LED1 faces the R5 label. The long leg of the LED is thus close to JP1.

Resistor R4 is the current limiting resistor for backlighting. The 47 ohm in the part list is a useful and secure value for some LCDs with low power LED backlighting. Some displays already include the current limiting resistor and/or require a higher current. The symptom usually is a very dark or even barely visible backlighting with R4 at 47 ohms. You can lower the value of R4 in order to increase the backlight current and thus the brightness. Please consult the datasheet of your display for its backlight power requirements and in order to select the correct current limiting resistors. The BC547 transistor T1 may not be sufficient for displays requiring backlight currents > 100mA. A user has reported success by replacing T1 with a BS170 MOSFET and driving the backlight with 240mA.

To be continued

harbaum.org

You may have to register before you can post comments and get full access to forum.
EMS supplier