Nokia 5110 and Nano 33 BLE

Hello,
I am trying to make working Nokia 5110 display with Nano 33 BLE board. Previously I have used succesfully only UNO with Adafruit_PCD8544.h library (and also Adafruit_GFX.h). There was no problem at all.
In case of Nano 33 Ble I have got few foults during compilation:
.....\Documents\Arduino\libraries\Adafruit_PCD8544_Nokia_5110_LCD_library\Adafruit_PCD8544.cpp: In member function 'void Adafruit_PCD8544::begin(uint8_t, uint8_t)':
.....\Documents\Arduino\libraries\Adafruit_PCD8544_Nokia_5110_LCD_library\Adafruit_PCD8544.cpp:276:9: error: 'class arduino::MbedSPI' has no member named 'setClockDivider'
SPI.setClockDivider(PCD8544_SPI_CLOCK_DIV);

Does it mean that this PCD_8544 library is not for Nano 33 boards ?
Eventually which library is best checked for new Nano 33 ?

Many thanks in advance for any advice.

The authors of the MbedSPI class were lazy.

SPI works with Settings and transactions but not with individual methods like setClockDivider()

The whole SPI class is incredibly slow even when you fix the setClockDivider() issue.
It is a good example of how sheer laziness can cripple a high performance MCU.

It should be fairly simple to offer a Pull Request to the MbedSPI developers.
First off, someone has to write and test a fix.
And the developers accept it.

David.

The above may be about Arduino's hardware SPI bus, and comment about it may be irrelevant. I can only guess at what this setClockDivider is about but, as I understand it, the 5110 uses its own software SPI. This makes me suggest that you should ensure a clockdivider is included therein.

The only other 5110 library I know of is from RinkyDink Electronics. I don't know if it will fix your problem.

Hello,
Thank you for replying me. It was my first post on this forum.
Your conclusions are really sad. I was thinking to change my hardware platform from Pro Mini 3.3V for something better. Nano 33 BLE seems to be perfect, but .... no yet.
So far I have tryed tu use Nokia5110_TEXT library available from Arduino IDE library manager (the last one)
and it has started with my Nano33. It seems to be also perfect during reading about. Unfortunatelly it works only with basic font type (and load bitmaps also). Other font types listed in description seems to be not present.
Maybe I have to test it with regular UNO but first I will go to test your final advice - RinkyDink library.
I will report my experience.

Unfortunatelly RinkyDink also has some troubles.
Seems to be that Nokia 5110 is excluded from cooperation with Nano 33 BLE.

I don't know what the problems would be with the Nano33 but, while I have been a great fan of the 5110, and use several, I'm not sure I would rush out to buy one in 2020. There are small OLEDs around these days with better resolution, better clarity, and not much more expensive. I don't understand why you have a compatibility problem with the 5110, I don't even know if it is true, but any incompatibility is even less likely with an OLED, so you might look there.

Hello,
Regarding Rinky Dink Library I have been in touch directly with Mr Henning Karlsen (owner) and he has confirm, that his Nokia 5110 libraries are not compatibile with board Nano 33 family.
Unfortunatelly I am not so advanced guy to develope my own driver.
Nokia5110_text library works but doasn’t have any other fonts except standart. To be sure I have also check it on basic Pro Mini 3.3 board. Behavior the same as on Nano 33 Ble. It is not due description, I don’t know how to contact with creator. Mayby I am doing something wrong.
Thank you Nick_Pyner to adviceing me another options like OLED display, this time. I am going to buy one (not expencive) today and check it.
On the other hand, is there anyone with any experience to match display to Nano 33 Ble ?
It is a really nice board (at least in the brachure).

If I get a moment I will try Adafruit_PCD8544 with bit-bang constructor.
And U8g2lib with both HW SPI and SW SPI

I am impressed that you got a friendly response from Mr Karlsen.

David.

Adafruit_PCD8544 fails.

U8g2lib works ok with Software constructor e.g. GraphicsTest.ino with

U8G2_PCD8544_84X48_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  // Nokia 5110 Display

Likewise with the Hardware constructor:

U8G2_PCD8544_84X48_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); 		// Nokia 5110 Display

U8g2 has different Graphics methods to Adafruit but it should be easy to edit the code.
I suggest that you use U8g2lib. It has excellent Fonts. It can do most graphics and text operations.

Note that Adafruit libraries evolve over time. Likewise, the MBED BLE Core will probably fix the SPI problems one day.

David.

Hello,
In fact, it works ! I have never heard about this library. It is really great (big). It has so many fonts and functions that it is probably a reason to occupate a lot of memory. There is also nice manual, much to read.
I have just bought a new oled display to test and then found your reply.
Thank you David .

Tomasz

The MBED BLE core is incredibly SLOW to compile. But hey-ho, it does work.

U8g2lib is cleverly made. It only links with what it actually needs. The Fonts are efficiently stored. Just build your sketch for a Uno and observe the memory use.

And most importantly, it will work with most OLEDs, GLCDs, ...
You just change constructor (and adjust geometry if required)

David.

