[1] http://elinux.org/RPi_Tutorial_EGHS:LED_output (Circuit 1 - Basic LED Driving Circuit)
[2] http://elinux.org/RPi_Low-level_peripherals#GPIO_Driving_Example_.28Shell_script.29
See this Simple Guide to the RPi GPIO Header and Pins page for how the Pi's Pin numbers map to the GPIO Pins. The guide's Pin diagram is shown below:
I will use Pin-11 on the Pi, which translates to GPIO-17. Therefore, I use GPIO-17 in the shell.
pi@raspberrypi ~ $ sudo -i root@raspberrypi:~# echo "17" > /sys/class/gpio/export root@raspberrypi:~# echo "out" > /sys/class/gpio/gpio17/direction root@raspberrypi:~# echo "1" > /sys/class/gpio/gpio17/value root@raspberrypi:~# echo "0" > /sys/class/gpio/gpio17/value
The following picture shows the setup.
The top Red-Rail is Pin-11 (GPIO-17) output. The bottom Red-Rail is Pin-2 (+5V). Both Blue-Rails are Pin-6 (GND).
There's an LED connected between Pin-2 (+5V) and Pin-6 (GND), in series with a 10k-Ohm resistor. This will always be On, and just proves that the Pi is supplying power.
There's an LED connected between Pin-11 (GPIO-17) and Pin-6 (GND), in series with a 10k-Ohm resistor.
The shell commands as specified above, will turn the LED On and Off.
In practice, the LED connected to 5V is brighter than the LED connected to GPIO-17. I assume this is because GPIO voltage levels are 3.3 V.
The GPIO-connected LED wasn't very bright. I think this is a combination of the lower voltage level (3.3V) and using a resistor value 37 times bigger than the 270-Ohm resistor recommended in [1].
To increase the brightness of the GPIO LED, I used 3x10k-Ohm resistors in parallel to decrease resistance to 3.3k-Ohm.
No comments:
Post a Comment