Every now and then when I work on an Arduino project I feel the need for immediate reporting of what the microprocessor board is doing. Debugging of sketches is mostly done via Serial Monitor, but often a liquid crystal display (LCD) comes into focus, especially while testing sensors. LCDs are robust, simple and input can be channeled in an Arduino sketch to an LCD without much problems. One can concentrate on refining a project wherein the display of results in the testing phase is a tool, not a goal.
My arsenal of displays consists of several 2×16 units and a few more luxurious 4×20 types. This sort of display exists in two tastes: ‘classic’, 4-8-bit parallel wired displays and displays with I2C backpacks either soldered or separate. The existing test bench consists of two breadboards strung with jumper wires, resistors and leds. This is not a particularly stable test environment. It lingers in a drawer and when I need to use it I must first check all wires and connections. After two years of tinkering in this way I decided to construct a permanent LCD test bench. This ‘hard’ bench should be multi-purpose: it should be a platform for quick checks for correct functioning of (parallel) LCDs, but it should also be available to test sensors, devices and communication. Finally the bench should provide a clean and robust environment wherein it is possible to concentrate on developing Arduino sketches, without having to worry about loose wire connections, faulty jumper wires and the like.
Figure 1: Design of my LCD test bench. The test board is a 80×120 mm double-sided universal PCB. Two parallel 15-pin female pin headers accommodate an Arduino Nano. A female 16-pin header is present to accommodate 16-pin 2×16 or 4×20 LCD breakout units. An additional female 14-pin header is planned to make some of the Nano’s free pins available for input or output. Correct functioning of the Nano will be reported by the red led (wired to Nano pin 13). Two male 4-pin headers (a black and a red one) will be mounted to supply 5V and GND to projects. The potentiometer controls contrast of the LCD character pixels via pin V0 of the LCD.
Figure 2: The PCB outlay: Projected on it on 1:1 scale a 2×16 LCD and an Arduino Nano. The bench is big and stable enough to accommodate a 4×20 LCD breakout unit.
Required electronic parts
- 1x 80×120 mm double-sided universal Printed Circuit Board (PCB)
- 2x 15 pin female pin header: ‘Nano support pin headers’
- 1x 16 pin female pin header: ‘LCD pin header’
- 1x 14 pin female pin header: ‘test bench pin header’
- 2x 4 pin male pin header: ‘power and GND pin headers’
- 1x potentiometer 10 kΩ
- 2x resistor 220Ω
- 1x led
- 4 nylon spacers with nylon bolts
- 1x Arduino Nano
Wiring and pin connectivity
A wiring diagram is presented in figure 3. There is a set of wiring between the Nano and the display pin header. Another set of wiring exists between the Nano and the test bench pin header, and finally there is wiring to the external 5V and GND power pins and to a led connected to pin 13 of the Nano.
Nano to display pin header
LCDs for the Arduino (that is the breakout board on which the actual display is mounted) have 16 pins, usually marked 1 through 16, or VSS, VDD, V0, RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7, A and K. Because we are using 4-bit addressing the interface needs four data lines: pins D4, D5, D6 and D7 of the display. Wiring on the test board is done in well-known Arduino way:
LCD breakout board pin number
The consequence of this wiring is that the call to the <LiquidCrystal.h> library in the Arduino sketch reads ‘LiquidCrystal lcd (12, 11, 5, 4, 3, 2);’
Nano to test bench pin header
As a LCD requires 6 of the pins available on a Nano out of a total of 14 digital and 6 analog pins, plenty of Arduino pins remain empty and therefore can be used for testing purposes. A female pin header with 14 pins is applied here to accommodate jumper wire connectivity with equipment. The pin header provides access to Nano pins A0 through A6 for analog input, and to Nano digital pins D6 through D10, plus TX and RX for serial communication. If necessary an auxiliary female pin header can be soldered onto the PCB at a later stage to wire to pins D0 through D3 of the Nano.
Pin 13 of the Nano is wired via a 220Ω resistor in series with a red led. A led is extremely useful as activity or cycle indicator.
In addition to the test bench pin header two male 4-pin headers were mounted, one with a red plastic foot and one with a black plastic foot. In both pin headers the four pins were wire interconnected, and wired through to the 5V (‘red’) and GND (‘black’) pins of the Nano. Thus the test bench has multiple pin headers to supply power and GND to external devices, e.g., sensors.
Figure 3: Wiring diagram with two groups of wiring and the additional wiring: Nano to display, Nano to test bench, 5V and GND pin headers, control led. As pins A0 through A5 can be designated digital in software a ‘pin correspondence table’ is added. Note that the potentiometer that controls LCD character contrast via LCD pin 3 needs only GND.
Results and discussion
A picture of the completed test bench with a 20×4 LCD mounted on the LCD test pin header is shown in figure 4. It is running a sketch that tests all characters in the ASCII character set, and it prints to screen the value provided by the millis () function, that is, a measure of time elapsed since switching the Arduino on.
With the test bench I can check the integrity of LCD breakout boards in a matter of seconds and, because of the test bench pin header the opportunity is there to experiment with sensors, communication and other input-output. I2C LCDs can be tested via pins A4 (SDA) and A5 (SCL) of the test pin header.
http://www.zonnepanelen.wouterlood.com/arduinostuff/LCD_test_benchh.zipThe device is a nice addition to my collection of Arduino gear.
Figure 4: Completed and working LCD test bench, with a 20×4 LCD display running the test sketch.
LCD_test_bench.ino (zip file)