Course Syllabus

 

Instructor:                              Van Simmons

 

Course Dates and Times:  Mondays 08:00 PM - 10:00 PM, Jan 28 - May 13, 2018

Location:  1 Story Street, Room 307, Cambridge MA

PREREQUISITES:

While this is an introduction to IoT development, it is not an introductory programming course.  Accordingly, students need to have:

  • working knowledge of at least one object-oriented programming language such as Java, Javascript or Python 
  • a firm understanding of how to compile code, use libraries, use a debugger

The ability to use a source control tool such as git will be very helpful. 

Students must purchase a standard hardware kit consisting of a Raspberry Pi 3 Model B+ with power supply and several hardware sensor and control modules that are used during the course.  R/Pi’s are available from many sources, a minimal configuration which meets the requirements of the class can be found at the following links:

R/Pi: https://www.amazon.com/ELEMENT-Element14-Raspberry-Pi-Motherboard/dp/B07BDR5PDW/ref=sr_1_3?s=electronics&ie=UTF8&qid=1541086641&sr=1-3&keywords=raspberry+pi+3+b%2B

Power supply: https://www.amazon.com/CanaKit-Raspberry-Power-Supply-PiSwitch/dp/B07GZZT7DN/ref=sr_1_1_sspa?s=electronics&ie=UTF8&qid=1541086994&sr=1-1-spons&keywords=raspberry+pi+3b+power+supply&psc=1

xD Card: https://www.amazon.com/SanDisk®-microSDHCTM-8GB-Memory-Card/dp/B0012Y2LLE/ref=sr_1_5?s=electronics&ie=UTF8&qid=1545930726&sr=1-5&keywords=8gb+micro+sd+card

You will also need a card read to create the operating system image for the Pi.  Many Mac notebook models have these built in, but if you don't have one, something like this should work:

https://www.amazon.com/UGREEN-Reader-Memory-Windows-Simultaneously/dp/B01EFPX9XA/ref=sr_1_7?s=electronics&ie=UTF8&qid=1545931781&sr=1-7&keywords=usb+sd+card+reader

Note that the above is not an endorsement of a particular vendor or package, it’s simply one example, there are many other configurations and you should buy one that suits your needs.  For example you might also want a case for your R/Pi, of which there are many.

The components of the sensor kit to be used may be purchased at:

http://store.linksprite.com/linker-kit-for-raspberry-pi-pcduino/ and

http://store.linksprite.com/linker-kit-base-shield-for-raspberry-pi-b-2b-3-with-adc-interface-v3-1/

To attach the shield to the Pi, you will also want some 12mm spacers like the ones in this kit: https://www.amazon.com/Spacer-Standoffs-Screws-Assortment-Female/dp/B071483R3F/ref=sr_1_cc_4?s=aps&ie=UTF8&qid=1545930917&sr=1-4-catcorr&keywords=M2.5+12mm+spacer

Note that this components will not be used until week 5 or 6 of class so you may wait until class begins to purchase these items if you are not sure that you will take the class.

A limited number of loaner devices are available at 53 Church Street on a first-come, first-served basis.

This class uses the Swift programming language, so the student must have a Macintosh laptop running a current version of the operating system with the most recent version of Apple's Xcode IDE installed.  Please note that it is not possible to use a Linux or Windows computer for this course as it will be difficult for students to follow along with the development done in class.

PRE-TEST

A pre-test has been made available.  All students should verify that they meet the course prerequisites by taking the pretest.

Assignment 0

Assignment 0 consists of preparatory readings, creation of the operating system image for the R/Pi and setting up the student's code repository for assignments. GitHub classroom will be used for all assignment repositories and will require an invitation from the Instructor (and hence completed registration by the student) in order to join the class along with a demo of how to set up student's repository.  

Assignment 0 will be posted to the course website the week of January 21st, 2019.  All students should have Assignment 0 completed before first class meeting.  A video showing the steps involved in creating the operating system image will be posted at the same time.

Assignment 1 will be due February 25th, 2018.

COURSE OUTLINE:
 This course introduces the basics of contemporary IoT application development using Swift as the development platform and a Raspberry Pi as the deployment platform. The objective of the course is to enable to the student to build an IoT application using the standard Swift tool chain and then deploy it securely using standard tools such as docker. Requirements for the course will be met by the student demonstrating an ability to develop an application which implements a docker container which can be deployed to a Raspberry Pi which interacts with a) the cloud, b) mobile devices via Bluetooth and c) its environment via GPIO input and output devices.

We begin by surveying the major features of the Raspberry Pi. Specific features to be explored will include the Debian distribution of Linux, particularly its networking and security models and the steps necessary to secure a Pi-based IoT device.  We then explore the operational elements of the Docker container platform and how Docker can be used to manage deployment of code to IoT devices.

We then cover the Swift programming language and portions of its standard library. Language features which will be most focused on will include: the Swift type system (tuple/enum/struct/class/func/protocol), closures, optionals, and generics. This basis will then lead to discussion of various functional programming techniques in Swift centered around the map and reduce second order functions.

After an introduction to the Swift language, we will explore creating a service process on the device using Apple’s SwiftNIO package to communicate with a cloud API provided by the instructor.  Once we master deployment of our initial service we will add the ability to communicate with nearby devices using the Bluetooth 4 Low Energy protocol.  A test application which runs as an iPhone app will be provided by the instructor.

Finally, we extend the programming model to cover access to the GPIO devices included in the course materials specified above.

Topics to be covered in order:  

Course Section (~2 classes each)

Focus

Section topics

1

Introduction to the Raspberry Pi

