**ENGR 21: Computer Engineering Fundamentals** **Fall 2024** CRN 17992 **[Emad Masroor](https://emadmasroor.github.io/) and [Matt Zucker](../index.html)** Quick Links: [Current HW](HW/HW11.html) | [Latest lecture](Lecs/Lec22.pdf) **Mid-Semester Survey**: [Link](https://forms.gle/HuMeqSBr7EFdGKAN7) | Lecture | Tue/Thu 8:30-9:55, Singer 222 | |---------------|----------------------------------------------| | Lab | Mon/Thu 1:15-4:00PM, Singer 222/221 (beginning 9/10) | | Pre-requisites | MATH 025, ENGR 017 | | Wizard sessions | Mon 7:00 PM | | HW due date | Tuesday 11:59 PM (usually) | | Final Exam | None --- final project | | Office Hours (Masroor) | Tue 3:30 - 5:00 PM, Singer 112 | | Office Hours (Zucker) | Thu 9:30 - 11:00 AM, Singer 235 | In ENGR 021: Computer Engineering Fundamentals, you will learn how to teach a computer to do things that engineers need to do using Python. No prior knowledge of programming is assumed, so this will be a 'first course in programming for engineers' at Swarthmore. You will learn how to program computers (such as a laptop or desktop) and microcontrollers (such as the Circuit Playground Express) to manipulate information and perform tasks relevant to engineering, and to develop your sense of 'computational thinking'. You will also learn how to use basic numerical methods that are commonly used in engineering. The course can (conceptually) be divided into three parts: * Introduction to programming * Using a microcontroller to observe and manipulate the environment * Numerical techniques and their applications to engineering # Course Schedule Class | Lecture | Topic | HW due | Test (Content) | Lab ---- |:---- | :---- | :---- | :---- | :-- 1.1
09/03 | [Lec 1](Lecs/Lec1.pdf) | Introduction & Installation; variables & types | | | 1.2
09/05 | [Lec 2](Lecs/Lec2.pdf) | Programming basics: variables, types, conditionals | | | 2.1
09/10 | [Lec 3](Lecs/Lec3.pdf) | Base systems; Analog vs. digital data [[files](Lecs/lec3_files.zip)] | [HW 1](HW/HW1.html) [[solutions](HW/HW1-solutions.html)] | | [Lab 1: Capacitive touch passcode](Labs/lab1.html) 2.2
09/12 | [Lec 4](Lecs/Lec4.pdf) | Relative & absolute errors; [[files](Lecs/lec4_files.zip)] | | | Lab 1 3.1
09/17 | [Lec 5](Lecs/Lec5.pdf) | For/while loops; 'dot notation' [[files](Lecs/lec5_files.zip)] | [HW 2](HW/HW2.html) [[solutions](HW/HW2-solutions.html)] | | Lab 1 3.2
09/19 | [Lec 6](Lecs/Lec6.pdf) | Functions; Finite State Machines [[files](Lecs/lec6_files.zip)] | | Test 1 (weeks 1-2) | Lab 1 4.1
09/24 | [Lec 7](Lecs/Lec7.pdf) | Desktop installation; IDEs | [HW 3](HW/HW3.html) [[solutions](HW/HW3-solutions.html)] | |
[Lab 2: Joystick, loops, and functions](Labs/lab2.html) 4.2
09/26 | [Lec 8](Lecs/Lec8.pdf) | Floating point numbers | | | Lab 2 5.1
10/01 | [Lec 9](Lecs/Lec9.pdf) | Introduction to `numpy` [[files](Lecs/lec9_files.zip)] | [HW 4](HW/HW4.html) [[solutions](HW/HW4-solutions.html)] | | Lab 2 | 5.2
10/03 | [Lec 10](Lecs/Lec10.pdf) | Data Visualization for Engineering in Python | | Test 2 (weeks 3-4) | Lab 2 6.1
10/08 | [Lec 11](Lecs/Lec11.pdf) | Root-finding [[files](Lecs/bisection_algorithm.py)] | [HW 5](HW/HW5.html) [[solutions](HW/HW5-solutions.html)] | |
[Lab 3: Pen plotter](Labs/lab3.html) 6.2
10/10 | [Lec 12](Lecs/Lec12.pdf) | Root-finding | | | Lab 3 6+i | - | **Fall break** | | | 7.1
10/22 | [Lec 13](Lecs/Lec13.pdf) | Linear Systems | [HW 6](HW/HW6.html) [[solutions](HW/HW6-solutions.html)] | | Lab 3 7.2
10/24 | [Lec 14](Lecs/Lec14.pdf) | Linear Systems | | Test 3 (weeks 5-6) | Lab 3 8.1
10/29 | [Lec 15](Lecs/Lec15.pdf) [[files](Lecs/interpolate_these.txt)] | Curve fitting & Interpolation | [HW 7](HW/HW7.html) [[solutions](HW/HW7-solutions.html)] | |
[Lab 4: Cubic spline interpolation](Labs/lab4.html) | 8.2
10/31 | [Lec 16](Lecs/Lec16.pdf) [[files](Lecs/datapoints.txt)] | Curve fitting & Interpolation | | | Lab 4 | 9.1
11/05 | [Lec 17](Lecs/Lec17.pdf) | Optimization | [HW 8](HW/HW8.html) [[solutions](HW/HW8-solutions.html)] | | Lab 4 9.2
11/07 | [Lec 18](Lecs/Lec18.pdf) | Optimization | | Test 4 (weeks 7-8) | Lab 4 10.1
11/12 | [Lec 19](Lecs/Lec19.pdf) [[files](Lecs/lec19.zip)] | Optimization | [HW 9](HW/HW9.html) [[solutions](HW/HW9-solutions.html)] | |
[Lab 5: Optimizers for image approximation](Labs/lab5.html) 10.2
11/14 | [Lec 20](Lecs/Lec20.pdf) | Numerical Differentiation | | | Lab 5 11.1
11/19 | [Lec 21](Lecs/Lec21.pdf) | Numerical Integration | HW 10 [canceled] | | Lab 5 11.2
11/21 | [Lec 22](Lecs/Lec22.pdf) | Initial Value Problems | | Test 5 (weeks 9-10) | Lab 5 12 | T 11/26 | No class | | | [Final project](https://docs.google.com/presentation/d/1pfxCyCjkx1bTL_9U3dErih7icFER75kSIthaCGwBUPk/edit?usp=sharing) 12 | - | **Thanksgiving** | | | | 13 | T 12/03 | Final Project | [HW 11](HW/HW11.html) | | Final project 13 | R 12/05 | Final Project | | Test 6 (Lectures 10.2, 11.1, 11.2) | Final project 14 | T 12/10 | Final Project | | | Final project # Teaching Team Name | Role | `email@swarthmore.edu` ---- |:---- | :---- Emad Masroor | Instructor | emasroo1 Matt Zucker | Lab Instructor | mzucker1 Nick Fettig | Wizard | nfettig1 Ernest (Roe) Crawford | Wizard | ecrawfo2 Xezel Peshlakai | Wizard | xpeshla1 Owen Hoffman | Grader | ohoffma1 Hillary Kim | Grader | hkim11 # Textbook - **Required**: _Numerical Methods in Engineering with Python 3_ by Jaan Kiusalaas. You can get a physical copy from the [Swarthmore Campus & Community store](https://store.swarthmore.edu/LoginOptions?ReturnUrl=/SelectTermDept), and you may or may not be able to find an electronic copy on the internet. - **Recommended**: _Programming with Micropython_ by Nicholas H. Tollervey. Any code examples from this book can be found at [this GitHub repository](https://github.com/ntoll/programming-with-micropython). # Course Components ## Lectures You are expected to attend lectures. ## Homework Assignments Homework will be assigned approximately every week, and will typically be due by midnight on the Tuesday following the week in which it was assigned. You can generally expect HW $n$ to cover the material from week $n$, and to be due in week $n+1$. Typically, homework will be submitted on Moodle using Gradescope. ## Labs Labs will be held on Mondays or Thursdays from 1:15 to 4:00. You should be signed up for either Monday (CRN 19688) or Thursday (CRN 19689). ## Tests There will be six tests over the course of the semester, in lieu of midterms. These tests will be held on **Thursdays during the first half of class time** (typically for 20 to 25 minutes), and will typically be closed-book, closed-notes and closed-computer. The tests will usually be incremental rather than cumulative, and will only cover the material from a few weeks prior to each test. Typically, test $n$ will cover the material from week $2n−1$ and week $2n$, and will be held on week $2n+1$; for example, test 1 will cover weeks 1 and 2 and will be held on the Thursday of week 3; test 2 will cover weeks 3 and 4 and will be held on the Thursday of week 5, etc. ## Final Project In lieu of a final exam, you will have a final project, aka 'Lab 6'. There will be dedicated class time to work on your final project in the last two weeks of class. # Grades Grading will follow approximately the divisions shown below: * Homework: 20% * Tests: 40% * Lab: 20% * Final project: 15% * Class participation: 5% Your participation grade will depend on: * Attendance in class * Involvement in discussions and in-class activities * Being a good citizen of groups/teams you are a part of. The assignment of letter grades will be at the discretion of the instructors, but will generally adhere to the following schematic: A- 90+, B- 80+, C- 70+, D- 60+, NC < 60. # Class Communication using 'Ed Discussion' We will use the [Ed Discussion](https://edstem.org/us/courses/61903/) platform for course communication. While you are still welcome to email the instructor directly with questions you may have, please use Ed Discussion as a first step when you have a question about the course; you are encouraged to answer each other's questions (as long as you are not directly providing solutions to homework problems or lab assignments). The instructor as well as Wizards will monitor Ed Discussion and answer questions, as well. # Course Policies ## Collaboration and attribution * Feel free to collaborate with your classmates on homework; however, you must submit your own work. Duplicating others’ assignments verbatim (especially code!) is prohibited. * If you do discuss homework with your classmates, we expect you to disclose any such collaboration clearly in your submitted work. Err on the side of caution – it’s the best way to avoid awkward conversations about suspicious similarities between assignments. * Cite any external sources used, including the textbook, internet, discussions with other professors, etc. Aside from the course-specific policies above, you are expected to understand and abide by the college's [policy on academic misconduct](https://www.swarthmore.edu/student-handbook/academic-policies#academic_misconduct). ## Late policy - In general, late assignments will not be graded. However: - You may ask for (and automatically receive) a one-week extension on homework and lab assignments, no questions asked, once each during the semester. Please indicate in your email that you are using your ‘one free extension’ when you do so. Your ‘free extension’ applies once to homework assignments and once to lab assignments. - If you have extenuating circumstances and would like to request an extension on an assignment, please reach out via email to the instructor *at least 24 hours before the deadline*. Such a request may be granted on a case-by-case basis. ## Policy on Artificial Intelligence and Computer Assistance With the widespread availability of Large Language Models (LLMs), such as OpenAI's ChatGPT, Google's Bard, or Microsoft's Bing AI, you have unprecedented access to a new, powerful piece of technology that has the potential to drastically change the way we obtain information. LLMs are a brute-force method of providing answers to questions that works by employing the technology behind auto-complete at massive scale (in Matt Zucker's words, "spicy autocomplete"). It can be quite useful when used in the right way, but as with any external tools that you might want to use, there are policies regarding acceptable use of AI tools for this class. - You are not permitted to use Large Language Models to write any part of the code that you will turn in for the class, whether homework or lab assignments. Similarly, you may not re-use code that you find on an online resource or forum. - You are encouraged to use AI tools creatively to aid in your understanding. For example, you might a LLM: ``What is the difference between LU Decomposition and Singular Value Decomposition, and how are the two used?``. - Consulting an AI tool or other unauthorized online resource during a `closed-book' test will be treated as academic misconduct. # Accommodations If you believe you need accommodations for a disability or a chronic medical condition, please contact Student Disability Services via email at [studentdisabilityservices@swarthmore.edu](studentdisabilityservices@swarthmore.edu) to arrange an appointment to discuss your needs. As appropriate, the office will issue students with documented disabilities or medical conditions a formal Accommodations Letter. Since accommodations require early planning and are not retroactive, please contact Student Disability Services as soon as possible. For details about the accommodations process, visit the [Student Disability Services website](https://www.swarthmore.edu/office-academic-success/welcome-to-student-disability-services). You are also welcome to contact me privately to discuss your academic needs. However, all disability-related accommodations must be arranged, in advance, through Student Disability Services. ***Even outside the context of accommodations for disabilities, if there is something we can do to facilitate your learning, please do not hesitate to contact us.*** # Resources ## Guides and Tutorials * [Official Python website](https://www.python.org/downloads/) * [Virtual Environments in Python](https://docs.python.org/3/tutorial/venv.html) * [Guide to using the Circuit Playground Express](CPX_guide.html) * [Official CircuitPython documentation](https://docs.circuitpython.org/en/latest/README.html) --- use this page to look up the full documentation for functions. * [Download Mu](https://codewith.mu/), the simple IDE for Python and CircuitPython * [Download CircuitPython for the Circuit Playground Express](https://circuitpython.org/board/circuitplayground_express/) --- this provides the library `adafruit_circuitplayground`, which contains high-level wrappers for most CPX functionality. * [Product page for the Circuit Playground Express](https://www.adafruit.com/product/3333) * [Official Guide for the Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express?view=all) # Learning goals At the end of this course, you will be able to: - Write programs on the desktop and on microcontrollers : - Control the flow of a program using if statements, for/while loops, functions - Perform computations using variables and lists / `numpy` arrays - Print strings/results and debug code using print statements - Understand how to use external modules/libraries such as `numpy` - Explain how information is represented by computers and microcontrollers: - Explain the base system and how it is used to represent decimal, binary and hexadecimal numbers. - Convert numbers between decimal, binary, and hexadecimal representations. - Define the range of variable types such as booleans, bytes, (un)signed integers, and floats, and explain their potential use cases. - Determine the value of a signed variable from its binary or hexadecimal representation. - Use and understand fundamental numerical methods topics relevant to engineering - Understand the concept of convergence, sources of error (e.g. truncation and round-off), relative and absolute error - Use root finding to solve one-dimensional equations numerically - Use Gaussian elimination to solve systems of linear equations - Apply linear systems solving to do linear least-squares curve-fitting - Understand single- and multi-variable unconstrained optimization - Program microcontrollers for applications relevant to engineering - Interface with peripheral devices using digital inputs/outputs (e.g. LED, tactile switch) - Interface with peripheral devices using analog-to-digital converters (e.g. temperature sensor) - Interface with peripheral devices using pulse-width modulation (e.g. servo motor) - Interface with peripheral devices using serial communications (e.g. accelerometer or LCD) - Place computing and embedded systems in a broader social context - Identify examples of embedded systems in everyday life - Discuss impact of systems on different aspects of society