A couple of weeks ago, I just post a review of my MCP23017 breakout board. As the board configuration allows to connect up to 8 of these boards, I decided to do it and see that it really works. My goal is interface 8 LCD displays with two wires: SDA and SCL from an I2C bus. With direct IO`s of a microcontroller, you need at least 48 lines to control all the displays. With this option (and a little of software, of course), you can do this with only two lines.
- The hardware
The first thing to do is mount the 8 boards. Schematics of the board is available here. Nothing new here, the only thing to consider at this time is to set the address of each board. This is done with the jumpers JP1 – JP3. For this components, I use a 0805 footprint in the PCB, so it’s esay to mount the 0 ohm resistors in the adequate position:
The eight boards assembled and ready to use
Resistors to set the address of each board
Top layer mounted
Also, I populated a 4-way polarized connector in order to prevent errors in the connection of the boards, avoid short-circuits between boards. The LCD used is the Winstar WH1602B-NYA-ET#, a standard 2×16 LCD, whit the only disadvantage that this model hasn’t backlight. In the manufacturer web, there’re some examples of code and schematics, including both 4 and 8 bits parallel mode.
- Boards connection
The most tedious task is to find and mount the 8 LCD’s. How or where I can mount it? Well, after thinking the form of do this, I used two backplane guides to mount all the displays. I use 2,5mm screws to fix it. The result is a bit unstable, but the global mount can handle easy:
After half an hour, I finish the assemble of the 8 displays. Now, it’s time to make the wire to connect all. I use the housing connector that matches with the polarized ones, and makes a chain cable: in each connector, I crimp two wires (except in the first and in the last ones). Here is the result:
One wire to connect all!
Assembly completed, from the bottom layer
- The test software
Like in my other projects, I use the DSETA CPU. It’s a generic board based on the AT89C51RE2 microcontroller, an 8051 core with a lot of peripherals from Atmel. This board has an I2C connector (software bus) to interface with I2C devices powered at 5V. So, with SDA and SCL (and, obviously, +5V and GND), I can connect the 8 LCD with this board. All the system is powered from the USB port, eliminating the need to have an external power source:
Connecting the CPU to the 8 LCD and power up with the USB port
I write the software in C for the Keil C51 compiler. The project is esay: I try to adapt the previous functions to manage the 8 devices. To do this, now all the related functions has a new parameter, that indicates the MCP23017 device that you want to use. First, the software initializes the 8 MCP23017 and, to ensure the initialization is correct, turns on both green and yellow leds on each board:
Green and yellow led’s indicating a correct initialization
Once that all the devices are initialized, it’s time to initialize each LCD. To do this, I use the LCD_init_I2C function, one time for each display. After, I show a message in each LCD to ensure they’re working OK. In the first line, all shows the same test string. In the second one, it appears the software version and the number of display (from 0 to 7). Here you can download the source code: SW_8xLCD_TEST. In a future entry, I try to develop an application where I can use this configuration to do something interesting. Any suggestion? 🙂