10

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.

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

  • I have a breadboard, but I don't know how to assign rows. Do you have a link or instructions? – Stephanie Jun 1 '15 at 20:42
  • Sure thing...I will edit – NULL Jun 1 '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. modmypi.com/image/data/tutorials/hc-sr04/hc-sr04-tut-8.JPG – Stephanie Jun 1 '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 1 '15 at 21:06
  • You, could also use female/female if you have some extra wire! :-) – NULL Jun 1 '15 at 21:07
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.

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.

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.