1

I' m not electronic or electricity specialist , i'm a developer who tries to make fun stuff on raspberry pi , and this is why i burned two rpi 3 . i'm using my rpi with many electronic stuff , pir sensors , relays etc. All those components are externally powered , and to communicate with my rpi i m connecting the rpi ground to the power source ground , and on any output or input wire i put resistors to avoid any over current going to or from the gpio pins what i m doing is similar to what is schematized here :

Powering a sensor using an external power supply board

the only difference that with data wires coming from sensor i have only one resistance between the sensor data pin and the gpio input pin, i do not add any other resistance connected to the ground between them (like the 2k resistor in the schema ) My question is : is the 2k resistor wired to ground is necessary ? why is it added , how dc current flows in this case . my question may appear stupid , but as i sad i m no electronic/electricity man , an i don't want to burn any rpi in the future.

Rha
  • 11
  • 1

1 Answers1

1

The post you link explains pretty well, but it does not explain how they selected the 2K resistor.

They do explain why, though. At the end of the question:

Since the Raspberry Pi GPIO PINs work with 3.3V, I had to build a voltage divider to convert the 5V output of the sensor to 3.3V. Assuming the left-most resistor on the breadboard is 2K ohm and the right-most resistor is 1K ohm, did I do right?

The sensor outputs its signal with 5V, but connected to a 3.3V input PIN on the Pi. Without knowledge of electronics, this is basically like fitting a triangle shape into a round hole---they don't match. To make that work, they introduce a voltage divider. This is typical pattern in electronics of this type, to divide a higher voltage into a lower voltage (the way around is another pattern).

So how do we divide voltage? This is where electronics knowledge comes into play. And this is very common and basic (basic, because it is usually taught in high school, but it can be far away in the past :-) ), so Wikipedia is a great place to search. The entry on voltage divider just saves the day. The whole entry is a good read if you intend to keep on playing with electronics. The salient part here is basically the image and the formula. The image shows the divider connects a resistor to the ground. The why can be seen through deriving the formula:

Formula

Current flows like water through the circuit, and the connection to the ground is necessary to avoid leaking (well, to get it to actually work). To derive the formula we basically use current and relations like U = R・I.

The 2K comes from the target. The input is Vin = 5V, and we want Vout=3.3V. Using the formula above, we just need to find a pair of resistor values to get the right output. Usually, we fix one, say R1, to a common available resistor. Let's pick 1K and we can calculate that R2 should be 2K.

I hope this helps. For more information, I would suggest the Electrical Engineering section on StackExchange. This section on the Pi is best for questions specific to the Pi.

Eric Platon
  • 111
  • 2