I have a Raspberry Pi4 Model B, with a 3.5" LCD display attached:

enter image description here

Since the display occupies the first 26 pins, and therefore also the power supply ones, is there a way I could use the HC-SR04 module (ultrasonic sonar), which needs 5V DC of working voltage? enter image description here

I know very little of electronic theory and I need this for a software project, so I would like to know if I could power the Vcc pin of the sonar, with one of the remaining GPIOs or what I should do to achieve this.

Below are the pin used by the LCD display: enter image description here

  • 1
    You would still connect to the 5V pin. However, this is difficult because the LCD connector is taking up the slot. I want to emphasize the only problem is that the physical connector is blocked - there is no electrical problem - you should find a way to connect it to 5V anyway.
    – user253751
    Feb 16, 2023 at 14:10
  • @user253751 so hypotetically, if the plastic piece wouldn't completely cover it, and I found a way to attach a cable to the pin, it would work without any problem? Or is it risky and it could damage the raspberry is some way?
    – mikyll98
    Feb 16, 2023 at 14:23
  • 1
    Yes - the only problem is the pin being blocked by plastic, hence you have to find another way to connect it. Where does your Pi get powered from?
    – user253751
    Feb 16, 2023 at 14:24
  • @user253751 You could always solder onto the back of the board.
    – NomadMaker
    Feb 18, 2023 at 18:43

2 Answers 2


If it really REQUIRES 5V you will need to solder to the Pi OR provide 5V from another source.

There are a number of test points on the underside of the Pi which expose 5V, 3.3V & Gnd and could be soldered. This depends on your available tools and skill.

NOTE even if you find a solution for power you will have difficulty using the otherwise unused pins as there is insufficient space for a Du-Pont connector.


To answer (one of) your questions:

... if I could power the Vcc pin of the sonar, with one of the remaining GPIOs

No - you can power (almost) nothing from a GPIO pin - don't try this. Note that there are two header pins (see this reference) that are connected to the RPi 5V bus, but they appear to be covered by your LCD panel. There are some Test Points on the 5V bus on the board, but the safest bet is to get a separate 5V supply. If you do this, you'll need to connect the ground pin on the external supply to one of the Ground pins on the header - pins 30, 34 & 39 may be accessible based on the picture you provided.

One final note: If the Trig or Echo pins are 5V, do not connect them to a GPIO pin (GPIO is 3.3V & very fragile) - use a small transistor or voltage divider to ensure your GPIO pins never see 5V.

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.