Arduino Uno behaves crazy when I connect LCD or Bluetooth modules

Dear all,

Could you please help me to understand what is going wrong, whenever I use Nokia 5110 LCD display with my Arduino Uno ?

I am building a two finger gripper using Arduino Uno. There are 1 ultra-sonic sensor for object detection, two FSRs connected to each arm to detect pressure on object and a servo motor controls the finger closing and opening motion. All my functionality is working fine, and I can see output via Serial.begin(9600).

The issue started, when I added, a NOKIA 5110 LCD screen. I used Adafruit_PCD8544.h library.
Whenever I put the command to put char into display using display.display(), the Arduino behaves randomly. It starts going into some other loop, then comes back to same loop, as if it went crazy.

I used a couple of other libraries as well, like LCD5110_Graph.h, and the same problem happened.

I learned from few similar forums, that I should put some delays for 20~50ms to resolve this, but that didn't help. Arduino cannot be faulty, because it works perfectly, when I remove the display.display() for Adafruit_PCD8544.h or myGLCD.update() for Library LCD5110_Graph.h

Could you please help me to understand, what gets wrong?

As I suspect,

  1. There may be specific things, which may be forcing Arduino to be out of clock sync ?
  2. Clock speed of NOKIA 5110 LCD and Arduino----are both same ? and 16MHz ?

Please help.

Kind regards,
Vivek

Can you post your exact code in tags?

vivek_ban:
2. Clock speed of NOKIA 5110 LCD and Arduino----are both same ? and 16MHz ?

I'm pretty sure that the 5110 doesn't have a clock of any speed. What I am certain of is that the 5110 works perfectly with Arduino, and any problems are due to user error. You might try a simple "hello world" project that uses the LCD alone, thereby isolating the problem.

@Nick_pyner, yes the "hello world" program runs fine. However, when I try to use the servo motor position status in the LCD, then all the analog devices starts giving random results.

Servo motor starts random turns, which is not programmed. Force sensors gives random values. Even the ultrasonic sensor detects objects when there are no objects present.

I am using the serial display as 9600. When I change the serial display to 38400 baud, the similar issue happens.

It seems that, when I am using Nokia 5110Lcd, or higher serial....all analog input and output signals gets disturbed.

I used delay(50) in end of logic in void loop(), but didn't helped. I will post the code soon.

vivek_ban:
I will post the code soon.

And a proper description of how this is all wired up. You may be having a power supply problem.

Maybe the library's are interfering with each other.
Or maybe the library's are using a timer that another library uses.
Try to find out which library causes this issue by disabling one and then test it.
What you could also do is use a different pin and then try again.

I am not sure if this will help, but i can atleast try :slight_smile:

(oh and the timer problem has happened to me before, i was using a servo and a 16x2 lcd and i connected the backlight to a pwm pin, but noticed that when i enabled the servo library that i could no longer dim the backlight and later i realised that the servo library was using a timer that i needed for that pwm pin. so i changed it to a different one and it worked again!)