These are chat archives for nebrius/raspi-io

15th
Jul 2015
Joël Guillod
@jguillod
Jul 15 2015 09:38
I just begin on Raspberry PI2 one week ago and as a GPIO beginner I have hard time trying to select a good nodejs library for gpio. I tried "onoff" and others which read/write to /sys/class/gpio/ files. Then, trying to understand how gpio works in details (for instance why in some tutorials of Sunfounder the led is connected to 3.3V pin and in other tutorials the 3.3V is provided by gpio pin), I encountered this excellent benchmarking article http://codeandlife.com/2012/07/03/benchmarking-raspberry-pi-gpio-speed/ . So two questions: (1) are Raspi.js and raspi-gpio written in C so results would be compared to native C or C with BCM2835 library benchmarks? (2) help me understand the tutorials differences of connecting a led to +3.3V and gpio pins, versus to ground and gpio: is that related to PULL_DOWN and PULL_UP configuration of gpio pin? Thanks!
Sorry, led connected to 3.3V and gpio versus 0V and gpio pins. (read 0V for ground).
Bryan Hughes
@nebrius
Jul 15 2015 16:05
Hi @jguillod! Good questions
To answer 1) actually no. I use Wiring PI for GPIO mostly because it’s there. I do need it for PWM because Raspbian doesn’t ship with a driver natively for PWM, and since I already had it available, I figured might as well use it for GPIO too :)
To answer 2) it’s partly due to the pull up/pull down configuration, partly just personal preference.
The pull up/down thing is used basically during the boot phase. When the RPi starts up, that LED pin will be in input mode. If nothing else where connected to the pin, the voltage would actually wobble around. This happens because the pins on the chip, traces on the board, etc act as tiny little antennas and pick up stray radio signals in the air
By adding a pull up/down resistor to that pin, it basically locks things in to place until the software has a chance to initialize the pins properly
Bryan Hughes
@nebrius
Jul 15 2015 16:10
For LED’s, it’s a bit of a wash though. Floating pins (as they are called), are really unlikely to cause the LED to light up, so pull up/down resistors are rarely used with them. That means that, in this case, they’re mostly useless and connecting to ground vs 3.3V is just personal preference.
Let me know if that answers your questions!
Joël Guillod
@jguillod
Jul 15 2015 16:46
Yes, thank you very much for your answers!
Can I explain it that way: a pin is either ground (0V) or 3.3V? If not, can you send me some web urls where to find easy to understand information on this subject (i.e. not too technical)?
In my Raspberry PI 2B with raspbian OS I have installed Wiring PI for GPIO and the gpio command do not need sudo to execute properly. But why can I not launch a node module with raspi-gpio without sudo?