Internet of Things With Python
Internet of Things With Python
1. Overview of IOT:
As per the hardware and software engineers point of view, IOT is to build interconnected
products. Embedded systems are already playing a crucial role in the development of the IoT. In
broad strokes, there are four main components of an IoT system:
The Thing itself (the device)
The Local Network; this can include a gateway, which translates proprietary
communication protocols to Internet Protocol
The Internet
Back-End Services; enterprise data systems, or PCs and mobile devices
What is a GPIO?
GPIO - General Purpose Input/Output(GPIO) : It is a flexible software-controlled digital signal.
GPIOs are provided from many kinds of chip, and are familiar to Linux developers working
with embedded and customer hardware.
Each GPIO represents a bit connected to a particular pin or ball on Ball Array Grid(BG)
System-on-Chip (SOC) process heavily relay on GPIOs. In some cases, every non-dedicated pin
can be configured as a GPIO.
The Capabilities of GPIOs:
The exact capabilities of GPIOs vary between systems. Here some of the common properties are
below
Note: If screen shell session manager is not installed enter the below command
#sudo apt-get install screen
2. To connect to the board, enter the following command and enter password
#sudo screen /dev/ttyUSB0 115200
You have now established serial communication with your board. You can now interact with
your board by entering common Linux commands.
Configuring GPIO Port
Lets assume gpio40 corresponds to Digital Pin8. Following commands will show how to
instantiate, set direction, define drive strength and set/read the value of a GPIO port.
Before configuring the GPIO port the sys file system as below. Form the screen shot, there is no
folder named with gpio40
Instantiation of GPIO:
# echo -n "40" > /sys/class/gpio/export
Above command will create /sys/class/gpio/gpio40 folder. Please verify the below screen shot
Above command will set the direction of gpio40 to out. To set the direction to input then
execute
#echo -n in > /sys/class/gpio/gpio40/direction
If the direction is set to output, below command will set the output of gpio40 port to low.
#echo -n "0" > /sys/class/gpio/gpio7/value
Screen shot for the above commands
Galileo Gen2 has 79 gpio ports and only 13 of them will correspond to on boards Digital I/O
pins.
Ref: https://en.wikipedia.org/wiki/General-purpose_input/output
GPIO
Digital I/O
gpio11
pin0
gpio12
pin1
gpio13
pin2
gpio14
pin3
gpio6
pin4
gpio0
pin5
gpio1
pin6
gpio38
pin7
gpio40
pin8
gpio4
pin9
gpio10
pin10
gpio5
pin11
gpio15
pin12
gpio7
pin13