teazy
Posts: 33
Joined: Tue Dec 20, 2016 8:03 pm

Ultrasonic sensor HC-SR04

Sun Dec 02, 2018 4:14 pm

Hi guys, i need to use many ultrasonic sensors (4) and my 2 5V pins on my rpi are already taken
can i use an external battery (5V) to power the sensors ?
Ty for ur help
Best regards

User avatar
joan
Posts: 14887
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Ultrasonic sensor HC-SR04

Sun Dec 02, 2018 4:40 pm

Yes you can. If you do use a battery make sure you also connect the battery ground (-ve) to a Pi ground.

However, why not just connect more wires to one or more of the Pi's 5V pins?

teazy
Posts: 33
Joined: Tue Dec 20, 2016 8:03 pm

Re: Ultrasonic sensor HC-SR04

Sun Dec 02, 2018 6:02 pm

joan wrote: Yes you can. If you do use a battery make sure you also connect the battery ground (-ve) to a Pi ground.

However, why not just connect more wires to one or more of the Pi's 5V pins?
my 2 pins are already taken for a L298N, so i'm afraid that it's too much for my rpi, do you think that it will be okay ?

User avatar
joan
Posts: 14887
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Ultrasonic sensor HC-SR04

Sun Dec 02, 2018 7:44 pm

Yes, using an external power supply to power sensors is fine (again with the proviso you need to connect the external power supply and Pi grounds).

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Ultrasonic sensor HC-SR04

Sun Dec 02, 2018 9:27 pm

teazy wrote:
Sun Dec 02, 2018 6:02 pm
joan wrote: Yes you can. If you do use a battery make sure you also connect the battery ground (-ve) to a Pi ground.

However, why not just connect more wires to one or more of the Pi's 5V pins?
my 2 pins are already taken for a L298N, so i'm afraid that it's too much for my rpi, do you think that it will be okay ?


If you are just powering the control circuit of the L298n then it wont be using much current anyway , so you can connect your sensors to the same 5v pin, but most of the L298N boards have an on board 5v supply anyway so why are you supplying 5v from the pi ?

what you should not do is supply the motor supply from the 5v gpio pin as that may damage you pi.

might be a good idea to post a diagram of how you have all this connected if you are not sure.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Beginners”