Nokia 5110 DIsplay (Graphic LCD 84x48 from Nokia 3310) [SOLVED]

nevermind, i got a little mixed up after trying several hours... :blush:
I can connect both devices (these: Mikrocontroller-Praxis.de Onlineshop)

code & wireing is like this:

// Adafruit_PCD8544(SCLK, DIN, DC, CS, RST)
Adafruit_PCD8544 display1 = Adafruit_PCD8544(A3, A5, D2, A1, D3);
Adafruit_PCD8544 display2 = Adafruit_PCD8544(A3, A5, D2, A2, D3);

In the setup() i'm just using display1.begin(); as well as in the loop() - i only write to display1 with display1.println()... but the second display ALWAYS shows the same data simultaniously, regardless which CS-Pin was set above – The CS-Pin has NO effect over here.

if i'm using the hardware SPI code:

// HARDWARE SPI
// pin A3 - Serial clock out (SCLK)
// pin A5 - Serial data out (DIN/MOSI)
// pin D2 - Data/Command select (D/C) - User defined
// pin A2 - LCD chip select (CS/SS) - User defined
// pin D3 - LCD reset (RST) - User defined
// Adafruit_PCD8544(CS, DC, RST)
Adafruit_PCD8544 display1 = Adafruit_PCD8544(A1, D2, D3);
Adafruit_PCD8544 display2 = Adafruit_PCD8544(A2, D2, D3);

this shows effect. i can choose to which display/CS-pin i want to write.
But: I can only write to ONE display. the call of displayX.begin() seems to kill all other screen instances.
doing so will result in emtyScreen for ALL displays.

ps. i've tried manually to set the active CS/SP to LOW an all others HIGH before i write to it, but without success so far.

vanderbreye, for things to work you need to have at least the CS and RST lines different for each display. Take the scenario like how you have it with common DC and RST lines. You call display.begin() which uses RST to resets BOTH displays and DC & CS to select the display and send commands/data to setup the display for use. Let’s say the DC (data/command) line being common is ok. Then you call display1.begin() which resets BOTH displays again but this time display1 gets setup using its CS and the common DC line. Now display is left in the reset state and won’t work!

I suggest you use seperate CD, DC and RST lines to test, then use a common DC line. Give that a shot and let me know how it goes.

1 Like

Well, that did the trick. (also seen it on https://forums.adafruit.com/viewtopic.php?f=25&t=38893&sid=f59fd1f556cbc18a3e2bb241992353dc&start=15) minutes before.

IT WORKS NOW. :slight_smile: thank you, peekay, you saved my night :smile:

2 Likes

Yesterday I added the Nokia 5110 to my project. On the Arduino I had it all working great, using the Adafruit libraries. Whereas the Adafruit_GFX library was easily found in the IDE (there’s even a multi-font version), I couldn’t find a matching Nokia 5110 library. Then I tried and wasted quite some time getting the Arduino code working and saw it wouldn’t be straightforward. Luckily, I then found this post and using @peekay123’s port of the Adafruit_PCD5488 library I got it working easily, without any problems. Thanks a lot!

@peekay123, if you can find some time in your busy schedule to publish this library and it’s sample .ino into the IDE, future IDE users may appreciate the easier inclusion in their project.

It would be nice if the libraries would include an optional auto-scroll feature to allow all println’s to be displayed, but perhaps that’s something for a future customization.

@maxint, I published the Adafruit_PCD8544 Nokia 5110 LCD library on the web IDE. To use it, you need to also add the Adafruit_GFX library also found on the IDE. :smile:

1 Like

Great! Thank you @peekay123. I’ve compiled the sample successfully.

The library .h file includes Adafruit_GFX.h (ofcourse). However, in my project I use the Adafruit_mfGFX_IDE library, which is the multi-font version. Do I need to fork the library and modify it in my own project to get it , or is there another way?

Sidenote: the .ino file has Nokia in its filename spelled as Noika…

@maxint, I will publish an mfGFX version shortly. Thanks for reminding me!

1 Like

@maxint, I just published the mfGFX compatible version of the Nokia 5110 display library called Adafruit_PCD8544_mfGFX. :smile:

2 Likes

Superb!
As soon as I have time to continue on my project I will incorporate that version…

Hi,

I’m new to Spark so apologies if this question doesn’t make sense.

I’m trying to use the above library (ADAFRUIT_PCD8544) in the example app but get the following error when compiling:

Adafruit_PCD8544/Adafruit_PCD8544.cpp:22:42: fatal error: …/Adafruit_GFX/Adafruit_GFX.h: No such file or directory
#include ā€œā€¦/Adafruit_GFX/Adafruit_GFX.hā€
^
compilation terminated.
make: *** [Adafruit_PCD8544/Adafruit_PCD8544.o] Error 1

Error: Could not compile. Please review your code.

Any ideas how I can solve this please?

Thanks

@the_fellowship, you need to ā€œaddā€ the Adafruit_GFX library to your app. You will find the library along with the other libraries in the web IDE. :smile:

2 Likes

Thanks @peekay123 that did the trick :smile:

1 Like

Can someone show me the connection diagram with the Particle?

My display arrived today, but it does work. I’m probably doing something wrong connection.

Thank you!

Has anyone tried this on a 'Photon"? I can’t get it to work. @peekay123

Maybe it’s just that the thread got confusing… any chance for a summary?
a) Primary library from which to use example.
b) Additional libraries to include
c) What pins are going where.

