Freenove / Freenove_Ultimate_Starter_Kit_for_Raspberry_Pi

Apply to FNK0020
Other
561 stars 294 forks source link

Ultrasonic circuit overvolts GPIO #23

Closed oboewan42 closed 4 years ago

oboewan42 commented 4 years ago

The circuit in chapter 24 connects the Echo pin of the HC-SR04 (which runs at 5V) directly to the Pi. Since the Pi’s GPIO pins are not 5V-tolerant, this runs the risk of damaging the Pi.

A fix is to put a 1K resistor between Echo and GPIO24, then connect two 1K resistors in series between GPIO24 and GND, creating a voltage divider to bring the input to a safe level.

SuhaylZhao commented 4 years ago

Hi,

You are right. It is very safe to connect a 1K resistor between the gpio24 and the echo pin of the Ultrasonic module.

Although the working voltage of raspberry pi GPIO is 3.3V, in the input mode, the GPIO is in the high resistance state, and the internal resistance is close to infinity. Therefore, in this case, the echo pin of the Ultrasonic module will not damage the GPIO of raspberry pi.

Thanks.

oboewan42 commented 4 years ago

Wrong.

It doesn’t matter how high the internal resistance is. There is no overvoltage protection. The pins are not 5V-tolerant. The circuit, as printed, will damage the Pi.

Every other Raspberry Pi resource out there - including the official documentation - explicitly warns against connecting a 5V signal to a GPIO input pin.

Fix it.

SuhaylZhao commented 4 years ago

Hi,

We will fix it and update soon.

Thank.