GenBoard/VerThree : electrical connecion of standard HD44780 LCD (like LCD 204B)
Data sheet for the 4x20 LCD display sold in the WebShop
- green [Displaytech LCD 204B]
- blue (the slim version that has pins at the sides, not on top/bottom): [datasheet] page 14
The DSUB9 old pinout was phased out in favor of the new pinout appr. 2005.May (the WebShop text for the assembled ECM was always authoritive). If in doubt, measure the supply voltage between the relevant pins to be sure. This table will only print well in landscape mode (bad in portrait mode). MembersPage/PeterJensenDisplay has a nice drawing of this.
recommended color | JP_LCD | LCD | function | DB9oldpinout | DB9new-pinout | DB25pinout | Note |
brown | 2 | 1 | Gnd | 6 | 5 | 5 | pin2 is not in the leftmost column on the v3 LCD header: Leftmost column is pins -1,0 that are elsewhere in the schematic. Also connect the cable shield to GND signal, but only at the DB9 end (not at the v3.2 board end) |
red | 10 | 2 | Vcc | 1 | 1 | 1 | pin10 is in the right-upper pin on v3 LCD header |
yellow | 9 | - | -8V | - | - | 14 | optional: negative from MAX 232 thru R112. Some LCD like slightly negative potential on contrast pin (LCD pin3) for which this can be used. Try the variable resistor method below. If there is no viewability with 0 or positive contrast votlage, or best result is with variable resistor fully set to GND (not a bit of +5V applied), you can try to devise a nagative contrast voltage, starting from -8V instead of +5V for slightly better result. See LCD negative contrast section below |
- | - | 3 | Contrast | - | - | - | Solder a 2k2 .. 4k7 .. 10k variable resistor between GND and +5V, with middle terminal to LCD pin3. Set variable resistor for best contrast (it will be near GND). After finding best contrast you can replace variable resistor with matching resistor values. Most LCD like a 470 Ohm .. 1k to GND and 5k6 .. inf towards +5V |
white | 1 | 4 | RS | 3 | 9 | 18 | data or cmd |
orange | 7 | 5 | R/W | 7 | 6 | 15 | data dir. If busypoll is disabled in configuration (not recommended!) LCD pin7 can be connected to constant GND (LCD pin1) on the LCD side (which means data direction is always GenBoard => LCD), freeing a signal: DSUB pin7. This is useful when an extra signal is required for the LCD with negative contrast. Note that this breaks the DSUB9 pinout compatibility, so take care if using both types of connector pinouts. DSUB15 or DSUB25 is recommended for LCD with negative contrast voltage, so R/W pin is connected and busypoll can be enabled (recommended) |
purple | 8 | 6 | Enable | 4 | 2 | 2 | latch control |
green | 6 | 11 | Databit4 | 5 | 3 | 3 | |
grey | 5 | 12 | Databit5 | 9 | 7 | 16 | |
darkblue | 4 | 13 | Databit6 | 8 | 4 | 4 | |
black | 3 | 14 | Databit7 | 2 | 8 | 17 | |
- | 15 | Backlight+ | - | - | - | You can connect it to VCC with a 22..100 Ohm resistor. Note that voltage drop of backlight LEDs (2 in series?) is sometimes over 4V | |
- | 16 | Backlight- | - | - | - | This can be connected to GND via a manual switch. Alternatively it could be switched with a p259 pin, or with a small NPN near the LCD: the NPN base can be controlled through a 1k..2k2 resistor by a free pin of the s259 (allowing software-PWM for backlight dim) |
- Note that in the sch the 2*6 LCD connector (don't mix it with the 2*6 ISPI connector: the ISPI is closer to the AVR) is split to 1*2 and 5*2. The 1*2 is close to the edge of the PCB. Very confusing if you don't pay attention, since the 1*2 header pin numbers would become -1 and 0, if we keep the 1..10 numbering of the 5*2. If you look at the board in eagle, it'll be obvious. But a renumbering wouldn't hurt.
- the LCD has a 2nd connector for mounting convenience, numbered 17 .. 32. It is the very same as 1..16, just add 16 to the pin number. It is enough to connect either one.
- LCD contrast: there are onboard SMD resistor pads for setting LCD contrast bias, but adjusting this with resistors at the LCD is recommended: to allow swapping between different makes of LCD
- the "DB9new-pinout" is our standard that we sometimes use for connecting the LCD: eg. male DSUB9 on endplate (or flying loom coming from to ECM), female DSUB9 on cable connected to LCD.
- Orientation of pin's at GenBoard/VerThree: [apparently bad URL]
- TODO: show the right pinheader on a retouched picture
- While waiting for the retouched picture; [this] should do.
LCD that requires a negative (appr. -3V) contrast voltage.
The -8V (JP-LCD9, yellow wire according to GenBoard/BuildProcedures/LCDconnect standard colors) for contrast is not needed for most LCD (only a very few green LCD with black frame needed negative, appr -3V contrast). The -8V signal is not available on the DSUB9, so the yellow wire will not be connected in the DSUB9 housing - hotmelt it so it does not contact anything). The DSUB25pin14 has the -8V signal, but, as I said, not needed for the blue LCD.
When bought from WebShop, the crew would warn of LCD that requires negative contrast (this type is not sold these days). Such an LCD will not be viewable at all with -2V .. 0V on contrast.
LCD with -3V contrast
- removed R169 from the board (was 1.0k). (not populated since v3.3)
- after setting best contrast with a variable resistor (alternatively trying 2k7, 5k6, 2k2 and similar values), I applied onboard pulldown to -8V: R112=3.0k
- a good way is to use an onboard R112=2k7 and use 0..510 Ohm series resistor at the LCD, choosing the one from 0, 270 and 510 Ohm that gives best contrast (for that LCD.)
- note that there is no explicite pull to GND (which was R169) or pull to +5V (other than some internal pullup resistor in the LCD): just a pull to -8V resistor of sufficient value
The way it works - for the curious:
The setup for the contrast voltage is effectively a voltage divider from 2..3 resistors:
- LCD apparently has a 4k7 pullup to +5V
- R169, or "R169 substitute on the LCD side" pulls towards GND
- R169 recommended not solder on board, but near/on the LCD from GND (LCD pin1) to contrast (LCD pin3). This makes it possible to have different resistor for another LCD (for exact adjust, without opening the v3 case).
- R112 2.2k .. 3k3, recommended 2.7k (marked 272 or 2701) or 3.3k (marked 332 or 3301), solder on the board pulls towards -8V
The resulting voltage is the weighted average of the voltage "pulls". The weights are the reciprocal of resistor values (1/R), see example below.
Resistor divider example:
4k7 internal pullup inside the LCD towards +5V and onboard R112=3k pull towards -8V the weights are 1/4.7 and 1/3:\nÿ1ÿ
Note that any resistor that is not there (eg. unsoldered) is infinite resistance, so the weight is 1/inf = 0 (no need to calculate with those)
When LCD needs negative contrast, use a DSUB15 or DSUB25, since the DSUB9 does not have enough pins for both negative contrast and busypoll (R/W) signal
The non-recommended way to make negative contrast work with DSUB9 (unfortunately busypoll disabled => not optimal)
- I connected the RW signal to GND on the LCD side (to make place for the negative contrast voltage on the DSUB9 connector)
- configure LCD not to use busypoll. Unfortunately, especially since the firmware got faster, the LCD is often not fast enough and loses sync (mli needed to reinitialize LCD). At low temp, the LCD's internal RC freq gets lower, so the situation gets worse. It's possible to slow down LCD in firmware, but refresh rate would suffer. This is a disadvantage of not using busypoll
- applied JP_LCD pin9 (rightmost pin, under +5V) to DSUB pin7 instead of the RW
- applied DSUB pin7 to LCD contrast pin3
Connecting keyboard through DB25
I propose this pinout that I've used on four boards now, along with the LCD pinout described above:
See also [[Manual: Detailed.Central.Keyboard.Install]]
JP_PS1 | DB25pinout | Mini DIN6 | Function |
1 | 22 | 4 | Vcc |
2 | 23 | 3 | Gnd |
3 | 24 | 1 | Data |
4 | 25 | 5 | Clock |
See also: