One of the major problems plaguing the RasPi is the lack of GPIO, and the weird placement and random numbered GPIO pins broken out, making any code using them much more disorganized than if consecutive GPIO pins had been used. In addition to the inconvinience of using the GPIO, the LCD uses 5v, while the RasPi is strict 3.3v. In order to prevent any chance of damage to my Pi, and to solve the problem, I opted to use a PCF8574 I2C 8 bit IO expander. This makes it easy enough to use the bottom four bits of the expander for LCD data, and the next 3 bits for RS, R/W, and EN. To control the LCD this way, I wrote up a nice library to get things working on the lcd. In addition to this, I added a few extra bits to the library so that anyone can add more devices to it, and wrote a class for the tmp102 so we can have some live data to display.
|The Raspberry Pi wired up to a serial bridge, PCF8574 Port Expander,|
and a tmp102 12bit temperature sensor
This library makes it very simple to use both these devices with the RasPi. Before using the library, you must load the i2c-dev module. At the time at which I started this project, the default Raspberry Pi linux tree was outdated and did not include spi and i2c userspace drivers.
After you get your new kernel installed, load the i2c-dev module, and place pylcd.py in whichever directory your working in, then we can move on to a simple sample program.
https://gist.github.com/2962884 The libraries somewhat regularly updated gist