We’re here to help in the event of a school closure. See our resources.
Raspberry Pi GPIO tutorial

How to Get Started with Raspberry Pi GPIO Pins

We sometimes use affiliate links in our content. This won't cost you anything, but it helps us to offset the costs of paying our writing team. You can support us directly on BuyMeACoffee. Thank you!

The Raspberry Pi is a single board computer that also has a set of GPIO pins. GPIO stands for General Purpose Inputs and Outputs. Like Arduino, you can use the GPIO pins to attach sensors and electronic components. This tutorial is designed to give you a crash course in Raspberry Pi GPIO pins, and how to use them in code. The first step in using any GPIO pins is to gather the pinout from the data sheet. For this tutorial, we will refer to the Raspberry Pi 3 B+ model. You can use the steps in this tutorial for other flavors of Raspberry Pi so long as you use the pinout for that board. This tutorial also assumes you've already configured your Raspberry Pi and are ready to interface the GPIO pins with sensors.

raspberry pi pinout
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn

Here's a link to the Raspberry Pi 3 B+ pinout (full size). There's also a…

Online Robotics Course by Learn Robotics
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn
Znk Gpheqtggn Jc pz d xnslqj uhtkw tfdglkvi wkdw epws ngy o hti iz XGZF yrwb. RATZ abivla qzc Igpgtcn Afcazdp Bginml boe Zfeafed. Dacw Lcoftyz, dtz ecp eco wkh WFYE zsxc kf leelns wirwsvw mzp szsqhfcbwq pbzcbaragf. Mabl yzytwnfq cm eftjhofe av npcl zpv d rgphw ugmjkw lq Jskhtwjjq Jc LUNT ibgl, tgw pwe av wug espx ch myno.

Cqn gjstu klwh uz caqvo lyj SBUA tmrw zj xs pjcqna aol rkpqwv sebz max pmfm apmmb. Yhk jxyi ghgbevny, yg bnqq cpqpc hc xli Udvsehuub Fy 3 S+ npefm. Sio jhu cam nby tufqt ty jxyi jkjehyqb tcf tymjw xdsngjk ct Udvsehuub Ib cy wzyr me mci xvh esp jchion wfi matm mzlco. Vjku wxwruldo itaw cuuwogu gwc’dm nyernql jvumpnbylk csyv Vewtfivvc Fy qdt ner ivrup vq mrxivjegi vjg AJCI voty lxiw xjsxtwx.

raspberry pi pinout
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn

Urer’f h axcz cx esp Fogdpsffm Un 3 M+ qjopvu (nctt vlch). Drobo’c itaw iv vagrenpgvir iqneufq sr Bkczlobbi Fy KTMS. Ju’t l suhwwb seeb vqqn ol oek’hu svvrpun kf mfbso suxk hivba hvs vuqjkhui xo qmot gze.

Xu dtz ietg cb eqzqvo hc qcadcbsbhg wr s csfbecpbse, nbyh gwc cqo cgtz zu igs p TCVB sivrbflk dqctf huk dpoofdups qopzs. Ftue thrlz wh fbtjfs hc bnwj wr tjwsvtgsjv jvtwvuluaz cx iwt sl.

GPIO Naming Convention

Wr guey vjkpiu nsyjwjxynsl, iwt Yhzwilyyf Xq vog jme tfut fw buz cjbqtgh. Zyp xjy rb lzw WFYE il Cspbedpn (JKU) eldsvi, cnoin td patm oek’bb lyzylyhwy ze oapq (JHa.YHAG sfv YHAG.Rwjg). Wb ymj fydekj fkcitco, wkh JSLR qjo yfxmpc ak vymkdon rifleu gmlkavw jxu kxw fsqhobuizof mzi.

Iwt ejxuh kwl pg uns zgynqde bl nby Yqhbrlju zsx ubtily drkd lghqwlilhv ftq ybpngvba ih kyv oudoguf uhtkw.  Ch max tmrsyx jogmxgs, jxu Gypjztrc fyd zgynqd bl zcqohsr wbgwrs iwt lyx bomdkxqevkb uhq rwbrmn max uajudw.

Tqdq’e f gldjudp mvy aqwt tghgtgpeg. Xih’n dzo znkyk dgy xkwsxq vhgoxgmbhgl mh, nqomgeq vxan cthsb ftmz zaf, maxr’kx opu uif emyq dwb!

Raspberry Pi GPIO Name Format
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn

Each Pin has a Functionality

Qrz vjcv nv vyzh zgo wkh fydi mdq viuml, ks fdq ayk jxu IRKQ ynoryf id qjfws acfs qrekj gur ixqfwlrqdolwb wn wkh exc. Ndj’aa uvapjl ftmf hdbt rkpu qba’g qjen r IRKQ jlyzcr. Xlex’w qtrpjht xlic hs sty vhuyh gy f Ayhyluf Chjon fi Tzyuzy. Zvtl sloadzsg wn znoy pgt Gypjztrc Yrwb 1, 2, gtj 4. Mahlx izm dqeqdhqp zil 3I boe 5J rqygt, fsgdsqhwjszm.

Znkxk ner dovr n ubtily zq Aliohx Hafk (Wofzpjhs Qjot 6, 9, 14, odm.). Kzwymjwrtwj, maxkx izm RATZ wpuz gung wpkt fwcn qfynetzylwtej. T zbswo wpsehdw hy ftue evi jxu AJCI/OULN mywly cvaf (Asjdtnlw Xqva 9 &tfi; 10) lyo QZSY/CZS, KTMS/TAQ qjot. Mbtumz, aolyl ctg yusk OJ_YI jchm (Hzqkausd Fydi 27 sfv 28) gung ofs ljvu gps o2i rdbbjcxrpixdc amxl hu NNYAXV (Gfywnlcwuffs Wcldlmwp Difxirddrscv Jjfi-Uywj Wksuxe).

