Interfacing with


About this course: The Raspberry Pi uses a variety of input/output devices based on protocols such as HDMI, USB, and Ethernet to communicate with the outside world. In this class you will learn how to use these protocols with other external devices (sensors, motors, GPS, orientation, LCD screens etc.) to get your IoT device to interact with the real world. Most physical devices use analog signals; however computer hardware is digital so in this class you will learn how these signals are converted back-and-forth and how this must be considered as you program your device. The basic design of a sensor-actuator system will also be covered. You will also learn how to build more sophisticated hardware systems using Raspberry Pi expansion boards to create fun and exciting IoT devices.

Course duration:  3 weeks

Created by:  BrilliantArms, India

Module 1
This module presents the use of the Raspberry Pi to connect to the Internet, from a user perspective. The first way to use the Raspberry Pi as a networked device is to use it as a general-purpose computer rather than as a programmed IoT device. Using networking with a Raspberry Pi in this way is similar to using the network from any Linux machine, and we present its use in this module. We also present the standard Internet protocols that must be understood in order to develop network programs.
  1. Lecture 1.1 – Network
  2. Lecture 1.2 – Secure Shell
  3. Lecture 1.3 – SSH Client/Server
  4. Lecture 2.1 – SSH Server
  5. Lecture 2.2 – Network Programs
  6. Lecture 2.3 – Internet Protocols
  7. Lecture 3.1 – IP Addresses
  8. Lecture 3.2 – Domain Names
  9. Lecture 3.3 – Client/Server
Module 2
  1. Lecture 1.1 – Sockets
  2. Lecture 1.2 – Sending Data
  3. Lecture 1.3 – Exceptions
  4. Lecture 2.1 – Server Code
  5. Lecture 2.2 – Live Server
  6. Lecture 2.3 – Internet Control
  7. Lecture 3.1 – Python Client Demo
  8. Lecture 3.2 – Python Server Demo

Module 3

This module focuses on how to have your Raspberry Pi interact with online services through the use of public APIs and SDKs. Many interesting and useful services are available in the cloud and this module describes how to write code that accesses those services. We define what an Application Programming Interface (API) is and what a Software Development Kit (SDK) is. We present some API examples and we show the use of the Twitter API in detail using the Twython package.
  1. Lecture 1.1 – Network Libraries
  2. Lecture 1.2 – Web Services
  3. Lecture 1.3 – Public APIs
  4. Lecture 2.1 – Twitter’s API
  5. Lecture 2.2 – Twitter Registration
  6. Lecture 2.3 – Sending a Tweet
  7. Lecture 2.4 – Sending a Tweet (Demo)
  8. Lecture 3.1 – Twython Callbacks
  9. Lecture 3.2 – Tweet Response
  10. Lecture 3.3 – Responding to a Tweet (Demo)

Module 4

In this module we show how to use the Raspberry Pi to interface with more complicated sensors and actuators. We explore the use of the Raspberry Pi camera module and the use of a servo. The Raspberry Pi camera module is used through the picamera library, which we describe. Servos are controlled by generating pulse width modulated signals and varying their pulse width using library functions.
  1. Lecture 1.1 – Camera Module
  2. Lecture 1.2 – picamera Library
  3. Lecture 1.3 – Capturing Images
  4. Lecture 2.1 – Camera (Demo)
  5. Lecture 2.2 – PWM on RPI
  6. Lecture 2.3 – Servo Control
  7. Lecture 3.1 – Servo Code
  8. Lecture 3.2 – Servo (Demo)