SkillAgentSearch skills...

LCD2USB

Cheap and simple USB to HD44780 text LCD interface

Install / Use

/learn @harbaum/LCD2USB
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

LCD2USB

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.

LCD2USB is currently supported by lcd4linux (LCD2USB support is built-in), LCD Smartie (requires a seperate driver), and LCDProc (LCD2USB support is built-in).

Every now and then i have spare PCBs available. Send me an email if you are interested.

LCD2USB makes use of several projects to achieve this goal. LCD2USB is based on:

Hardware

The prototype board

| ---- | ---- The final pcb mounted on a 4x20 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 current version 1.1 of the LCD2USB operates the USB data lines at 3.6V which complies to the USB spec and increases compatibility over version 1.0.

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 162, 202 and 204) and dual controller displays (tested with 274 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. 404 displays. See figures for details. Since the power supply of the 404 connection varies from the 202 connector style, the solder bridges SJ2 and SJ3 allow to adjust the power supply polarity on JP2. The default setting is for the 202 style connection. The following image shows how to change the settings for a 4x40 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: 216, 416, 4*20 | Display: 220, 240 | Display: 4*40 <font color="red">(adjust solder bridge!)</font>

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 <tt>USB_CFG_MAX_BUS_POWER</tt> in the file <tt>usbconfig.h</tt> 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 programming cable is only required once, since the firmware is permanently stored in the AVRs internal flash memory.

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

NEW: PCB version 1.1

The latest PCB version includes the two zener diodes to increase USB compatibility. Furthermore the power supply inductor has turned out not to be neccessary and has thus been removed to make space for the new zener diodes.

I sometimes have spare PCBs. Send me an email if you want to buy one of them.

Part list

You can get all parts directly via the lcd2usb part list at Reichelt. This list is for the V1.1 pcb and includes the following parts:

Part | Qty | Name | Reichelt Part No. | Conrad Part No. ---- | ---- | ---- | ---- | ---- Q1 | 1 | 12Mhz crystal, HC49U package | 12,0000-HC49U-S | 445167 R1 | 1 | 2.2k ohm resistor | 1/4W 2,2k | 403296 R2, R3 | 2 | 68 ohm resistor | 1/4W 68 | 403113 R4 | 1 | 47 ohm resistor | 1/4W 47 | 403091 R5 | 1 | 220 ohm resistor | 1/4W 220 | 403172 R6 | 1 | 4.7k ohm resistor | 1/4W 4,7k | 403334 C1, C2 | 2 | 22pF ceramic capacitor, 2.54mm | KERKO 22P | 457167 C3, C5 | 2 | 100nF capacitor, 5.08mm | X7R-5 100N | 453358 C6, C7 | 2 | 10μF electrolytic capacitor | RAD 10/35 | 472484 T1 | 1 | BC547C transistor | BC 547C | 154989 L1 | 1 | 10μH inductor | SMCC 10μ | 535729 S1, S2 | 2 | push button | TASTER 9305 | 700460 SV1 | 1 | 10 pin ISP connector | WSL 10G | 744026 JP1 | 1 | display connector | BL 1X20G 2,54 | 734993 JP2, JP6 | 1 | display connector | BL 2X10G 2,54 | 741159 -- | 1 | display side connector for JP2/JP6 | SL 2X10G 2,54 | 744026 JP3 | 1 | 4 pin debug connector, display side connector for JP1 | SL 1X36G 2,54 | 744018 LED1 | 1 | LED 3mm green | LED 3MM GN | 184713 -- | 1 | USB-B print connector | USB BW | 743950 IC1 | 1 | Atmega8-16 DIP | ATMEGA 8-16 DIP | 154054 -- | 1 | socket for IC1 | GS 28P-S | 189515 D1, D2 | 2 | 3.6V zener diode | ZF 3,6 | 180050

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 display

View on GitHub
GitHub Stars150
CategoryDevelopment
Updated1mo ago
Forks40

Languages

C

Security Score

80/100

Audited on Mar 2, 2026

No findings