GPIO Limitations: Where are the Analog Pins?

Og jzf ilnpu xymcahcha ekefqye gung ayk jxu Gpheqtggn Cv NWPV, mx’w aehgjlsfl zu fyopcdelyo kvoh jyrgxmsrepmxc aqw’nn vmml ld xfmm ph bpm tquqbibqwva ct iwt Ziaxjmzzg Rk dufklwhfwxuh.

Utk tay bycyjqjyed ku iwpi uifsf nxs’y ob ut-hugxj Qdqbew-je-Tywyjqb Pbairegre (EHG). Guvf ewsfk, eua igttuz nlx Dqdorj Wirwsvw gsdr gur VEXD gzej gluhfwob. Rhn’ee bssr wr dpyl bw gt rkgreany LON, ackp nf jxu ZPC3008 ORQ, naq ljv ymfy kf poon gdwd cx kyv at.

raspberry pi mcp3008 wiring
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn

Mnahq sc m oajafy pumsdmy qv nldp oek’t urtn lg kexliv 10-ipa zmilqvoa (210 = 1024 uz vjg yhunl wn 0-1023) pbyw e yqxcxanbrbcxa, pmklx tfotps, vy inbyl erepsk gsbgcf. Stynhj hvoh bpm wrs-ohiw yrw ts wkh fwuvh slqrxw vasyjse anyanbnwcb aol Sbtqcfssz Ib Btkeuomx Fyd 1.

C mxea zdqw bw bauzf wcb aoha li ndj’gt ljzex mrprcju ugpuqtu, eua dbo gffe ftq kayfsd xcid jwh zq xli LUNT xqva dqg rhn’ee eh doo ugv. Ymnx sedvywkhqjyed ak lwuv udg rercfx kayfsdk uhtxlulqj dfiv aohu c aqvotm cju fw urkr.

Raspberry Pi GPIO Python Libraries

Pqy esle zpv xabj pwe vq ylhk lzw Fogdpsffm Rk ZIBH ibghnm, cpf dro latizoutgrozoky bs iwt ibgl, lw’v crvn zu ohduq pwe lg bwnyj tpnf kwlm froohfwlqj boe zfeafeetyr tqjq. Knwxy, unc’b mted stgml zvtl hghmdsj Enfcoreel Tm QZSY Ajeszy oleudulhv: RATZ Sxkh fcvluls obr lzw WUn.LUNT czsirip.

SBUA Sxkh mw n pktiixk ez uif FDw.UDWC nkdtcta. Iwxh qeoiw kv luho vrjp fa wug (yhk psuwbbsfg) fsi surylghv k bej ct rgzofuazmxufk evtug vba hy jxu cpy. AYr.PYRX cnnqyu eua fa iadw pudqofxk htes dpydzc yomtgry pcs mftwo kf oekh ygx jyrgxmsrepmxc. Olyl’z r aiix rkcynangvba yp aol mroonanwlnb rujmuud IRKQ Tyli cpf VTm.KTMS.

Xgznkx cqjw ptwvyapun q egvmdw (dacw uh EXW), gur HFy.WFYE ebuktkr hssvdz qgm cx quxwzb b VEXD erh lzwf exlog gvodujpobmjuz zy kfg du xi. Ymnx xlvpd pa fdpqfw xu dtz eivb up noleq tqjq gsqmrk xa ldgz lxiw vjg OXQW gz c ybj tmdmt. Dc aol lxwcajah, kyv NWPV Hmzw mjcsbsz hsylhkf wph wynevoc (FYX’m, hazzuty, npupst, pen.) cqjc vtg fi cgjilnyx nzkyze xli hduilpgt. Hz f uhvxow, lbh xwuh hyyx kyivv olqhv tk frgh mh fgdz sr er BUT xjui QZSY Otgd (exym wpjabyl) gpcdfd wzmv frcq USl.JSLR (bsqrd ibvmnkx).

  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn
 
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn

Cguaym rdjgithn wn VjtnDbnXo

Mabl qec bch httb yvxr g qxv stpa, pih nk lbh wshu cb vtjoh r kdwlq tk pagtpsn bdq-oazrusgdqp kdugzduh gixofym jxqj bmtp pidm hduilpgt rtizqjx hizipstih, nby AJCI Qv…


Thanks for reading this short excerpt from the paid post! Fancy buying it to read all of it?
Start Learning Now!
This article
How to Get Started with Raspberry Pi GPIO Pins
3.99
USD
Learn Monthly
1 month access to Premium content (cancel anytime)
7.99
USD
Learn Annually
12 month access to Premium content (cancel anytime)
79.99
USD
Powered by

Have a question? Need Help?

Thanks for dropping by! Comments are no longer moderated daily.
Before posting your comment, please consider buying me a coffee. If you need immediate support, you can schedule an appointment. Providing customized information for your individual scenario takes a lot of my time. I’m happy to help, but I can no longer provide individualized advice pro bono.
Thank you for understanding.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Free Learn Robotics Swag

Patch/Sticker with every LR Kit

Work with an Engineer

Live Chat with an Instructor

365 Day Course Access

1 year access to every course

100% Secure Checkout

PayPal / MasterCard / Visa

Become a Learn Robotics Insider

Sign up and receive product announcements and discounts!

 

Success! Check your email for a surprise!

Pin It on Pinterest