Friday 28 September 2012

3310 LCD and the Raspberry Pi

WHY?
The LCD display is very crude. However it consumes very little power, is cheap to find. It is also well supported in the Hack/Maker comunity. A small display may be usefull for initial setup or status monitoring of mobile, battery driven projects. For example it could show IP address to allow WiFi connection or could display nuber of pictures taken on an automatic camera.

There are plenty of projects relating to the LCD display found on 3310s and other phones. I purchaced some PCB sockets to connect to the IO pins of the raspberry pi from EBay.

These can be placed on the IO pins. Wires can be easying soldered to the connector before they are connected. This is ugly, but ideal and cost effective for Raspberry Pi "projects".

To talk to the LCD display you need two GPIOs and some SPI. The LCD required an addition capacitor that I fitted and the connector end of the cable. The display will just about run from the 3.3 volt supply on the IO pins but I suspect this will be the only thing you can power from this supply.

I soldered directly onto the display, this was VERY fiddly. I used standard ribbon cable, others suggest using the FFC style (Flat Flexable Cable) that can be found oinside discarded electronics such as CD dirves.

I used the "wiringPi" project for my GPIO, SPI and timing. I used one of the many AVR based LCD drivers, (I will try and post more info).

To get the SPI driver to appear I needed to edit a system file to remove the SPI from a "blacklist". Google this for now, I will try and find the link and add it here.

GPIO and SPI appear to only work if you run as su. I created a su login using the sudo passwd command to make this easier.

CONCLUSION: So far I have demonstrated that with the LCD display can be driven from raspberry Pi with only the addition of the 4.7uF capasitor. The Rapberry Pi will power and control the display. The displayed results were not as expected. This is due to known issues in the way I have ported the code from AVR to Raspberry Pi. The project is still WIP. I will try and post updates and perhaps some code when I have it working better.

4 comments:

  1. Hi,

    Could you tell me how you wired between raspbery and lcd 3310? I don't understand, spi is emulated?
    Thanks,

    ReplyDelete
  2. SPI is not emulated. It is built into the Pi chip. The LCD also uses SPI. There is a driver with rasbian, and I think other distros, Follow the wiringPi link above to get C software that contains the tricks for talking to the driver via standard IO functions. I'm sure other languages example are available. As default the driver is black listed. (sorry ,you will have to search for this. I do not know the path to the file. Edit the blacklist by adding comments in front of the driver names. The setup is via standard IO functions, then you can write data. I have not played with it too much but there are, I think, two chip selects. I think there is a different driver name for each. I guess you could talk to two devices and the driver would arbitrate for you to avoid collisions. Not sure. Most diagrams of the IO port show GPIOs and the alternative names for SPI with chip selects, I2C and "RS232" (3v3 UART)

    ReplyDelete
  3. Ok, I thought spi was emulated, because all schematic that I saw, wire spi pins didn't connected, they worked with GPIO pins. Finally I get work with lcd 3310, I follow this web, there is full instruction to do it. This works with wiringPi and PCD8544 library in C, http://binerry.de/post/25787954149/pcd8544-library-for-raspberry-pi.

    Thanks a lot Billy.

    ReplyDelete
  4. Great stuff, yep, the pins are multi use. Googling the port will show some diagrams with the alternative names. Also very confusing that there are some differences between rev 1 and rev2. And I think the Pi names and the actual chip names are different too.

    I have stalled on this project, started writing my own code. I will check the link, this may be what I need to get it started again.

    ReplyDelete