5 Replies Latest reply on Jan 5, 2016 8:31 AM by geotheory

    Nokia 5110 LCD running slowly


      Hello guys, I am using the Nokia 5110 LCD in a project with the Edison running Ubilinux. As you can see in this video (https://youtu.be/ZOnb-HNS0sc), it is running very slow. The code that is running in this example is based on the Adafruit Nokia LCD library (https://github.com/adafruit/Adafruit_Nokia_LCD) which requires Adafruit Python GPIO library (https://github.com/adafruit/Adafruit_Python_GPIO). This library provide a cross-platform GPIO interface on the Raspberry Pi and Beaglebone Black; however, I made some changes to make it work on Edison running Ubilinux. The only problem is that it is running very slow. As you can see in the code below I am using software SPI (I tried Hardware SPI but it didn't work). Does anyone have a similar issue before or have an idea in what may be the problem?

      import math

      import time


      import Adafruit_Nokia_LCD as LCD

      import Adafruit_GPIO.SPI as SPI


      from PIL import Image

      from PIL import ImageFont

      from PIL import ImageDraw


      # Edison hardware SPI config:

      #DC = 36

      #RST = 48

      #SPI_PORT = 5

      #SPI_DEVICE = 1


      # Edison software SPI config:

      SCLK = 10

      DIN = 11

      DC = 36

      RST = 48

      CS = 23


      # Hardware SPI usage:

      #disp = LCD.PCD8544(DC, RST, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=$


      # Software SPI usage (defaults to bit-bang SPI interface):

      disp = LCD.PCD8544(DC, RST, SCLK, DIN, CS)


      # Initialize library.



      # Clear display.




      # Create blank image for drawing.

      # Make sure to create image with mode '1' for 1-bit color.

      image = Image.new('1', (LCD.LCDWIDTH, LCD.LCDHEIGHT))


      # Get drawing object to draw on image.

      draw = ImageDraw.Draw(image)


      # Draw a white filled box to clear the image.

      draw.rectangle((0,0,LCD.LCDWIDTH,LCD.LCDHEIGHT), outline=255, fill=255)


      # Draw some shapes.

      draw.ellipse((2,2,22,22), outline=0, fill=255)

      draw.rectangle((24,2,44,22), outline=0, fill=255)

      draw.polygon([(46,22), (56,2), (66,22)], outline=0, fill=255)

      draw.line((68,22,81,2), fill=0)

      draw.line((68,2,81,22), fill=0)


      # Load default font.

      font = ImageFont.load_default()


      # Alternatively load a TTF font.

      # Some nice fonts to try: http://www.dafont.com/bitmap.php

      # font = ImageFont.truetype('Minecraftia.ttf', 8)


      # Write some text.

      draw.text((8,30), 'Hello World!', font=font)


      # Display image.




      print 'Press Ctrl-C to quit.'

      while True: