RPi3 Blinking LED

Goal : Simple LED to Raspberry Pi 3 B wiring set-up to use with various tests like 4DIAC.
Side Goal: Learn some basic electronics so not always asking EE with 4DIAC - how, why




LED wiring used

http://www.resistor-calculator.com/
LED Resistor Value Calculator  
LED used is 5mm,  so chose a 330 Ohm resistor greater than minimum needed.

Raspberry Pi 3 Model B v1.2 Pin layout

2 Tests for + output to LED:
1. Pin 1 = 3.3 V output to LED
2. Pin 7 Output to LED: GPIO04  

Pin 6 GND was used for - output ground.


https://www.jameco.com/Jameco/workshop/circuitnotes/raspberry-pi-circuit-note.html


https://www.raspberrypi.org/documentation/usage/gpio-plus-and-raspi2/



sysfs from term command line
What worked:

To have authority to do commands

sudo su
[Note: sudo -i  for root environment, suggested, but internet posts indicate it can cause problems easier.]

For GPIO pin using to test and change on/off:

Test with GPIO4  (note: no 0 required)

1. Export GPIO pin #

echo 4 > /sys/class/gpio/export

2. Set GPIO pin direction (IN/OUT)

echo out > /sys/class/gpio/gpio4/direction

3. Write value to pin

To turn on LED
echo 1 > /sys/class/gpio/gpio4/value 

To turn off LED

echo 0 > /sys/class/gpio/gpio4/value 

4. Unexport to clean-up

echo 4 > /sys/class/gpio/unexport

5. To return to normal user and leave sudo su mode

exit

Electrical Diagrams

see https://www.raspberrypi.org/documentation/usage/gpio-plus-and-raspi2/
see 

Links that helped

How to use GPIOs on raspberry pi (Simple I/O, PWM and UART)
Explains when echo actually turns on and off the GPIO pin chosen


IO pin control from the command line – Raspberry Pi Projects

Includes how to unexport a pin

http://www.auctoris.co.uk/2012/08/23/gpio-with-sysfs-on-raspberry-pi-part-2/
Has more on the C-code


Wiring on Breadboard

https://projects.drogon.net/raspberry-pi/gpio-examples/tux-crossing/gpio-examples-1-a-single-led/

How to use a BreadBoard - Electronics Basics 10

http://hertaville.com/introduction-to-accessing-the-raspberry-pis-gpio-in-c.html Excellent Breadboard image

Miscellaneous Links Collection
https://www.lifewire.com/light-an-led-with-the-raspberry-pis-gpio-4090226 another GPIO and gnd wiring at top end of the pins  Python code
https://elinux.org/RPi_GPIO_Code_Samples#sysfs Code examples in many languages
http://sysprogs.com/VisualKernel/tutorials/raspberry/leddriver/

how to make simple 5 Led chaser circuit using transistor Interesting but looks complicated.
How Transitors work   NPN and how it amplifies.  2nd video on how transitors work as a switch
Blinky with Python 3 https://www.raspinews.com/blinking-led-on-raspberry-pi-using-python  code is nice

Original version published 11/19/17 in a private blog

Comments

Popular posts from this blog

Revisiting Basics