I have already built my sketch for Uno/Pro Mini with Adafruit libraries and my memory is almoust finished. Probably this project with U2g8lib will fail in UNO. I was looking for something easy to simply put it into new board with a great memory, strong CPU etc.
Recently I will have a lot of work to rewrite everything. But .... there is o chance.
In fact, compilation is really slow for Nano 33.

Greetings from Poland

Tomasz

Hello,
I have also tested OLED 1.3' (spi/i2c) WaveShare display with U8g2Lib (only hardware spi) and it works fine.
I have also tested Adafruit_1106 library with no succes.
Seems to be that U8g2 is the only serious option for Nano 33 Ble users.
In my case it means a lot of work to rewrite existing sketch.

Tomasz

How big is your sketch ?

Several choices:

  1. Edit every statement manually.
  2. Use a SED / AWK script to automate the translation
  3. write a GLUE class that receives your methods and converts to equivalent U8g2 methods.

Since Adafruit and MBED_BLE will probably fix these problems in due course of time I would continue development with GFX-style methods.
So (2) or (3) are attractive.

If you intend to use U8g2 permanently (1) or (2) are better.

(3) requires a fair amount of patience and debugging.
And any translation will still have some gotchas.

I assumed that any Nokia5110 project would be pretty small and simple.

David.

David, you are overestimate me. I have never heard about SED/AWK script and GLUE class.
I have done my sketch under pressure to have something usefull to me. I had luck, it works.

This situation remains me a history with PC computers which are stronger many times over years but software does similar things like in DOS era, howaver occupates much more space and computer resources.

I have to think over all this things. The last elements to check regarding Nano 33 board is::

  • photo camera connection
  • what about EEPROM which is probably missing. I need to safe some calibration values. Should I add SD card reader ? I don't know.

Tomasz

I don't know either.

It is much easier to answer questions when we have information.

It is ok to manually edit a 100 line program.
It is not practical for a 1000 line program.

If you have written a GFX-style program for Uno, Mega, Due, ...
you really don't want to change to U8g2 methods.

On the other hand, if multiple Fonts with different languages etc are important, U8g2 would be the best library.

If you attach your project we could see what is practical or not.

It is probably just as easy to edit the Adafruit_PCD8544 library files to support your BLE board.
Which requires willingness from a reader and willingness from you to do any testing.
Then we can offer the "fix" to Adafruit as a "Pull Request"

David.

Hello David,
Do you think I am able to edit (correct) Adafruit_PCD8544 library ??
I was not so brave to think I am able to do that. I don't afraid abut my patience and desire to test. I rather don't belive in my abilities.
Can you advice me how to start to analyse this library ?

Tomasz

I would not expect you to analyse the library.

Which is why I asked about "number of lines" and complexity.
And what was important. e.g. fonts, graphics, ...

If you post the sketch, someone might edit for you.
Obviously you don't want to post anything that is commercially sensitive.
If the task interests someone, they might "fix" the Adafruit_PCD8544 library for you (and the rest of the community).

David.

My sketch is nearly 1200 lines long (plus libraries). That is why I have mentioned about memory shortage.
I have already resign from IMU library and managed it myself from this purpose. Adafruits package (PCD8544 + GFX) is to big for me. I can resign from complicated grapf . In fact text lib with one basic fonts and few sizes of digits are OK for me.
On the other hand I am very exited with OLED display I have bought this days (it uses SH1106 driver).
Unfortunatelly corresponding Adafruit lib also failed with my Nano 33. U8G2 lib works with no problem in both variants SPI and I2C.
Mayby a time to try something else has come ? I have to think it over.
Anyway a discassion on this forum is really precious because I am not familiar with electronics.

Tomasz

My sketch is nearly 1200 lines long (plus libraries). That is why I have mentioned about memory shortage.
I have already resign from IMU library and managed it myself from this purpose. Adafruits package (PCD8544 + GFX) is to big for me.

I don't understand. The Nano33_BLE has enormous memory but even a Uno should have enough Flash.

In fact text lib with one basic fonts and few sizes of digits are OK for me.

In which case PCD8544 sketches can even run on smaller than Uno.

U8g2 supports regular print() statements just like Serial.print()
So changing syntax is not much more than creating an equivalent setCursor(x, y)

As I said earlier, attach your sketch and you would get appropriate advice.

Fixing Adafruit_PCD8544 is not going to affect many readers.
Adafruit_SSD1306 would be much more popular.
"Adafruit_SH1106" was never written by Adafruit. The third party author does not seem to be active for Adafruit_SH1106 support.

David.

Hello,
So far my sketch goes only on Pro Mini 3.3V. It runs, but I know that I am very near to memory maximum.
I would like to move in future to something better (regarding memory) and maybe more powerfull. I am exerciseing now with Nano 33 which seems to be nice. I didn't said that this board has not sufficient memory space for me.
I am testing also another display, as you already know.
Thank's of you I have 'noticed' OLED's. Maybe it is time to leave nice Nokia 5110 anyway ?
Give me please a little time to play with few of them and I will come back in a short time.
(I am much less advanced then you, so sometimes I have to read your notes few times to understand, sorry)
Greetings
Tomasz