Doug Wyman
Published

Raspberry Pi buffered I/O

A fun project for an 8 input and 8 output buffer for Raspberry Pi.

IntermediateFull instructions provided5,687
Raspberry Pi buffered I/O

Things used in this project

Hardware components

Texas Instruments SN74HC244N buffer ICs
×1
ULN2803A
×1
ProtoPal
×1
20-pin DIP socket - Through Hole - 3 pcs
×1
[10x] 3-Pin 2.54mm Pitch PCB Mount Screw Terminal Block Connector - Fits PCBs!
×1
Raspberry Pi 1 Model A+
Raspberry Pi 1 Model A+
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

schematic.JPG

Code

Test Code

Python
Code to test board
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)

myInputs = [17,22,23,24,5,6,12,13]
myOutputs = [25,8,7,16,20,19,26,21]

for pin in myInputs:
    GPIO.setup(pin,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)

for pin in myOutputs:
    GPIO.setup(pin,GPIO.OUT)

while True:
    for pin in myOutputs:
        GPIO.output(pin,True)
        sleep(.25)
        GPIO.output(pin,False)

GPIO Buffer initialization

Python
I've placed my script in /usr/share and a script in /etc/init.d to initialize this code on startup
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)

myInputs = [17,22,23,24,5,6,12,13]
myOutputs = [25,8,7,16,20,19,26,21]

for pin in myInputs:
    GPIO.setup(pin,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)

for pin in myOutputs:
    GPIO.setup(pin,GPIO.OUT)

for pin in myOutputs:
    GPIO.output(pin,False)

Init.d script to initialize the buffer

SH
With this script in the /etc/init.d folder and named gpio_init and the python script gpiobuffer_init.py in the /usr/share folder, run the command sudo update-rc.d gpio_init defaults
Now the script will run at startup and initialize the buffers
#! /bin/sh
### BEGIN INIT INFO
# Provides:          gpio_init
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This file initializes the GPIO Buffer
### END INIT INFO

# Author: Doug
#


python /usr/share/gpiobuffer_init.py

Credits

Doug Wyman

Doug Wyman

3 projects • 15 followers
Been playing with computers since 1962. Still learning.

Comments