11

I am using a HC-SR04 ultrasonic sensors, and I don't have enough 5V pins on a Raspberry Pi, and I don't want to buy an expander.

So is it possible to use the 3.3V pins on some of the sensors? What are the consequences? I'm a beginner, so I won't understand anything complicated.

Bex
  • 2,929
  • 3
  • 25
  • 34
Stephanie
  • 113
  • 1
  • 1
  • 4

3 Answers3

12

The HC-SR04 can only be run with 5v(scroll down to specs). However, you can easily fix your problem if you have a breadboard. Assign one row as the 5v "rail" and attach as many sensors as needed.

EDIT: How to use breadboard. Basically, the two long rows on the each side of the board can be used as rails for power supply. Just make sure you keep your 5v rail separate from you ground rail(5v is usually marked red on breadboard to help). You could also just use one of the many rows. The picture below shows how they are connected. Dedicate one row to 5v. So, a pin from 5v goes to that row and then the rest of the holes are now 5v and can be used for the sensors! big breadboard small

NULL
  • 2,240
  • 8
  • 26
  • 49
  • I have a breadboard, but I don't know how to assign rows. Do you have a link or instructions? – Stephanie Jun 01 '15 at 20:42
  • Sure thing...I will edit – NULL Jun 01 '15 at 20:51
  • Thank you, I think I understand now. All I have to do is connect a 5V pin to any hole, and the entire strip will be 5V pins? But they are holes, not pins...

    Here are the sensors I want to use. I would like to get 3 of them connected. https://www.modmypi.com/image/data/tutorials/hc-sr04/hc-sr04-tut-8.JPG

    – Stephanie Jun 01 '15 at 21:02
  • Yea, so the header on the Pi is male and then the breadboard is holes so you need male to female for the best hook up. – NULL Jun 01 '15 at 21:06
  • You, could also use female/female if you have some extra wire! :-) – NULL Jun 01 '15 at 21:07
  • @Stephanie: See https://learn.sparkfun.com/tutorials/how-to-use-a-breadboard – RedGrittyBrick Jun 02 '15 at 11:44
  • Is there any current limit on the 5V pin? – jnovacho Jun 02 '15 at 13:13
  • @RedGrittyBrick: Yep...thats were I got the pics from...good point! – NULL Jun 02 '15 at 13:14
  • @RedGrittyBrick: btw, I was looking at your profile... how in the world do you manage all those accounts?!?!! :O You'd think you were a member of every SE group! – NULL Jun 03 '15 at 16:16
  • @NULL: I find stackexchange makes it very easy to have accounts in a large number of its websites. The alerting icons in the header area work across sites. My activity in various websites varies considerably over time. In any given week I am only really active in a few of them. A lot of the diversity comes from dipping into the "Hot Network Questions" on the right. – RedGrittyBrick Jun 03 '15 at 19:24
  • @RedGrittyBrick: Totally, agree. Sorry, its really none of my buisness, I was just curious.:-) – NULL Jun 03 '15 at 19:54
  • The 5v GPIO is limited to the Polyfuse. I think its 1.2amp? They changed it so many times not sure now. Running too many sensors from GPIO may cause brownout. It would be better to use the 5V source directly, as in split the 5v wire before it goes into the Pi. This protects your Pi from brownout but gives you more power to the Sensors. Although, if you have a 1AMP power supply then it makes no difference. Only bigger PSU will help you with splitting the supply +5v -5v wires. – Piotr Kula Jan 06 '16 at 16:36
5

The sensor datasheet will tell you the permitted input voltage range.

Although you will get results by powering the HC-SR04 from 3V3 the results will not be reliable. If you want accurate readings you need to power from 5V. See this post.

SR04 powered from 3V3 3V3

SR04 powered from 5V 5V

There is no reason not to power more than one device from a 5V pin. If you have a breadboard just connect the 5V pin to a power rail. The other devices can then be powered from the power rail.

joan
  • 71,024
  • 5
  • 73
  • 106
3

On a more general level: First and foremost it is always ok to ask before frying (expensive) components or pieces of equipment. The next step of the learning process is to read and understand the datasheet of component - the sensor in this case. The voltage levels to safely operate the device will always be part of the datasheet as this information really is essential.

Typically there will be a "Specifications and Limitations" section, or a list of features that includes the operation voltages. Datasheets also often include an "Absolute Maximum Ratings" section which as the name suggests documents operational conditions (such as voltage, current, temperature) that must not be exceeded. Stresses beyond those limits may cause permanent damage or affect device reliability. Operations outside the documented ranges will also void the warranty.

In the case of the mentioned sensor the datasheet (as provided per NULL's answer) lists minimum, typical, maximum operation voltage (4.5 V, 5 V, 5.5 V). So the sensor has to be operated within a range of 4.5 V to 5.5 V. Undervolting at 3.3 V might actually not destroy the sensor but may (and will per joan's answer) significantly reduce the performance. It may fail at the most unforeseen moment or simply read nonsensical values. Simple put, it is not possible to use 3.3 V to operate this sensor.

The other answers already made it clear that the number of sensors to be connected is not limited by the number of 5 V pins. They also provided solutions how to overcome this limitation. Note that this only applies to the power rail pins and not to GPIO pins that support only a very limited current.

There is however one limit to consider - the current those sensors draw with respect to the power supply used. The sensor in question has a listed maximum working current of 20 mA. Which is not that much - but if ten sensors are used it will sum up to 200 mA which is starting to become significant. So be sure that the power supply can support the Pi, peripherals (like keyboard, wifi dongle, ...) and various sensors attach. To check this estimate and sum all the current demands and compare to the current rating of the supply. Check the RaspberryPi's power consumption for comparison.

Ghanima
  • 15,855
  • 15
  • 61
  • 119