What we really need is a WiKi that includes devices by name and how to hook them up, with tested compatibility! No discussion, just concise info to check. Basically a RTFM for devices that we may hook up to Particle units.

@Awake, a LOT of libraries using direct GPIO will need to be updated for the Photon. A generalized HAL fast I/O API has been created so that it can be used on the Core, Photon, Electron and future devices so once it is fixed, it will stay fixed! The new firmware release is expected in the next two week for the Photon. It will, however, take a bit longer for the Core.

All this to say that we (Elites, Champions and members) will need to revisit our libraries once the new (Photon) firmware version is released. :smile:

I got mine working on Photon with the core library without any modifications.

Sorry for the bad picture. I’m compiling locally with the latest develop branch, so I’m not sure if that has anything to do with it. Check your SPI is correctly hooked up.

int blPin = A0; (I just connected it to 5V yours might fry with 5V so be careful!)
Nokia5110LCD::Display nokiaLCD(D2, D3, D4, blPin);
D2 = SCE
D4 = DC
D3 = Reset

and

_pinSDIN = A5
_pinSCLK = A3

1 Like

So which library did you use?
This is where a Wiki-like reference for specific devices would be useful, somewhere that people can go and see ā€˜minimally but proven functional examples’ for different devices.

This one:

SparkCore-Nokia5110LCD

My Nokia is from ebay, not from this vendor though but the same

EDIT: I did make a small change in the library that instead of analogWrite for the bl pin I used D6 as it works better with HIGH (without brightness control but I don’t need it)

EDIT2: I’ll upload a pic if the ebay link disappears

@peekay123 Please help me!

I do add your library Adafruit_PCD8544 and the Adafruit_GFX

and I'm getting a lot of this errors:

Adafruit_GFX/Adafruit_GFX.cpp:36:0: warning: "pgm_read_byte" redefined [enabled by default]
#define pgm_read_byte(addr) (*(const unsigned char )(addr))
^
In file included from ../wiring/inc/spark_wiring.h:37:0,
from ./inc/application.h:36,
from Adafruit_GFX/Adafruit_GFX.h:4,
from Adafruit_GFX/Adafruit_GFX.cpp:34:
../wiring/inc/spark_wiring_arduino.h:32:0: note: this is the location of the previous definition
#define pgm_read_byte(x) (
(x))
^
Adafruit_PCD8544/Adafruit_PCD8544.cpp: In member function 'void Adafruit_PCD8544::fastSPIwrite(uint8_t)':
This looks like an error in Adafruit_PCD8544 library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
Adafruit_PCD8544/Adafruit_PCD8544.cpp:213:34: error: 'struct GPIO_TypeDef' has no member named 'BRR'
PIN_MAP[_sclk].gpio_peripheral->BRR = PIN_MAP[_sclk].gpio_pin; // Clock Low
^

This looks like an error in Adafruit_PCD8544 library. Would you like to create an issue on GitHub to let the author know?
CREATE ISSUE
Adafruit_PCD8544/Adafruit_PCD8544.cpp:216:34: error: 'struct GPIO_TypeDef' has no member named 'BSRR'
PIN_MAP[_din].gpio_peripheral->BSRR = PIN_MAP[_din].gpio_pin; // Data High
^

etc... a lot of them, what's wrong?

I'm compiling the Noika5110 example

@DanielCuartas, the library has not been updated to work with the latest firmware for Core and Photon! I’ll try and get to it soon.