SlideShare una empresa de Scribd logo
1 de 26
GOT PYTHON I/O
IOT DEVELOPMENT IN PYTHON VIA GPIO
HISTORICAL PERSPECTIVE
HOW I CAME UP WITH THE HAIR-BRAINED IDEA TO USE PYTHON FOR IOT
NODEBOTS DAY
Put on by Suz Hinton and Pawel
Szymczykowski
THE LEXICUTIONER
Designed a built using SumoBot Jr.
(Pawelbot) by Adam Englander and Lexi
Glazer
PHYSICAL ACCESS SYSTEM
Comprised of Raspberry Pi B, power
converter, electronic door latch, inline
switch. Software is Raspbian with Python
2.7 and Twisted.
PYTHON IOT STARTER KIT
RASPBERRY PI FOR THE WIN
STARTER KIT HARDWARE
• Raspberry Pi
• Micro USB with AC converter for power
• Cat 5 network cable
• USB Keyboard
• HDMI cable
• HDMI capable display – not shown
• 3.3V LED with (2) female to female connectors
STARTER KIT SOFTWARE
• Raspbian
• Pre-installed on SD card
• Download installer (requires SD card reader):
https://www.raspberrypi.org/downloads/
• Python 2.7
• Pre-installed on Raspbian
ACCESSING GPIO FROM LINUX BASED SYSTEMS
IT’S SO EASY YOU WON’T BELIEVE IT
GENERAL PURPOSE INPUT/OUTPUT (GPIO)
• A generic pin on an integrated circuit (IC) whose
behavior is controlled at runtime
• Use to control and transfer data to and from
external devices to the IC
• Available on all general purpose IC boards
IT’S ALL IN THE FILE SYSTEM
• Linux GPIO Sysfs Interface for Userspace
• Root directory is at /sys/class/gpio
• Control Interfaces
• Pin Interfaces
CONTROL INTERFACE
• “export” creates a node to expose a GPIO port
to the user space
• “echo 18 > /sys/class/gpio/export” will create a
gpio18 node at “/sys/class/gpio/gpio18”
• “unexport” removes the node for a GPIO port
from the user space
• “echo 18 > /sys/class/gpio/unexport” removes
the gpio18 node
GPIO SIGNALS
• “direction” determines the direction of a pin. Valid
values are “in” and “out”. “in” is used for interrupts
• “echo out > /sys/class/gpio/gpio18/direction” will
set GPIO pin 18 ’s direction as out
• “value” is the value of a pin. It reads a “0” or “1”.
Any on-zero value written will be interpreted as
“1”. When reading the value ”high” evaluates to ”1”
and “low” evaluates to “0” unless overridden by
“active_low”
• “echo 1 > /sys/class/gpio/gpio18/value” sets the
value of GPIO 18 to “1” and closes the circuit
• “cat /sys/class/gpio/gpio18/value” would return “1”
after the statement above
GPIO SIGNALS CONTINUED
• “edge” is used to tell the GPIO when to write to
”value” when “direction” is “in”. Valid values are
“none”, “rising”, ”falling”, and “both”.
• “echo both > sys/class/gpio/gpio18/edge” will
trigger an interrupt when voltage increases or
decreases
• “active_low” is used to invert the effect of
“edge” of “value”. Valid values are “1`” and “0”.
“1” inverts and “0” sets standard.
• “echo 1> sys/class/gpio/gpio18/active_low” will
invert the values of high and low
PYTHON ACCESS TO GPIO
CAT SKINNING 101
USE FILE SYSTEM ACCESS
• ”open”
• “read”
• “write”
TWISTED
• Event loop
• Single thread
• Asynchronous I/O
• HTTP server
• Websocket server
• File system I/O
• Real IoT
DEMO TIME
PLATFORM COMPARISON
HOW TO PICK THROUGH THE MYRIAD OF OPTIONS
RASPBERRY PI
Pros
• Moderately Inexpensive (~35 USD)
• Flexible platform
• Lots of guides and tutorials
• GUI interface for beginners
• Aptitude package manager
• Great starter platform
Cons
• Requires special cable to do away with keyboard
and monitor
• Under powered
• No built in Analog to Digital Converter (ADC)
• A bit on the large side
• ARM processor
INTEL EDISON
Pros
• X86 based Atom processor
• Ample power, RAM, and storage
• Multiple form factors
• Arduino developer board can use standard
Arduino backplanes
• Easy to setup Wi-Fi
• Arduino board has Analog to Digital Converter
and Python library
Cons
• Can be a bit pricy (~110 USD)
• Not as many guides and tutorials
• Documentation is a bit confusing at times
• Evolving platform
• Sysfs GPIO is flakey
DRONESMITH LUCI
Pros
• Easy to build unmanned vehicles
• No real electrical understanding needed
• Just uses some simple scripting
• Based on Intel Edison
Cons
• Expensive
• Still in early development phase
• No real direct development – just scripting
routes.
CHIP
Pros
• Super inexpensive (~10 USD)
• Wi-Fi
• Bluetooth
Cons
• Low power
• Pre-order only
BEAGLEBONE BLACK
Pros
• Inexpensive (~50 USD)
• Can be a full computer
• Has add-on ecosystem
• Lots of connectivity
• On-board Analog to Digital Converter (ADC)
Cons
• Low power
• ARM chipset
FURTHER READING
• Raspberry Pi: https://www.raspberrypi.org/
• Linux Kernel GPIO Sysfs: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
• Examples for GPIO in Bash and PHP: https://github.com/aenglander/iot-examples
• Twisted: http://twistedmatrix.com/
• Intel Edison: http://www.intel.com/content/www/us/en/do-it-yourself/edison.html
• CHIP: https://getchip.com/pages/chip
• Luci: http://www.dronesmith.io/luci/
CONTACT INFO
• @adam_englander on Twitter
• adam@launchkey.com
• aenglander on Freenode
• aenglander on GitHub
• adamenglander on Linkedn

Más contenido relacionado

La actualidad más candente

2nd ARM Developer Day - mbed Workshop - ARM
2nd ARM Developer Day - mbed Workshop - ARM2nd ARM Developer Day - mbed Workshop - ARM
2nd ARM Developer Day - mbed Workshop - ARM
Antonio Mondragon
 

La actualidad más candente (20)

raspberry pi and robots
raspberry pi and robotsraspberry pi and robots
raspberry pi and robots
 
NXP i.MX6 Multi Media Processor & Peripherals
NXP i.MX6 Multi Media Processor & PeripheralsNXP i.MX6 Multi Media Processor & Peripherals
NXP i.MX6 Multi Media Processor & Peripherals
 
Introduction to Hardware Design Using KiCAD
Introduction to Hardware Design Using KiCADIntroduction to Hardware Design Using KiCAD
Introduction to Hardware Design Using KiCAD
 
Home Automation Using RPI
Home Automation Using  RPIHome Automation Using  RPI
Home Automation Using RPI
 
Meeting-Room-Alert-System
Meeting-Room-Alert-SystemMeeting-Room-Alert-System
Meeting-Room-Alert-System
 
GCC 4-1-16
GCC 4-1-16GCC 4-1-16
GCC 4-1-16
 
Using arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsUsing arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of things
 
It's game time
It's game timeIt's game time
It's game time
 
IoT support for .NET (Core/5/6)
IoT support for .NET (Core/5/6)IoT support for .NET (Core/5/6)
IoT support for .NET (Core/5/6)
 
INTRODUCTION TO ARDUINO & RASPBERRY, SENSOR AND TEMPERATURE INTERAFCING
INTRODUCTION TO ARDUINO & RASPBERRY, SENSOR AND TEMPERATURE INTERAFCINGINTRODUCTION TO ARDUINO & RASPBERRY, SENSOR AND TEMPERATURE INTERAFCING
INTRODUCTION TO ARDUINO & RASPBERRY, SENSOR AND TEMPERATURE INTERAFCING
 
IoT support for .NET Core - IoT Saturday 2020
IoT support for .NET Core - IoT Saturday 2020IoT support for .NET Core - IoT Saturday 2020
IoT support for .NET Core - IoT Saturday 2020
 
Amity Raspberry Jam
Amity Raspberry JamAmity Raspberry Jam
Amity Raspberry Jam
 
Low Cost HD Surveillance Camera using Raspberry PI
Low Cost HD Surveillance Camera using Raspberry PILow Cost HD Surveillance Camera using Raspberry PI
Low Cost HD Surveillance Camera using Raspberry PI
 
Apple II Floppy disk emulation explained by example
Apple II Floppy disk emulation explained by exampleApple II Floppy disk emulation explained by example
Apple II Floppy disk emulation explained by example
 
2nd ARM Developer Day - mbed Workshop - ARM
2nd ARM Developer Day - mbed Workshop - ARM2nd ARM Developer Day - mbed Workshop - ARM
2nd ARM Developer Day - mbed Workshop - ARM
 
MarsBoard - NXP IMX6 Processor
MarsBoard - NXP IMX6 ProcessorMarsBoard - NXP IMX6 Processor
MarsBoard - NXP IMX6 Processor
 
BLE Talk
BLE TalkBLE Talk
BLE Talk
 
Costruiamo un Rover in 60 minuti
Costruiamo un Rover in 60 minutiCostruiamo un Rover in 60 minuti
Costruiamo un Rover in 60 minuti
 
Global Azure Bootcamp 2019 - Bandung - Microsoft Azure as Complete Solutions ...
Global Azure Bootcamp 2019 - Bandung - Microsoft Azure as Complete Solutions ...Global Azure Bootcamp 2019 - Bandung - Microsoft Azure as Complete Solutions ...
Global Azure Bootcamp 2019 - Bandung - Microsoft Azure as Complete Solutions ...
 
Micropython for the iot
Micropython for the iotMicropython for the iot
Micropython for the iot
 

Destacado

20 C programs
20 C programs20 C programs
20 C programs
navjoth
 
C programs
C programsC programs
C programs
Minu S
 

Destacado (20)

Connect all your customers on one multichannel platform!
Connect all your customers on one multichannel platform!Connect all your customers on one multichannel platform!
Connect all your customers on one multichannel platform!
 
20 C programs
20 C programs20 C programs
20 C programs
 
Computer Logic
Computer LogicComputer Logic
Computer Logic
 
Python in raspberry pi
Python in raspberry piPython in raspberry pi
Python in raspberry pi
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
Conditional Loops Python
Conditional Loops PythonConditional Loops Python
Conditional Loops Python
 
Loops in c
Loops in cLoops in c
Loops in c
 
Socket Programming In Python
Socket Programming In PythonSocket Programming In Python
Socket Programming In Python
 
Cloud Computing to Internet of Things
Cloud Computing to Internet of ThingsCloud Computing to Internet of Things
Cloud Computing to Internet of Things
 
CS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUALCS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUAL
 
Internet of Things for Libraries
Internet of Things for LibrariesInternet of Things for Libraries
Internet of Things for Libraries
 
C programs
C programsC programs
C programs
 
Building Applications with Eclipse IoT, Block by Block
Building Applications with Eclipse IoT, Block by BlockBuilding Applications with Eclipse IoT, Block by Block
Building Applications with Eclipse IoT, Block by Block
 
Creating end-to-end IoT applications with Eclipse Kura & Solair IoT Platform
Creating end-to-end IoT applications with Eclipse Kura & Solair IoT PlatformCreating end-to-end IoT applications with Eclipse Kura & Solair IoT Platform
Creating end-to-end IoT applications with Eclipse Kura & Solair IoT Platform
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in C
 
Open source IoT
Open source IoTOpen source IoT
Open source IoT
 
IoTWorld 2016 OSS Keynote Param Singh, Ian Skerrett
IoTWorld 2016 OSS Keynote Param Singh, Ian SkerrettIoTWorld 2016 OSS Keynote Param Singh, Ian Skerrett
IoTWorld 2016 OSS Keynote Param Singh, Ian Skerrett
 
Eclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for MicrocontrollersEclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for Microcontrollers
 
Examining the emergent open source IoT ecosystem - IoT World Europe 2016
Examining the emergent open source IoT ecosystem - IoT World Europe 2016Examining the emergent open source IoT ecosystem - IoT World Europe 2016
Examining the emergent open source IoT ecosystem - IoT World Europe 2016
 
2016-09-eclipse-iot-cf-summit
2016-09-eclipse-iot-cf-summit2016-09-eclipse-iot-cf-summit
2016-09-eclipse-iot-cf-summit
 

Similar a Got Python I/O: IoT Develoment in Python via GPIO

Intro to the raspberry pi board
Intro to the raspberry pi boardIntro to the raspberry pi board
Intro to the raspberry pi board
Thierry Gayet
 

Similar a Got Python I/O: IoT Develoment in Python via GPIO (20)

Internet of Things With PHP
Internet of Things With PHPInternet of Things With PHP
Internet of Things With PHP
 
Democratizing the Internet of Things
Democratizing the Internet of ThingsDemocratizing the Internet of Things
Democratizing the Internet of Things
 
Arduino spooky projects_class1
Arduino spooky projects_class1Arduino spooky projects_class1
Arduino spooky projects_class1
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
IoT Physical Devices and End Points.pdf
IoT Physical Devices and End Points.pdfIoT Physical Devices and End Points.pdf
IoT Physical Devices and End Points.pdf
 
Unit 6 - PART2.pptx
Unit 6 - PART2.pptxUnit 6 - PART2.pptx
Unit 6 - PART2.pptx
 
Introduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlIntroduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin Control
 
Getting Started with Raspberry Pi
Getting Started with Raspberry PiGetting Started with Raspberry Pi
Getting Started with Raspberry Pi
 
Intro to the raspberry pi board
Intro to the raspberry pi boardIntro to the raspberry pi board
Intro to the raspberry pi board
 
Up and running with Raspberry Pi
Up and running with Raspberry PiUp and running with Raspberry Pi
Up and running with Raspberry Pi
 
Introduction to Raspberry PI
Introduction to Raspberry PIIntroduction to Raspberry PI
Introduction to Raspberry PI
 
Connecting Hardware to Flex (360MAX)
Connecting Hardware to Flex (360MAX)Connecting Hardware to Flex (360MAX)
Connecting Hardware to Flex (360MAX)
 
ARDUINO AND RASPBERRYPI.pptx
ARDUINO AND RASPBERRYPI.pptxARDUINO AND RASPBERRYPI.pptx
ARDUINO AND RASPBERRYPI.pptx
 
Java Webinar #9: “Raspberry Pi Platform for Java Programmers”
Java Webinar #9: “Raspberry Pi Platform for Java Programmers”Java Webinar #9: “Raspberry Pi Platform for Java Programmers”
Java Webinar #9: “Raspberry Pi Platform for Java Programmers”
 
IoT for data science Module 5 - Raspberry Pi.pptx
IoT for data science Module 5 - Raspberry Pi.pptxIoT for data science Module 5 - Raspberry Pi.pptx
IoT for data science Module 5 - Raspberry Pi.pptx
 
Developing a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT EditionDeveloping a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT Edition
 
4 Introduction to Arduino.pdf
4 Introduction to Arduino.pdf4 Introduction to Arduino.pdf
4 Introduction to Arduino.pdf
 
Arduino Workshop @ MSA University
Arduino Workshop @ MSA UniversityArduino Workshop @ MSA University
Arduino Workshop @ MSA University
 
Arduino
ArduinoArduino
Arduino
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry pi
 

Más de Adam Englander

Más de Adam Englander (20)

Making PHP Smarter - Dutch PHP 2023.pptx
Making PHP Smarter - Dutch PHP 2023.pptxMaking PHP Smarter - Dutch PHP 2023.pptx
Making PHP Smarter - Dutch PHP 2023.pptx
 
Practical API Security - PyCon 2019
Practical API Security - PyCon 2019Practical API Security - PyCon 2019
Practical API Security - PyCon 2019
 
Threat Modeling for Dummies
Threat Modeling for DummiesThreat Modeling for Dummies
Threat Modeling for Dummies
 
ZendCon 2018 - Practical API Security
ZendCon 2018 - Practical API SecurityZendCon 2018 - Practical API Security
ZendCon 2018 - Practical API Security
 
ZendCon 2018 - Cryptography in Depth
ZendCon 2018 - Cryptography in DepthZendCon 2018 - Cryptography in Depth
ZendCon 2018 - Cryptography in Depth
 
Threat Modeling for Dummies - Cascadia PHP 2018
Threat Modeling for Dummies - Cascadia PHP 2018Threat Modeling for Dummies - Cascadia PHP 2018
Threat Modeling for Dummies - Cascadia PHP 2018
 
Dutch PHP 2018 - Cryptography for Beginners
Dutch PHP 2018 - Cryptography for BeginnersDutch PHP 2018 - Cryptography for Beginners
Dutch PHP 2018 - Cryptography for Beginners
 
php[tek] 2108 - Cryptography Advances in PHP 7.2
php[tek] 2108 - Cryptography Advances in PHP 7.2php[tek] 2108 - Cryptography Advances in PHP 7.2
php[tek] 2108 - Cryptography Advances in PHP 7.2
 
php[tek] 2018 - Biometrics, fantastic failure point of the future
php[tek] 2018 - Biometrics, fantastic failure point of the futurephp[tek] 2018 - Biometrics, fantastic failure point of the future
php[tek] 2018 - Biometrics, fantastic failure point of the future
 
Biometrics: Sexy, Secure and... Stupid - RSAC 2018
Biometrics: Sexy, Secure and... Stupid - RSAC 2018Biometrics: Sexy, Secure and... Stupid - RSAC 2018
Biometrics: Sexy, Secure and... Stupid - RSAC 2018
 
Practical API Security - PyCon 2018
Practical API Security - PyCon 2018Practical API Security - PyCon 2018
Practical API Security - PyCon 2018
 
Practical API Security - Midwest PHP 2018
Practical API Security - Midwest PHP 2018Practical API Security - Midwest PHP 2018
Practical API Security - Midwest PHP 2018
 
Cryptography for Beginners - Midwest PHP 2018
Cryptography for Beginners - Midwest PHP 2018Cryptography for Beginners - Midwest PHP 2018
Cryptography for Beginners - Midwest PHP 2018
 
Cryptography for Beginners - Sunshine PHP 2018
Cryptography for Beginners - Sunshine PHP 2018Cryptography for Beginners - Sunshine PHP 2018
Cryptography for Beginners - Sunshine PHP 2018
 
ConFoo Vancouver 2017 - Biometrics: Fantastic Failure Point of the Future
ConFoo Vancouver 2017 - Biometrics: Fantastic Failure Point of the FutureConFoo Vancouver 2017 - Biometrics: Fantastic Failure Point of the Future
ConFoo Vancouver 2017 - Biometrics: Fantastic Failure Point of the Future
 
Con Foo 2017 - Don't Loose Sleep - Secure Your REST
Con Foo 2017 - Don't Loose Sleep - Secure Your RESTCon Foo 2017 - Don't Loose Sleep - Secure Your REST
Con Foo 2017 - Don't Loose Sleep - Secure Your REST
 
ZendCon 2017 - Cryptography for Beginners
ZendCon 2017 - Cryptography for BeginnersZendCon 2017 - Cryptography for Beginners
ZendCon 2017 - Cryptography for Beginners
 
ZendCon 2017: The Red Team is Coming
ZendCon 2017: The Red Team is ComingZendCon 2017: The Red Team is Coming
ZendCon 2017: The Red Team is Coming
 
ZendCon 2017 - Build a Bot Workshop - Async Primer
ZendCon 2017 - Build a Bot Workshop - Async PrimerZendCon 2017 - Build a Bot Workshop - Async Primer
ZendCon 2017 - Build a Bot Workshop - Async Primer
 
Symfony Live San Franciso 2017 - BDD API Development with Symfony and Behat
Symfony Live San Franciso 2017 - BDD API Development with Symfony and BehatSymfony Live San Franciso 2017 - BDD API Development with Symfony and Behat
Symfony Live San Franciso 2017 - BDD API Development with Symfony and Behat
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 

Último (20)

Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 

Got Python I/O: IoT Develoment in Python via GPIO

  • 1. GOT PYTHON I/O IOT DEVELOPMENT IN PYTHON VIA GPIO
  • 2. HISTORICAL PERSPECTIVE HOW I CAME UP WITH THE HAIR-BRAINED IDEA TO USE PYTHON FOR IOT
  • 3. NODEBOTS DAY Put on by Suz Hinton and Pawel Szymczykowski
  • 4. THE LEXICUTIONER Designed a built using SumoBot Jr. (Pawelbot) by Adam Englander and Lexi Glazer
  • 5. PHYSICAL ACCESS SYSTEM Comprised of Raspberry Pi B, power converter, electronic door latch, inline switch. Software is Raspbian with Python 2.7 and Twisted.
  • 6. PYTHON IOT STARTER KIT RASPBERRY PI FOR THE WIN
  • 7. STARTER KIT HARDWARE • Raspberry Pi • Micro USB with AC converter for power • Cat 5 network cable • USB Keyboard • HDMI cable • HDMI capable display – not shown • 3.3V LED with (2) female to female connectors
  • 8. STARTER KIT SOFTWARE • Raspbian • Pre-installed on SD card • Download installer (requires SD card reader): https://www.raspberrypi.org/downloads/ • Python 2.7 • Pre-installed on Raspbian
  • 9. ACCESSING GPIO FROM LINUX BASED SYSTEMS IT’S SO EASY YOU WON’T BELIEVE IT
  • 10. GENERAL PURPOSE INPUT/OUTPUT (GPIO) • A generic pin on an integrated circuit (IC) whose behavior is controlled at runtime • Use to control and transfer data to and from external devices to the IC • Available on all general purpose IC boards
  • 11. IT’S ALL IN THE FILE SYSTEM • Linux GPIO Sysfs Interface for Userspace • Root directory is at /sys/class/gpio • Control Interfaces • Pin Interfaces
  • 12. CONTROL INTERFACE • “export” creates a node to expose a GPIO port to the user space • “echo 18 > /sys/class/gpio/export” will create a gpio18 node at “/sys/class/gpio/gpio18” • “unexport” removes the node for a GPIO port from the user space • “echo 18 > /sys/class/gpio/unexport” removes the gpio18 node
  • 13. GPIO SIGNALS • “direction” determines the direction of a pin. Valid values are “in” and “out”. “in” is used for interrupts • “echo out > /sys/class/gpio/gpio18/direction” will set GPIO pin 18 ’s direction as out • “value” is the value of a pin. It reads a “0” or “1”. Any on-zero value written will be interpreted as “1”. When reading the value ”high” evaluates to ”1” and “low” evaluates to “0” unless overridden by “active_low” • “echo 1 > /sys/class/gpio/gpio18/value” sets the value of GPIO 18 to “1” and closes the circuit • “cat /sys/class/gpio/gpio18/value” would return “1” after the statement above
  • 14. GPIO SIGNALS CONTINUED • “edge” is used to tell the GPIO when to write to ”value” when “direction” is “in”. Valid values are “none”, “rising”, ”falling”, and “both”. • “echo both > sys/class/gpio/gpio18/edge” will trigger an interrupt when voltage increases or decreases • “active_low” is used to invert the effect of “edge” of “value”. Valid values are “1`” and “0”. “1” inverts and “0” sets standard. • “echo 1> sys/class/gpio/gpio18/active_low” will invert the values of high and low
  • 15. PYTHON ACCESS TO GPIO CAT SKINNING 101
  • 16. USE FILE SYSTEM ACCESS • ”open” • “read” • “write”
  • 17. TWISTED • Event loop • Single thread • Asynchronous I/O • HTTP server • Websocket server • File system I/O • Real IoT
  • 19. PLATFORM COMPARISON HOW TO PICK THROUGH THE MYRIAD OF OPTIONS
  • 20. RASPBERRY PI Pros • Moderately Inexpensive (~35 USD) • Flexible platform • Lots of guides and tutorials • GUI interface for beginners • Aptitude package manager • Great starter platform Cons • Requires special cable to do away with keyboard and monitor • Under powered • No built in Analog to Digital Converter (ADC) • A bit on the large side • ARM processor
  • 21. INTEL EDISON Pros • X86 based Atom processor • Ample power, RAM, and storage • Multiple form factors • Arduino developer board can use standard Arduino backplanes • Easy to setup Wi-Fi • Arduino board has Analog to Digital Converter and Python library Cons • Can be a bit pricy (~110 USD) • Not as many guides and tutorials • Documentation is a bit confusing at times • Evolving platform • Sysfs GPIO is flakey
  • 22. DRONESMITH LUCI Pros • Easy to build unmanned vehicles • No real electrical understanding needed • Just uses some simple scripting • Based on Intel Edison Cons • Expensive • Still in early development phase • No real direct development – just scripting routes.
  • 23. CHIP Pros • Super inexpensive (~10 USD) • Wi-Fi • Bluetooth Cons • Low power • Pre-order only
  • 24. BEAGLEBONE BLACK Pros • Inexpensive (~50 USD) • Can be a full computer • Has add-on ecosystem • Lots of connectivity • On-board Analog to Digital Converter (ADC) Cons • Low power • ARM chipset
  • 25. FURTHER READING • Raspberry Pi: https://www.raspberrypi.org/ • Linux Kernel GPIO Sysfs: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt • Examples for GPIO in Bash and PHP: https://github.com/aenglander/iot-examples • Twisted: http://twistedmatrix.com/ • Intel Edison: http://www.intel.com/content/www/us/en/do-it-yourself/edison.html • CHIP: https://getchip.com/pages/chip • Luci: http://www.dronesmith.io/luci/
  • 26. CONTACT INFO • @adam_englander on Twitter • adam@launchkey.com • aenglander on Freenode • aenglander on GitHub • adamenglander on Linkedn

Notas del editor

  1. curl -i -H "content-typeson" --data '{"value": 1}' localhost:8080/gpio/18