I want to detect wether a display is connected or not. This is the display: https://www.az-delivery.de/en/products/1-77-zoll-spi-tft-display

I read connecting a pin of the display with another pin with a pull up resistors. Unfortunetely nothing worked so far.

My microcontroller board is Arduino Mega.

  • What methods with which code have you tried? How have you troubleshot them? Mar 4 at 21:22
  • Best thing is send a schematic, not a frizzy thing. What pin is connected to what pin is important, and only one setup is correct. Might as well post the code as well.
    – Gil
    Mar 4 at 22:45
  • if the board is plugged in, then pin 1 and pin 14 are connected together
    – jsotola
    Mar 5 at 2:29

There is nothing immediately apparent on that display that can tell you if it's connected or not. If you had a full SPI interface (you are missing the MISO pin) you could query the display for the HWID, but alas not. And there's no pins at all that are outputs.

The only suggestion I can come up with is to connect a small (say 1Ω) resistor between the Arduino's 5V pin and the display's VCC / LEDA pins and use an analogue input to measure the voltage on the display side of it. When the display is disconnected it will give a 5V reading. When it's connected the reading will drop to a slightly lower voltage (depending on the current draw).



simulate this circuit – Schematic created using CircuitLab


As jsotola mentioned in his comment, pin 1 and pin 14 on the display are connected to each other (GND). You can connect pin 14 to an input pin with enabled INPUT_PULLUP. If no display is connected, this pin will be pulled high by the pullup, thus the pin will read high. If the display is connected, the pin will read low.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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