Software experiences.

Last time I had stopped saying that my next task would be to make my LCD display, a Nokia 5110 work with the Edison.

Using that display in a number of Arduino projects, I was quite happy with the U8Glib library that could cover all shorts of graphics including a number of quality true type fonts.

The bad news however, came when I tried to test compiling with that. I got an incompatibility message saying that the library was only for Arduino or AVR, so it could not be used or ported to Edison, I had to try my luck with the newer version U8G2 which was written in a way that could be ported to other systems. Once more I felt happy that reading over the well written and extensive documentation on Oliver Kraus's Github ( , I could get a feeling on how this thing could be done.

So I learnt about the constructor, the functionality and what needed to be done to make that library work with another mcu or processor. Oliver had already done that with some other processors and even had a compatibility chart in his site (

But not Edison, so there was some challenge ahead.

Before doing so, as I did not have any experience with U8g2, I thought it would be wise to try to convert my existing code in a way that it could use the new library that had a number of extra features, but also some differences in some functions. Again looking at U8g2 site, I found the very useful comparison document between the old and new library. (

If one wants to learn more about it, I would advise to go through Oliver's site. Even the fonts manual is very nice and useful if you want to design a project for a monochrome LCD from scratch. (

It took me two days to understand how the new library works and tested my LCD with an Arduino board as I also wanted to become familiar with how to make the crossing from the one system to the other Edison). Having everything working properly, I got the same results on the LCD as with the previous library. So I decided to test the next step. Hook it on Edison.

I got a small test program, as my testbed. When trying such tasks I want to have and see everything in one screen.

I tried that sketch with the Arduino IDE and the Arduino Edison board.

At first I wired the LCD with the Arduino Edison board according to my previously published schematic because I thought that if would work with a UNO R3, it should work with the Edison as well. But not exactly. More on that later.

Hardware wiring or drawing schematics does not worth anything if the software does not compile, so I thought that the next milestone was to make the test to compile. But how.

I had not found anyone that had successfully implemented a Nokia 5110 with Edison. I found some discussions on Intel's community, but one of them did not respond and the other one simply told me that he gave up. Strange enough, both cases were considered as answered and closed an issue that I a retired GM I could argue for days, but not anymore. My planner clock was ticking and Mark was right, we should not waste our time with things that can take you out of your plan. OK, I had some margins but I decided that I was on my own and I had to solve everything by myself.

I also found an Edison project, Helpman Clock ( that was using a Nokia 5110 LCD, but again I did not find everything on Github, libraries were not present, I tried to guess the libraries but they did not provide any compiling result, so I gave it up. My time for the LCD interface task was one week, it was Easter week and there were family obligations, so I had to make the best of my time.

I wanted to have a library for 5110 LCD that would not only work with Edison under the Arduino IDE, but then also with XDK environment as my final program has to be in Javascript in order to decode properly the HTML/JS Audio Stream.

So the “working” with Edison U8g2 library eventually will have to be “recompiled” in order to be included to the upm 1.1.0 Sensor/Actuator repository for libmraa (v1.5.1)  so that it can be he accessible with node.js ! Well this is the next task.

But back with our test. To make the U8g2 library work with another processor you must do the following process where a new 8gu2 library dependent LCD constructor should be used.

In my case:

PCD8544 84X48

Controller "pcd8544", Display "84x48" (Nokia 5110)

u8x8_Setup(u8x8_d_pcd8544_84x48, u8x8_cad_001, u8x8_byte_4wire_sw_spi, uC specific)


By reading the manual you get an idea. (

If you look at the attached code below you will understand as finally it was much easier.

The instructions for setting the constructor can be found here:


But from the first moment I got stuck with the 4th parameter of the above setup. UC specific, in other words microprocessor specific, aka Edison). The manual again explained about it. (

But it seemed to be a long way in terms of 24 hour/day time system.

So I contacted Mr. Kraus to seek some guidance as I was not so sure about the results of such task from a Ham like me.

He responded immediately and said that if I used the Arduino version of C++, U8g2lib, it should work “out of the box”! However, he did not have an Edison himself to have it verified.

I was amazed. I counted on his experience. It did not take long to make a verifying compilation to see if it worked.

Meanwhile I had become familiar with all the components that you needed in order to build a new library from scratch so my communication with him was on the right level.

For my Nokia 5110 I selected the 3rd option from the following table, that supported not only 2 page buffer but full Frame buffer that could include graphics. I say the 3rd option which is Software SPI, as it was the same with the one I had been using for my display with Arduino MCUs.

PCD8544 84X48

Controller "pcd8544", Display "84x48"


U8G2_PCD8544_84X48_1_4W_SW_SPI(rotation, clock, data, cs, dc [, reset])

page buffer, size = 88 bytes

U8G2_PCD8544_84X48_2_4W_SW_SPI(rotation, clock, data, cs, dc [, reset])

page buffer, size = 176 bytes

U8G2_PCD8544_84X48_F_4W_SW_SPI(rotation, clock, data, cs, dc [, reset])

full framebuffer, size = 528 bytes

U8G2_PCD8544_84X48_1_4W_HW_SPI(rotation, cs, dc [, reset])

page buffer, size = 88 bytes

U8G2_PCD8544_84X48_2_4W_HW_SPI(rotation, cs, dc [, reset])

page buffer, size = 176 bytes

U8G2_PCD8544_84X48_F_4W_HW_SPI(rotation, cs, dc [, reset])

full framebuffer, size = 528 bytes


By looking at the various members that constituted the U8g2 library, I had my concerns.

The first one called from my test sketch was <U8g2lib.h> which was the C++ Arduino wrapper for the u8g2 struct and c functions for the u8g2 library and the <U8x8lib.h> which was the C++ Arduino wrapper for the u8x8 struct and c functions.

Both programs had calls to an extensive universal C library with functions, but I thought that if something could go wrong would be in one of the above files.

So I tried to verify my testbed sketch which is:


//This demo was taken from Oliver Kraus U8g2 library and modified for my needs accordingly.
//All credits to Oliver

#include <Arduino.h>
#include <SPI.h>
#include <U8g2lib.h>

/* Constructor */
//U8G2_LCD PINOUT DEFINITION  /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8)==> MUST STAY LIKE THAT
U8G2_PCD8544_84X48_F_4W_SW_SPI u8g2(U8G2_R0, 13, 11 , 10, 9 , 8); // Worked fine with my setup on Arduino Mini Pro and Uno3.
// Now it had to be verified with EDISON
/* u8g2.begin() is required and will sent the setup/init sequence to the display */
void setup(void) {

/* draw something on the display with the `firstPage()`/`nextPage()` loop*/
void loop(void) {
  do {
    u8g2.setFont(u8g2_font_ncenB14_tr); // JUST SEECTED A BIG FONT
    u8g2.drawStr(0,20,"Hello K.");
  } while ( u8g2.nextPage() );

I tried to verify the sketch and sadly enough I got the following errors:


Arduino: 1.8.2 (Windows 10), Board: "Intel® Edison"

  Build options changed, rebuilding all

C:\Users\KOSTAS\Documents\libraries\U8g2\src\U8x8lib.cpp: In function 'uint8_t u8x8_byte_arduino_hw_spi(u8x8_t*, uint8_t, uint8_t, void*)': 

  C:\Users\KOSTAS\Documents\libraries\U8g2\src\U8x8lib.cpp:396:11: error: 'class SPIClass' has no member named 'beginTransaction'

        SPI.beginTransaction(SPISettings(u8x8->display_info->sck_clock_hz, MSBFIRST, internal_spi_mode));


  C:\Users\KOSTAS\Documents\libraries\U8g2\src\U8x8lib.cpp:396:101: error: 'SPISettings' was not declared in this scope

        SPI.beginTransaction(SPISettings(u8x8->display_info->sck_clock_hz, MSBFIRST, internal_spi_mode));


  C:\Users\KOSTAS\Documents\libraries\U8g2\src\U8x8lib.cpp:419:11: error: 'class SPIClass' has no member named 'endTransaction'



  C:\Users\KOSTAS\Documents\libraries\U8g2\src\U8x8lib.cpp: In function 'uint8_t u8x8_byte_arduino_hw_i2c(u8x8_t*, uint8_t, uint8_t, void*)':

  C:\Users\KOSTAS\Documents\libraries\U8g2\src\U8x8lib.cpp:469:7: error: 'class TwoWire' has no member named 'setClock'



  Multiple libraries were found for "Wire.h"

Used: C:\Users\KOSTAS\AppData\Local\Arduino15\packages\Intel\hardware\i686\1.6.7+1.0\libraries\Wire

Not used: C:\Users\KOSTAS\AppData\Local\Arduino15\packages\Intel\hardware\i686\1.6.7+1.0\libraries\Servo

exit status 1

Error compiling for board Intel® Edison.

  This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.


OK. Definitely something wrong with the interfacing of the SPI or some kind of incompatibility between the way U8g2 libraries defined SPI and I2C.

Having in mind that U8g2 is a library that has quite a number of LCDs you can select from and that not all of them use Software SPI, I contacted Oliver and told him about the problem.

To shorten my story, we decided for my use to eliminate the interfacing to Software SPI and then to try again.

How we did it? Following Oliver's guidance, I opened the <U8x8lib.h> file and I commented the code in two points, starting at line 48.

48 /* Assumption: All Arduino Boards have "SPI.h" */

49 //#define U8X8_HAVE_HW_SPI


51 /* Assumption: All Arduino Boards have "

52 //#define U8X8_HAVE_HW_I2C


So only Software SPI remained as active. I know that one may argue that Hardware SPI is faster, but in anyway that was what I was using with the ATMega328 MCU and worked fine for me. So with Edison there should be no problem.

Then I tried my code again. I run Verify and yes, it passed the test and got verification that my sketch was compiled.

But I had no hardware to Upload to.

I had even delayed my writing as of yesterday.

So I then connected the Edison Arduino board and wired the LCD according to my published schematic.

I connected my netbook, detected my COM4 port for Edison and I fired the Upload. It passed OK but no result on my LCD!

I checked voltages and everything was fine. But no output. I checked my pinout. It was according to what I had done almost half a dozen times with Pro Mini and Uno R3.

I was at a halt again.

I then thought to try changing the pins and use the standard SPI definition for Software SPI with Edison.

Quite an easy task.

I then went over my code and changed the pin numbering based on that standard definition.

I plugged the power and USB again and after my Edison board was detected I Uploaded again.

Here is the result:


After that, I said that it was enough and although the backlight of the LCD through pin 12 needed to be checked, I considered that the most important part of the job had been done. The rest was a small piece of the cake.

It was more important to finish my writing first. I was already one day behind schedule.

One last notice.

My method of connecting the Nokia 5110 LCD to Edison uses the Software SPI method, so for the time being U8g2 library works with Edison under the conditions described above.

I do not see the reason that it should not work with other LCD displays included in the library, as far as they use the Software SPI interface.

Again my greatest thanks go to Mr. Oliver Kraus for his guidance and assistance.

My plan for the rest of the week. 

Porting the library to MRU and make it work with node.js

Solve the Backlight issue

Correct the connecting pins on my schematic (for the time being they are printed on my sketch)

Try the audio usb adaptor

Try the WEB Audio API if things go well and I still have time.

Enough for today, it was a long but exciting and rewarding day. I am sure you will all agree.



Published Posts
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #1: Introduction
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #2: Software Concept
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #3: Meeting with Edison
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #4: Software Challenges with Edison
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #5: The Software Challenge goes on
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #6: Changing the Display
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #7: Hardware is ready!
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #8: Problem with Audio.
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #9: Problem with Browser
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #10: Making the Web SDR Client work!
[Upcycle it Design Challenge] Embedded Web SDR client on Analog Radio Receiver #11: One of its kind!