Nokia 3310/5110 display on RPi


I wanted to have a little bit more fun using the Raspberry Pi so the idea which came in my mind was “you have a great heating system control software, but you must use a browser: you have no direct interface”… so I decided to add a display to the system.

I am still working on this but here’s what I’ve done up to now.


The display works on the SPI bus, which is provided by the RPi hardware. Unfortunately the SPI pins were already used, but in the Adafruit LCD library there also is support for SPI emulation via GPIO. So you can use any standard GPIO for this.

But a problem came out: I had too few GPIOs left to do that 🙁 luckily googling I discovered  the great I2C bus. So I studied it a bit and I bought a MCP23017, which is a circuit which expands your GPIOs.

Great!” was what I thought at the beginning but…. MCP23017 gives you 16 extra GPIOS (and you can connect up to 8 circuits = 128 extra GPIOS!) but they cannot be used with the RPi.GPIO library. So this was the first problem: provide an abstraction layer which works like the GPIO library, but using the I2C.

Well, after few coding I created a library which provides the same exactly methods as RPi.GPIO but “below” it works differently.

“Why? why not using I2C library from Python?” Well… with this library I can use all Python softwares which use GPIO with the I2C, without needing to re-write the source (just need to change “import RPi.GPIO as GPIO” to “import BV.GPIO as GPIO”…

How much abstraction! In fact the LCD works with SPI emulation over GPIO emulation over I2C… and it’s a little slow to refresh… But that was better than modify all my heating control system!

Now I am studying how to use the LCD library to display something nice, but… the display works and I am proud of this.

The bad fact of my GPIO library is that, if your software uses  it, it can access only I2C-emulated GPIOS and not standard ones anymore. BTW I am working on letting it support both: if you pass it a I2C pin, it does what it has to, else it calls the RPi.GPIO library… so you can build software with “hybrid” support.

More info soon!


Leave a Reply

Your email address will not be published. Required fields are marked *