Policies; OS options, Installing the base OS with flow and cloud-init, securing the device using SSH and LUKS, connecting it to a network:  Demo’s of functionality:  the Docker container platform

2

Model Development with Swift 

Swift language essentials: Arrays, Dictionaries, functions, Optionals, Control Flow, Structs Enums and Classes, Playgrounds.  Elements of The Swift Foundation classes, CocoaTouch Foundation Framework, Simple connections to the User Interface.

Major emphasis will be on the Swift type system (base types, tuples, enums, structs, classes, function, and protocols), generics, optionals and closures.  This will then be extended to include the closure passing style of functional programming as developed in the map/reduce functions of the Swift Standard Library.

3

IoT services with SwiftNIO

Introduction to NIO. Servers, channels, event handling. Writing a service, automatically starting the service, deploying services with Docker.

4

Using Bluetooth LE and GATT

Background and history of Bluetooth LE. Introduction to BLE. Central and Peripheral modes.  Services, characteristics and descriptors. Managing device connections. Advertising and beacons.

5

Using GPIO SPI and UART

Introduction to hardware devices and GPIO.  Writing handlers for GPIO, SPI and UART devices.

ASSIGNMENTS AND READINGS: Frequent small assignments progress from basic programming to realistic service development with a focus on responsiveness and algorithms. We will build a working service covering all topics as a final project.  The final project will reuse code from each of the assignments, so please be aware: the final project is cumulative over all of the material discussed in the class, failure to absorb any of the basic concepts mentioned above will be very detrimental to the students outcome. Readings will come from a combination of: The Apple Developer Library; Chapters from e-Books; and online blog posts and tutorials.

GRADING: Each of the 4 regular assignments is valued at 100 points, the final project at 200 points. It should be noted that the eventual grade of the student will depend most heavily on building the application for the final project. If the student can demonstrate mastery of all of the techniques in the final project they may have their grade be based solely on the final project.  The instructor will grade on the higher of the overall average across all assignments, including the final project or of the final project grade alone.  When grading programming assignments, a strong emphasis is placed on good coding practices, code design and correct implementation of platform-specific architectural principles.  These criteria are to some extent subjective but expectations for them will be clearly specified in class.

LATE POLICY: As the course builds on previous material and students will receive a working version of code immediately following the due date for each assignment, there has to be a zero-tolerance late policy for all assignments. 

TOOLS: Xcode, Raspberry Pi, IoT hardware and git. Class assignments (which include readings) will be hosted on Canvas and lecture materials will be hosted on the instructors GitHub account which will be publicly available. As part of Assignment 0 to be completed before the first class, each student will need to set up an individual repository, with a username and password, into which they will submit all assigned work. The naming conventions will be spelled out so that all submissions have the same directory structure. Additionally, the student will need to install the base R/Pi OS image provided by the instructor.  The first class will review how to obtain all materials to verify that students have successfully completed Assignment 0. For more information on git and GitHub see: 

  • https://services.github.com/on-demand/ 
  • https://guides.github.com/activities/hello-world/ 
  • https://guides.github.com 
 

ONLINE DISCUSSION:We will use the discussion forums as provided in the Canvas platform to allow students to communicate with the instructors, TA's and each other.  All questions about the course material should be directed to this forum:

  • for maximum visibility to staff and students 
  • to assure that all students are doing their own work 
  • to make sure that everyone has equal access to all resources.

While you are welcome to read additional material on the internet, asking questions using outside sources for assistance such as StackOverflow will be considered an honors violation and treated accordingly.

LECTURES AND WORKLOAD: Lectures will be heavily example-driven. The final project requires cumulative knowledge drawn from each lecture, so attendance, while not part of your grade, is EXTREMELY important. For a well-prepared student, the workload is ~2 hours or reading and ~2 hours of programming/per week, with the final project being roughly 2 to 3 times that amount.  

GRADUATE CREDIT EXPECTATIONS: If you are taking this course for graduate credit, there will be  specific additional programming requirements for your final project. Assignments 1-4 will be the same for all students,  the specific graduate credit requirements will be detailed in the final project definition.

ACCESSIBILITY:Harvard is committed to providing an accessible academic community. The Accessibility Office offers a variety of accommodations and services to students with documented disabilities. Please visit http://www.summer.harvard.edu/resources-policies/accessibility-services for more information. 

ACADMIC INTEGRITY AND STUDENT RESPONSIBILITY:As with all Harvard courses, you are responsible for understanding Harvard's policies on academic.  Here are the Official Harvard Extension School Policies:

The Extension School is committed to providing an accessible academic community. The Accessibility Office offers a variety of accommodations and services to students with documented disabilities. Please visit https://www.extension.harvard.edu/resources-policies/resources/disability-services-accessibilityfor more information.

You are responsible for understanding Harvard Extension School policies on academic integrity (https://www.extension.harvard.edu/resources-policies/student-conduct/academic-integrity) and how to use sources responsibly. Not knowing the rules, misunderstanding the rules, running out of time, submitting the wrong draft, or being overwhelmed with multiple demands are not acceptable excuses. There are no excuses for failure to uphold academic integrity. To support your learning about academic citation rules, please visit the Harvard Extension School Tips to Avoid Plagiarism (https://www.extension.harvard.edu/resources-policies/resources/tips-avoid-plagiarism), where you'll find links to the Harvard Guide to Using Sources and two free online 15-minute tutorials to test your knowledge of academic citation policy. The tutorials are anonymous open-learning tools.

  

Student Support Tips

Instructor Support Tips

 

Course Summary:

Course Summary
Date Details Due