I am building a project that is using A12864ZW 128X64 LCD, the question I have is should there be anything in the circuit to prevent damage to the Arduino Mega or the LCD? I am using this example here for a start.

I think I damaged one LCD with the current circuit because everything was working perfect then all of a sudden it was like the LCD Contrast was set all the way up, displaying only a dark screen but I couldn't adjust it with the U8Glib or with the V0. During programming I would disconnect the ground from the Arduino to the Breadboard, when I would do this the LCD would still flicker as it was being programmed. This is why I am wondering if I am missing something.

I read somewhere that putting a MOSFET on the Ground of the LCD that is connected to the Reset pin helps. Another problem that I am having is I am using Eclipse with the Arduino C++ add in and sometimes I can program easily, everything goes as expected but then it will fail to upload until I unplug and reset the board sometimes several times.

Because the program is using pins 11-13 it can create problems because these are the same pins used for programming if I remember correctly. I tried changing the pins used but didn't seem to help anything.

1 Answer 1


Disconnecting ground while all the other pins are connected and the Arduino is powered up is a very bad idea. Either manually, or using a MOSFET.

Simply because the power you are feeding in to the screen wants to try and find a way to ground through some means or other - and if the ground is disconnected then that means muscling its way through the IO pins into the Arduino and through to ground that way. The result is that you damage the LCD screen's fragile circuitry.

If you want to disconnect the ground pin at any time, you must ensure that either the power is turned off, or the power connections to the LCD are disconnected first.

If you want to have the Arduino's RESET toggle the power to the LCD to force a hard reset then you need to use a P-channel MOSFET in the power connection instead, so the ground connection is always connected.

  • So what is the proper procedure to keep the Mega from getting into a state where it can not be programmed? I know that continuously unplugging and plugging in the USB programming cable can not be good either. Nov 21, 2015 at 22:18
  • 11-13 are only used for ICSP programming (SPI). For normal USB programming it uses pins 0 and 1.
    – Majenko
    Nov 21, 2015 at 22:19
  • Okay, maybe it is not the LCD that is causing my problems then possibly? I have tried changing the pins used for the LCD and doesn't seem to make a difference with the Mega hanging up. Are there any "Tricks" to keeping the Mega in a state for programming? I am not sure why my Mega is getting into such a state where Eclipse cannot communicate with it until I disconnect then reconnect the USB cable. Nov 21, 2015 at 22:34
  • It's highly unlikely to be the mega that is the problem, unless you are doing things with the reset pin. It's more likely to be the computer doing something with the CDC/ACM port - maybe killing the DTR signal.
    – Majenko
    Nov 21, 2015 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.