Page 1 of 1

I setup ultrasonic Sensor without resistors

Posted: Wed Nov 22, 2017 11:46 am
by gjs31
Ok, I’m a beginner and I’m pretty sure I’ve just made a noob move. Please be gentle.

Was setting up a HC-SR04 ultrasonic Sensor on my Pi3, and not really paying attention I set it up without resistors. Tried running some python scripts for about 20 mins not getting results till I realised my stuff up. Didn’t have the resistors at hand so never got back to trying it.

The Pi still seems to work ok, and I didn’t really think anything of it, until I started reading more about it today on feeding 5v back into the GPIO, i.e. DON’T DO IT.

So have I fried my nice birthday present? Haven’t had a chance to play around with it since I realised, had a quick play tonight and the 16x2 i2c LCD I had working previously didn’t work, but didn’t have time to troubleshoot it.

Thank you!!

Re: I setup ultrasonic Sensor without resistors

Posted: Wed Nov 22, 2017 12:08 pm
by joan
You are probably okay if the Pi boots.

As a quickish test run wiringpi's pintest utility or (my) pigpio's gpiotest utility. Both tests check out the GPIO and require that nothing should be connected to the expansion header.

Re: I setup ultrasonic Sensor without resistors

Posted: Thu Nov 23, 2017 6:18 am
by gjs31
Ok, so I ran the test you referenced.

Write 1 to gpio 2 failed
Pull up on gpio 2 failed
Skipped non-user gpios: 0 1 28 29
Tested user gpios: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Failed user gpios 2

Then it crashes.

I'm assuming it is now a paperweight, or is there something I can do to fix it??

Thanks for your help!

Re: I setup ultrasonic Sensor without resistors

Posted: Thu Nov 23, 2017 2:10 pm
by alphanumeric
It's not a paper weight. It can still be used for other things. PC, Media Center, file server etc. How many GPIO's failed? If only 1 or 2, just don't use those GPIO pins. If i2c is still working there still plenty of things it can be used with.

Re: I setup ultrasonic Sensor without resistors

Posted: Fri Nov 24, 2017 11:44 am
by joan
GPIO 2 is the I2C SDA line. If you were powering the I2C LCD backpack from 5V I'd say that is more likely to be the cause of the damage (rather than the sonar ranger). The backpack may well be pulling the SDA line up to 5V.

If you are lucky the damage will not spread beyond GPIO 2.

Re: I setup ultrasonic Sensor without resistors

Posted: Fri Nov 24, 2017 12:13 pm
by alphanumeric
I think I'd run i2cdetect and see what it shows.

Re: I setup ultrasonic Sensor without resistors

Posted: Sun Nov 26, 2017 12:07 am
by gjs31
The documentation I'd read have all had the lcd backpack plug directly into the 5v, ground and gpio2 and 3. For example this Osoyoo one (http://osoyoo.com/2016/12/01/use-raspbe ... cd-screen/). Gat a new Pi yesterday and had actually set the lcd back up as per these instructions, and thankfully ran a test this morning and all is ok.

Any suggestions on a resource that has basic project instructions like the Osoyoo one?

Re: I setup ultrasonic Sensor without resistors

Posted: Sun Nov 26, 2017 2:08 am
by asandford
gjs31 wrote:
Sun Nov 26, 2017 12:07 am
The documentation I'd read have all had the lcd backpack plug directly into the 5v, ground and gpio2 and 3. For example this Osoyoo one (http://osoyoo.com/2016/12/01/use-raspbe ... cd-screen/). Gat a new Pi yesterday and had actually set the lcd back up as per these instructions, and thankfully ran a test this morning and all is ok.

Any suggestions on a resource that has basic project instructions like the Osoyoo one?
Looks like a typo:

Code: Select all

VCC 	+5V/3.3v 	+3.3V 	pin 2
That should be pin 1 (3v3), and the circuit layout also uses 5v (which is wrong).

Having said that, I've used many i2c devices running at 5v with the Pi with no trouble (the Pi is the bus master and controls the voltage level), so the data line should only float to 3v3, an active signal pulls the line to GND.

Re: I setup ultrasonic Sensor without resistors

Posted: Sun Nov 26, 2017 3:31 am
by gjs31
Ok, so if I run it through 3.3v I should be ok. That and check all documentation thoroughly.

Thanks again for the help!!

Re: I setup ultrasonic Sensor without resistors

Posted: Sun Nov 26, 2017 9:39 am
by alphanumeric
A lot of these devices are for use with an Arduino or a Pi. The Arduino uses 5V logic and the Pi uses 3.3V logic. It depends on the device and the manufacturers hookup instructions which supply you use. Some devices say 3.3V logic safe etc. I have a DS1307 that uses 5V even when used on a PI, but my DS3231's all use 3.3V for Vin. I have other devices that say for Arduino us 5V for Vin, for a Pi use 3.3V for Vin. Most of my sensor break out boards use 3.3V for their supply voltage when used with a Pi. Sorry for the long ramble. It took me a while to sort it all out in my head and make sure to pay close attention to the instructions.

Re: I setup ultrasonic Sensor without resistors

Posted: Mon Nov 27, 2017 3:54 am
by asandford
To further confuse you, no Arduino (that I know of) has to use 5v. They can all run from 3v3 Vin (albeit some with reduced clock frequency), and some of the later models are only 3v3.