July 18, 2010

Custom Arduino Shield (for LCD and Analog Input)

I got this cheap Arduino proto-board shield from the bay:


It has for example reset button, an extra momentary pushbutton, a couple of LEDs, a mini-pad to solder small SMD components and have access to them:



I wanted to make a custom shield to interface to an LCD (compatible with LiquidCrystal library) and to interface to three linear pots to get three different analog input sources. Since I wanted this shield to be stackable with the Arduino Ethernet Shield, I've chosen the following pin mapping for the LCD:

LCD:           Arduino:
 1 (GND) ----- GND
 2 (5V) ------ 5V
 3 (CNTR) ---- Trimmer
 4 (RS) ------ 7 (Digital)
 5 (RW) ------ GND
 6 (EN) ------ 6 (Digital)
 7 -----------
 8 -----------
 9 -----------
10 -----------
11 (D4) ------ 5 (Digital)
12 (D5) ------ 4 (Digital)
13 (D6) ------ 3 (Digital)
14 (D7) ------ 2 (Digital)
15 (+LGHT) --- +5V
16 (-LGHT) --- GND


This mapping means you need to initialize the LiquidCrystal library in the code as follows:


int numRows = 2;         // LCD number of rows
int numCols = 16;        // LCD number of columns
int pinRS = 9;           // LCD RS connected to digital pin 9
int pinEN = 8;           // LCD EN connected to digital pin 8
int pinD4 = 7;           // LCD D4 connected to digital pin 7
int pinD5 = 6;           // LCD D5 connected to digital pin 6
int pinD6 = 5;           // LCD D6 connected to digital pin 5
int pinD7 = 4;           // LCD D7 connected to digital pin 4


LiquidCrystal lcd(pinRS, pinEN, pinD4, pinD5, pinD6, pinD7);  // LCD library initialization

Here are the steps to add a strip to connect the three pots as analog inputs:





Here are the steps to wire a strip to connect the LCD (having also a trimmer for contrast adjustment and a jumper to enable/disable backlight):


Adding the female strips cut to size:



Here is the wiring of the analog inputs following the previous schema:



Here is the wiring of the LCD connector, following the previous schema:


Using a 90 degree bended strip:


making the 3-wire connectors for the pots:


then using a piece of cardbox to install the pots in a more useful panel (cuts thanks to an x-acto knife):


Then, preparing the LCD soldering a straight strip:



preparing the LCD connector after some cables salvaged from old electronics and a 90 degree bended strip:


and using another piece of cardbox to install the LCD and to host the shield behind the panel (cuts thanks to an x-acto knife):



Since the holes in the LCD are very thin, I opted for this fixing using single core wire and plastic tube for spacers:



That's all!