Difference between revisions of "ME 333 Introduction to Mechatronics (Archive Winter 2013)"

From Mech
Jump to navigationJump to search
 
(94 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''Winter Quarter 2013'''
'''Winter Quarter 2013'''


'''First day of class is Thursday Jan 5!'''
'''First day of class is Tuesday Jan 8'''
* Section 20: Prof. Kevin Lynch, T Th, 11:00-12:20, Tech LR5
* Section 20: Prof. Kevin Lynch, T Th, 11:00-12:20, Tech LR5
* Section 21: Prof. Nick Marchuk, T Th, 12:30-1:50, Tech LR5
* Section 21: Prof. Nick Marchuk, T Th, 12:30-1:50, Tech LR5
* TAs: Nelson Rosa, nelsonrosa2013 at u.northwestern.edu; Jarvis Schultz, JarvisSchultz2012 at u.northwestern.edu
* TAs: Alex Ansari, AlexanderAnsari2011 at u.northwestern.edu; Jian Shi, JianShi2011 at u.northwestern.edu
* C Peer Instruction Sessions:
* Circuits Review Session: Mon Jan 9, 7 PM, Prof. Lynch, Tech L221; Wed Jan 11, 7 PM, Prof. Marchuk, Tech L221
* '''Final demo''' (in lieu of final exam): Monday March 18 3-5 PM (12:30-1:50 section) and Wed March 20 9-11 AM (11-12:20 section) in LR5
* C Peer Instruction Sessions, 7-8:30 PM, Seeley-Mudd Engineering Library Room 230
** Thurs Jan 12
** Tues Jan 17
** Wed Jan 18
* '''Final demo''' (in lieu of final exam): Monday March 12 3-5 PM and Wed March 14 9-11 AM in LR5.
* Office Hours:
* Office Hours:
** Mon 4-6 PM: Jarvis Schultz, Mechatronics Lab, Ford B100
** Mon-Fri 3-5 PM: Prof. Marchuk, Mechatronics Lab, Ford B100
** Tues 2-3 PM: Prof. Lynch, B221
** Mon 11:30-1:30 PM: Alex Ansari, Willens Wing Atrium
** Wed 3-5 PM: Nelson Rosa, Mechatronics Lab, Ford B100
** Tues 2-3 PM: Prof. Lynch, B290
**Thurs 3-4 PM: Prof. Lynch, B221
** Wed 12:00-2:00 PM: Jian Shi, NxR Lab, B230
** Fri 3-4 PM: Prof. Marchuk, Mechatronics Lab, Ford B100
** Thurs 3-4 PM: Prof. Lynch, B290
** Mon-Fri 4-5 PM: Prof. Marchuk, Mechatronics Lab, Ford B100



== Purpose of this Course ==

The purpose of this course is to '''provide tools that help you express your creativity'''. Maybe you want to build a robot, or a piece of kinetic art, or an automatic ball-throwing device to entertain your dog; maybe you've identified a market for a new smart product and you'd like to prototype the device. This course provides fundamentals of mechatronics to give you confidence to take on these projects. You are encouraged to take what you learn in this course and apply it in the project-based ME 433 Advanced Mechatronics course, Design Competition, or independent projects.

== Approximate Syllabus ==

This course is for students that want to build microprocessor-controlled electromechanical devices.

To do this, ME 333 focuses on three topics: (1) general C programming; (2) Microchip PIC microcontroller architecture and C programming specific to the PIC (e.g., using the PIC's peripherals, such as analog inputs, digital I/O, counters/timers, comm ports, etc.); and (3) interfacing the PIC to sensors and actuators, some theory of sensor and actuator operation, and interface circuitry and signal processing.

'''You will do a lot of programming in this course!''' If you are certain you hate programming, then this is not the course for you. But knowing how to program is very useful for any modern engineer. The language we will use is C, a fairly low-level language that works well for microcontrollers, without being nearly as painful and low-level as assembly language. If you don't know C, that's not a problem, most students don't before taking ME 333; but you should plan to learn it, and rather quickly. You will have all the materials you need to start learning C before class starts, and '''the first assignment on C is due on the first day of class'''! The reason: even though we start out with C, that's not the main goal of this course. The main goal is to teach you about microcontrollers and mechatronics. Plus some students already have C background.

You will bring your laptop to each class. As the quarter progresses, we will be handing out other equipment that you will need to bring to class, such as the [[NU32: Introduction to the PIC32|NU32 development board]] that breaks out the [http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en545660 PIC32MX795F512L] microcontroller.

'''It is essential you do the assigned reading in advance of class.''' Classes will begin with you turning in a short problem set related to the reading. (This includes the very first day of class!) Once a week we will have a short quiz. Most classes will be a combination of a brief review, Q&A, and working individually or in small groups on problems while the instructors help answer any questions.

Topics we will cover include:

* introduction to C programming
* introduction to the PIC32 hardware, and programming the PIC32 in C
* digital I/O
* counters/timers and interrupts
* analog input
* sensor smorgasbord
* digital signal processing: filters and FFTs
* analog output and pulse-width modulation
* brushed permanent magnet DC motors: theory and control
* stepper motors and RC servo motors
* communication by SPI, I2C, and RS-232


== Checklist to Complete Before the First Day of Class ==
== Checklist to Complete Before the First Day of Class ==


Attendance at the first day of class (Thursday Jan 5) is mandatory. By the first day of class, you should:
Attendance at the first day of class (Tuesday Jan 8) is mandatory. By the first day of class, you should:


* Complete the reading and assignment 1, which is '''due the first day of class!''' In fact, the first two weeks of assignments are already posted, so you are welcome to complete them all over the break and coast through the first two weeks of class. The first assignments are designed to get you up to speed on the C programming language, which we will use throughout the course.
* Be able to solve circuit problems similar to those on the practice problem set and last year's quiz at the bottom of [[ME_333_Circuits_Review_Material|this page]]. Be prepared for a quiz on this material in the second week of class. We will only spend one class period reviewing this material.
* Have a laptop with at least 2 USB ports. Any operating system is fine. One port will be used to program and communicate with your PIC microcontroller, and the other will be used for your portable oscilloscope.
* Have a laptop with at least 2 USB ports. Any operating system is fine. One port will be used to program and communicate with your PIC microcontroller, and the other will be used for your portable oscilloscope.
* Be prepared to buy your class kit, consisting of the portable NUscope oscilloscope, the NU32 PIC32 development board, and lots of other goodies. Price $125 if you are starting from scratch; $75 if you already have the NUscope.
* Buy your class kit [http://it.mccormick.northwestern.edu/matlab/student_license/login.php '''here''']. If you already have the oscilloscope and multimeter from this year's ME 233 offering, you should choose "ME 333 (w/o ME 233 equipment)" for the price of $75. If you do not have the oscilloscope and multimeter, you should choose "ME 333 (w/ ME 233 equipment)" for the price of $135. You will not be able to start the course until you have completed the purchase of your kit. If you decide to drop the course, you will be refunded the purchase price upon return of all the equipment in working shape.
<!-- * Be able to solve circuit problems similar to those on the practice problem set and last year's quiz at the bottom of [[ME_333_Circuits_Review_Material|this page]]. Be prepared for a quiz on this material in the second week of class. We will only spend one class period reviewing this material.-->
* '''If you are not already comfortable with the C language, or if you do not already have a C compiler installed on your laptop, this step is recommended before the first day of class. This will give you a headstart on learning C. If you don't complete this before the first day of class, you will need to do it before the second class.''' Download and install the GCC GNU compiler collection and the Netbeans IDE (Integrated Development Environment) following the instructions [[Installing_a_C_Compiler_and_IDE|here]]. Verify that you can compile and run the sample programs at the end of that page. Read the comments in invest.c to find references to the [[Media:CrashCourseinC.pdf|Crash Course in C document]] and answer the questions to learn more about C. '''If you have problems installing a C compiler and running the programs, then you can still get a headstart before the first class by focusing on reading the C programs and the Crash Course in C manual to understand how they work.'''
<!-- * Buy your class kit [http://it.mccormick.northwestern.edu/matlab/student_license/login.php '''here''']. If you already have the oscilloscope and multimeter from this year's ME 233 offering, you should choose "ME 333 (w/o ME 233 equipment)" for the price of $75. If you do not have the oscilloscope and multimeter, you should choose "ME 333 (w/ ME 233 equipment)" for the price of $135. You will not be able to start the course until you have completed the purchase of your kit. If you decide to drop the course, you will be refunded the purchase price upon return of all the equipment in working shape. -->
<!-- * Download and install software described on [[NU32v2: Software to Install|this page]]. -->
<!--* '''If you are not already comfortable with the C language, or if you do not already have a C compiler installed on your laptop, this step is recommended before the first day of class. This will give you a headstart on learning C. If you don't complete this before the first day of class, you will need to do it before the second class.''' Download and install the GCC GNU compiler collection and the Netbeans IDE (Integrated Development Environment) following the instructions [[Installing_a_C_Compiler_and_IDE|here]]. Verify that you can compile and run the sample programs at the end of that page. Read the comments in invest.c to find references to the [[Media:CrashCourseinC.pdf|Crash Course in C document]] and answer the questions to learn more about C. '''If you have problems installing a C compiler and running the programs, then you can still get a headstart before the first class by focusing on reading the C programs and the Crash Course in C manual to understand how they work.'''--> <!-- * Download and install software described on [[NU32v2: Software to Install|this page]]. -->


== Student Contract ==
== Student Contract ==
Line 37: Line 63:
* Copying another student's code, in whole or in part.
* Copying another student's code, in whole or in part.
* Transforming copied sections of code to try to disguise their origin.
* Transforming copied sections of code to try to disguise their origin.
* Borrowing code from others not in the course, e.g., code found on the internet, without attribution. Borrowing code found on the internet is acceptable if the source is clearly indicated in your code comments.
* Borrowing code from others not in the course, e.g., code found on the internet, without attribution. Borrowing code found on the internet is acceptable if the source is clearly indicated in your code comments, and if you understand how the code works.


On our part (faculty and TAs), we commit to do our best to provide you a curriculum and set of experimental materials to get you up to speed on sophisticated mechatronics integration as quickly and efficiently as possible, while giving you a foundation in concepts needed to go further in future projects and courses.
On our part (faculty and TAs), we commit to do our best to provide you a curriculum and set of experimental materials to get you up to speed on sophisticated mechatronics integration as quickly and efficiently as possible, while giving you a foundation in concepts needed to go further in future projects and courses.
Line 43: Line 69:
== Prerequisite ==
== Prerequisite ==


ME 233 Electronics Design or similar (EECS 221, 225) is required. You will be expected to analyze circuits with resistors, capacitors, inductors, diodes, transistors, and op-amps on the first day of class. There will be a quiz on this material on the third day of class, but you are on your own to prepare for it, apart from one review class and some night review sessions. To see if you have the right background, or if you will need to freshen up before the quarter starts, do the practice problem set and the 2011 quiz on [[ME_333_Circuits_Review_Material|this page]].
ME 233 Electronics Design or similar (EECS 221, 225) is required. You will be expected to analyze circuits with resistors, capacitors, inductors, diodes, transistors, and op-amps. You can find refresher material and a sample quiz at [[ME_333_Circuits_Review_Material|this page]].


== Reading ==
== Reading ==
Line 49: Line 75:
Required:
Required:


* [[Media:CrashCourseinC.pdf|A Crash Course in C]]: A brief introduction to the C programming language
* [[Media:CrashCourseinC.pdf|A Crash Course in C]]: A brief introduction to the C programming language. Sample code from this appendix can be found [[ME333 Sample Code|here]].
([[Media:EssentialC.pdf|Essential C]] is also a very nice intro to C)
([[Media:EssentialC.pdf|Essential C]] is also a very nice intro to C)
* handouts associated with individual classes
* handouts associated with individual classes
* wiki info on [[Microchip PICs]]
* wiki info on [[Microchip PICs]]
* [[Media:PIC32MX5XX6XX7XX_Family_Data_Sheet.pdf|PIC32 Data Sheet]] (256 pages, 5 MB pdf)
* [[Media:PIC32MX5XX6XX7XX_Family_Data_Sheet.pdf|PIC32 Data Sheet]] (256 pages, 5 MB pdf)
* [http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2612 PIC32 Family Reference Manual, by chapter.] Lots of useful and detailed information on the PIC32 architecture and how the peripherals work, including detailed description of their SFRs. Only certain parts of certain chapters will be assigned.
* [http://www.microchip.com/TechDoc.aspx?type=ReferenceManuals PIC32 Family Reference Manual, by chapter], and an [[Media:61132B_PIC32ReferenceManual.pdf‎|earlier version]] that conveniently has all chapters in one document. Lots of useful and detailed information on the PIC32 architecture and how the peripherals work, including detailed description of their SFRs. Only certain parts of certain chapters will be assigned. These chapters include quite a lot of example code. '''Be warned though, Microchip was not very careful when writing the sample code; some of it contains syntax errors, or values in registers that are incorrect.''' Even with this being the case, this is still a very useful document.
* The old version of the [[Media:61132B_PIC32ReferenceManual.pdf|PIC32 Family Reference Manual]] has many more pages than the chapter-by-chapter version linked above. It includes quite a lot of example code. '''Be warned though, Microchip was not very careful when writing the sample code; some of it contains syntax errors, or values in registers that are incorrect.''' Even with this being the case, this is still a very useful document.
* PIC32MX Peripheral Library (included as a .chm file under "Program Files\Microchip\MPLAB C32\doc" with your C32 compiler installation)
* PIC32MX Peripheral Library (included as a .chm file under "Program Files\Microchip\MPLAB C32\doc" with your C32 compiler installation)


Line 68: Line 93:
Grades will be approximately 40% quizzes and 60% assignments (including the final project). We will have short quizzes once a week at the beginning of class covering material on the previous assignment. Bring a sheet of paper you can turn in with your quiz answers. (Your lowest quiz score and homework score will be dropped.) We will have a final project and demo in lieu of a final exam.
Grades will be approximately 40% quizzes and 60% assignments (including the final project). We will have short quizzes once a week at the beginning of class covering material on the previous assignment. Bring a sheet of paper you can turn in with your quiz answers. (Your lowest quiz score and homework score will be dropped.) We will have a final project and demo in lieu of a final exam.


All quizzes and assignments have equal weight, regardless of how many points they are graded out of. If one homework is graded out of 20 points, and the next out of 40, the formula for calculating your grade for these two assignments would be 0.5*(score1/20) + 0.5*(score2/40).
All quizzes and assignments have equal weight, regardless of how many points they are graded out of. If one homework is graded out of 20 points, and the next out of 40, the formula for calculating your total grade for these two assignments would be 0.5*(score1/20) + 0.5*(score2/40).


== Homework Submission ==
== Homework Submission ==

All homework will be submitted on Blackboard. Here are a few guidelines/ tips associated with homework submissions:
All homework will be submitted on Blackboard. All homeworks should be submitted by 11 AM on the day it is due (i.e., before the first section of the day). Late homeworks will not be accepted.
* We expect the required files for each assignment to be compressed together in a zip file (no rar files).

* When asked to submit C code for a given programming assignment, we are only concerned with receiving the relevant source files i.e. all *.c and *.h files. We do not want entire NetBeans/MPLAB X projects or executables/object files.
Here are a few guidelines/tips associated with homework submissions:
* We expect the required files for each assignment to be compressed together in a zip file (no rar files).
* When asked to submit C code for a given programming assignment, we are only concerned with receiving the relevant source files, i.e., all *.c and *.h files. We do not want entire IDE/MPLAB X projects or executables/object files. And put all your source files and your documents including your answers to all the questions IN ONE FOLDER with the name "Lastname_Firstname_a#"(# is the assignment index number).
* When writing your responses, please follow any instructions on how to write your response. For example, if we ask for a snippet of code, please do not submit your entire C program with header files and a main routine. We typically are only expecting a few lines of code that solves the problem.
* When writing your responses, please follow any instructions on how to write your response. For example, if we ask for a snippet of code, please do not submit your entire C program with header files and a main routine. We typically are only expecting a few lines of code that solves the problem.
* When submitting written responses, we prefer PDF files, but will accept word documents (.doc, .docx), .txt, and .rtf files.
* When submitting written responses, we prefer PDF files, but will accept word documents (.doc, .docx), .txt, and .rtf files.
* It helps both us and you if you format your code nicely. Clean looking code is easier for us to grade and easier for you to debug. Both NetBeans and MPLAB X (as well as other good editors) have tools for auto-formatting code. For example, highlighting a region and hitting Alt+Shift+f (Linux and Windows) will format that region according to your local formatting preferences.
* It helps both us and you if you format your code nicely. Clean looking code is easier for us to grade and easier for you to debug. Text editors with IDEs such as Netbeans and MPLAB X have tools for auto-formatting code. For example, highlighting a region and hitting Alt+Shift+f (Linux and Windows) will format that region according to your local formatting preferences.
* When you compile your code (by clicking the hammer in NetBeans/MPLAB X), the output window in the IDE shows any compiler warnings. Pay attention to these! They are there for a reason. You should be able to eventually get your code to produce no warnings. Often if a piece of code is not working, the warnings will give a clue as to why. Note that in "project properties" in both IDEs, it is possible to generate "Additional warnings." This tells your compiler to be more strict about the rules of C. The better you adhere to these rules, the more likely it is that your code will compile.
* When you compile your code, pay attention to any compiler warnings. They are there for a reason! You should be able to eventually get your code to produce no warnings. Often if a piece of code is not working, the warnings will give a clue as to why.
<!--Note that in "project properties" in both IDEs, it is possible to generate "Additional warnings." This tells your compiler to be more strict about the rules of C. The better you adhere to these rules, the more likely it is that your code will compile.-->


== Approximate Syllabus ==
== Schedule ==


All tutorial C code from "A Crash Course in C," as well as sample PIC32 code, can be found at this page: [[ME333 Sample Code|'''Sample Code for ME 333''']]. The draft notes from Winter Quarter 2013 are compiled into a single file here: [[Media:ME333DraftWinter2013.pdf|ME 333 Winter 2013 Draft Notes]].
ME 333 focuses on three topics: (1) general C programming; (2) Microchip PIC microcontroller architecture and C programming specific to the PIC (e.g., using the PIC's peripherals, such as analog inputs, digital I/O, counters/timers, comm ports, etc.); and (3) interfacing the PIC to sensors and actuators, some theory of sensor and actuator operation, and interface circuitry and signal processing.


'''Winter Break'''
You will bring your laptop to each class. As the quarter progresses, we will be handing out other equipment that you will need to bring to class, such as the [[NU32: Introduction to the PIC32|NU32 development board]] that breaks out the [http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en545660 PIC32MX795F512L] microcontroller.
: '''Reading due for first class''': pages 1-10 of [[Media:CrashCourseinC.pdf|A Crash Course in C]]
: '''Assignment 1 due''': problems 1-4, 6-8, 10-11, 14-15 of A Crash Course in C. Bring your laptop to class and demonstrate your HelloWorld.c program.


'''Class 1''' (T 1/8)
Topics we will cover include:
: '''Assignment 1 due''': Hand in paper versions of your solutions at the beginning of class. No blackboard today. Also, bring your laptop to class to demonstrate HelloWorld.c.
: '''Class Topic''': Course overview and C programming
: '''Reading for next class''': pages 10-15 of A Crash Course in C
: '''Assignment 2 out''': problems 16-20, 23


'''Class 2''' (Th 1/10)
* introduction to C programming (here's a [[Media:invest.c|simple tutorial C program]])
: '''Assignment 2 due'''
* quiz on circuits
* introduction to the PIC32 hardware, and programming the PIC32 in C
: '''Class Topic''': C programming continued
: '''Reading for next class''': pages 19-34 of A Crash Course in C (most of this is reference; the real goal is to fully understand the program invest.c)
* digital I/O
: '''Assignment 3 out''': problems 24-26, 28-30, 32
* counters/timers and interrupts
* analog input
* sensor smorgasbord
* digital signal processing: filters and FFTs
* analog output and pulse-width modulation
* brushed permanent magnet DC motors: theory and control
* stepper motors and RC servo motors
* communication by SPI, I2C, and RS-232


'''Class 3''' (T 1/15)
[[ME333 Sample Code|'''Sample Code for ME 333''']]
: '''Assignment 3 due'''
: '''Class Topic''': C programming continued
: '''Reading for next class''': make sure you fully understand invest.c
: '''Assignment 4 out''': problem 33


'''Class 4''' (Th 1/17)
By class (note: DS = Data Sheet, RM = Reference Manual):
: '''Assignment 4 due'''
: '''Class Topic''': C programming conclusion. Thanks to Elliot Hevel, C newbie, for this [[Media:GradeSorter.c|C code]] he wrote in class today to solve problem 34 of a Crash Course in C. (The code seems to work fine, but we haven't tested exhaustively! No claims that it is the best or most efficient way to solve the problem, but definitely a nice job in the short time period. We removed an extraneous & seen in class today.)
: '''Reading for next class''': make sure you fully understand invest.c and are ready for a quiz on related C topics
: '''Assignment 5 out''': Purchase your ME 333 equipment [https://it.mccormick.northwestern.edu/matlab/student_license/login.php here]. If you have problems contact your instructor. Also, download the following (we will use them in Class 5):
Download and install:
* the free [http://www.microchip.com/pagehandler/en-us/family/mplabx/#downloads Microchip XC32 compiler] and [http://www.microchip.com/pagehandler/en-us/family/mplabx/ Microchip MPLAB X IDE] for your operating system
* the [http://www.ftdichip.com/Drivers/VCP.htm FTDI virtual COM port (VCP) driver] for your operating system
* the [http://processing.org/download/ Processing language] for your operating system
* a terminal emulator program like [http://freeware.the-meiers.org/ CoolTerm]
<!-- if you are using Windows, the [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] terminal emulator program -->
Also, download the [[Media:PIC32MX5XX6XX7XX_Family_Data_Sheet.pdf|PIC32 Data Sheet]] and the [[Media:61132B_PIC32ReferenceManual.pdf‎|PIC32 Reference Manual]].


'''Class 1''' (Th 1/5)
'''Class 5''' (T 1/22)
: '''Quiz''': None.
: '''Assignment 5 due'''
: '''Quiz 1''': [[Media:ME333-2013-q1.pdf|Solutions]] (average score: 16.2/20) On C programming (data types, pointers) and syntax similar to invest.c. '''As with all quizzes, no notes, computers, calculators, etc. are allowed.'''
: '''Topic''': Course overview. Circuits review.
: '''Class Topic''': our first programs for the PIC32, following chapter 1 and the [[NU32:_Quickstart|quickstart]]
: '''Reading''': Practice problem set and quiz on [[ME_333_Circuits_Review_Material|this page]], as well as background reading as needed.
: '''Reading for next class''': [[Media:ME333-Ch1-Ch2.pdf|Chapters 1 and 2]] of the class notes
: '''Assignment out''': If you do not already have a C compiler, install a C compiler following the instructions [[Installing_a_C_Compiler_and_IDE|here]]. For all students: compile and run the tutorial code [[Installing_a_C_Compiler_and_IDE#Tutorial_Sample_Code|here]] and begin to understand it.
: '''Assignment 6 out''': problems 1-7 of Chapter 2


'''Class 2''' (T 1/10)
'''Class 6''' (Th 1/24)
: '''Quiz''': None.
: '''Assignment 6 due'''
: '''Class Topic''': PIC32 and NU32 hardware
: '''Topic''': Introduction to C (bits, bytes, binary, hex, data types, memory, pointers, compiling and linking).
: '''Reading for next class''': finish Chapter 2 of the notes
: '''Reading''': [[Media:invest.c|Sample program]], [[Media:CrashCourseinC.pdf|A Crash Course in C]] (section numbers referenced in program comments).
: '''Assignment 7 out''': problems 8-16 of Chapter 2


'''Class 3''' (Th 1/12)
'''Class 7''' (T 1/29)
: '''Assignment 7 due'''
: '''Quiz''': Circuits. ([[Media:ME333_Quiz1_2012_Solutions.pdf|Solutions]]; high score 45/46, average 33.4, stdev 7.8)
: '''Class Topic''': PIC32 software
: '''Topic''': Introduction to C (syntax). We will compile and run programs together in this class, so bring your laptop with your installed C compiler and IDE.
: '''Reading''': Continue with [[Media:invest.c|sample program]], [[Media:CrashCourseinC.pdf|A Crash Course in C]] (section numbers referenced in program comments).
: '''Reading for next class''': [[Media:ME333-Ch3.pdf|Chapter 3]] of the notes through Chapter 3.6
: '''Software update''': Change your NU32.h file to include "#include <plib.h>" (without the quotes) as the first line
: '''Assignment 1 out''': '''Problems 1-6 and 9''' of [[Media:CrashCourseinC.pdf|A Crash Course in C]] (v0.2 of Thurs, Jan 12). Due by electronic submission by 11 AM Thurs 1/19. Solutions to problems 1-6 must be typed. Place these solutions, plus your .c file from the programming assignment (problem 9), in a .zip file and submit the zip file through [https://courses.northwestern.edu/webapps/login/ Blackboard]. The name of your zip file should be Lastname_Firstname_a1.zip. You will also demonstrate your program in class on Thurs 1/19. For full credit, you must follow these instructions exactly.
: '''Assignment 8 out''': problems 1-6 of Chapter 3. Problem 6: [[Media:Ch3_makefile.txt|makefile]] (save as "makefile") '''Demo next class''': If you succeeded in using the makefile in problem 6, demo the makefile. If not, demo the compiling from problem 5 (no need to load the code).


'''Class 4''' (T 1/17)
'''Class 8''' (Th 1/31)
: '''Assignment 8 due'''
: '''Topic''': Introduction to C (syntax).
: '''Quiz 2''': [[Media:ME333-2013-q2.txt|Solutions]] PIC32 and NU32 hardware (know things like the clock speed of the PIC32, amount of RAM and flash, what the physical memory map is [no need to memorize address numbers], what the modules/peripherals in Sec 2.1.2 do)
: '''Reading''':
: '''Assignment out''':
: '''Class Topic''': PIC32 software
: '''Reading for next class''': finish Chapter 3 of the notes
: '''Assignment 9 out''': problems 7-12 of Chapter 3. '''Demo next class''': Problem 8


'''Class 5''' (Th 1/19)
'''Class 9''' (T 2/5)
: '''Assignment 9 due'''
: '''Assignment 1 due''': Handed out on Thurs 1/12. [[Media:Assignment1Solutions.pdf|Solutions]] ([[Media:lightbulbs.c|lightbulbs.c]]) (ave score: 16.4/20, stdev 4.2)
: '''Topic''': The PIC32 microcontroller hardware.
: '''Class Topic''': using libraries and header files
: '''Reading''': [[Media:PIC32Chapters.pdf|PIC 32 hardware handout]], Data Sheet, Reference Manual
: '''Reading for next class''': [[Media:ME333-Ch4-Ch5.pdf|Chapters 4 and 5]] of the class notes; only Chapter 4 for next class
: '''Assignment 10 out''': problems 2, 3(a), and 5 of Chapter 4. '''Demo next class''': Problem 3(a).
: '''Assignment 2 out''': Complete the questions at the end of the reading. Solutions must be submitted by blackboard at [https://courses.northwestern.edu/webapps/login/ Blackboard] by 11 AM Thurs 1/26. The name of your zip file should be Lastname_Firstname_a2.zip. You will also demo your NUscope and PIC32 in class on 1/26.


'''Class 6''' (T 1/24)
'''Class 10''' (Th 2/7)
: '''Assignment 10 due'''
: '''Quiz''': On the topic of Assignment 1, particularly Section 1.1 and Sections 1.2.5-1.2.8 of the CCC document [[Media:Quiz_2_soln.pdf|(Solutions)]]. (ave score: 5.6/7, stdev 1.8)
: '''Quiz 3''': [[Media:ME333-2013-q3.txt|Solutions]] On Chapter 3
: '''Topic''': virtual and physical memory, NU32 board, beginning PIC32 programming, digital I/O SFRs
: '''Class Topic''': disassembly and map files
: '''Reading''': [[Media:PIC32_Ref_Man_Sec_12_IO_Ports.pdf|PIC32 Family Reference Manual Section 12, I/O Ports]]. This version is clearer than the current version on Microchip's website. We will discuss [[Media:Simple_pic2.c|this simple PIC program]]. Also, [[NU32: A Detailed Look at Programming the PIC32 on the NU32]].
: '''Reading for next class''': Chapter 5 of the class notes
: '''Assignment 11 out''': Problem 3(b) of Chapter 4, Problem 4 of Chapter 5. '''Demo next class''': Problem 3(b) of Chapter 4.


'''Class 7''' (Th 1/26)
'''Class 11''' (T 2/12)
: '''Assignment 11 due'''
: '''Assignment 2 due''': Handed out on Thurs 1/19. [[Media:Assignment2Solutions.pdf|Solutions]] (ave score: 21.8/25; stdev 4.8)
: '''Topic''': Continue analyzing the Simple_pic.c program.
: '''Class Topic''': interrupts
: '''Reading''': Continued from previous class.
: '''Reading for next class''': [[Media:ME333-Ch6.pdf|Chapter 6]] of the class notes
: '''Assignment 3 out''': [[Media:Assignment3v2.pdf|Investigating the PIC C32 Tool Suite (v2)]]
: '''Assignment 12 out''': Problems 8, 9, 10 of Chapter 5. '''No demo next class'''


'''Class 8''' (T 1/31)
'''Class 12''' (Th 2/14)
: '''Assignment 12 due'''
: '''Quiz''': On the topic of Assignment 2. [[Media:ME333_2012_quiz3_solns.c|Solutions; average 6.93/8, stdev 1.63]]
: '''Quiz 4''': [[Media:ME333-2013-q4.txt|Solutions]] On Chapter 4
: '''Topic''': CPU: core timer and and interrupts.
: '''Class Topic''': programming assignment, problems 16 and 17 of Chapter 6
: '''Reading''': A reading on [[Media:PIC32Chapters.pdf|PIC32 software and interrupts]] and some [[Media:core_timer_tester.c|code for working with the core timer and interrupts]].
: '''Assignment 13 out''': Problems 1, 2, 4, 5, 6, 12, 15, 16, 17 of Chapter 6. Turn in your code for Problem 17. '''Demo next class''': Problem 17.


'''Class 9''' (Th 2/2)
'''Class 13''' (T 2/19)
: '''Assignment 13 due'''
: '''Assignment 3 due''': Handed out on Thurs 1/26. [[Media:Assignment3Solutions.pdf|Solutions]], ave: 27.7/33, stdev 7.8
: '''Reference reading''': [[Media:ME333-Ch7-Ch10v2.pdf|Chapter 7 to Chapter 10 (v2)]] of the class notes
: '''Topic''': Interrupts, cont.
: '''Class Topic''': timers, PWM, analog output by RC filtering
: '''Reading''': Updated version of [[Media:PIC32Chapters.pdf|PIC32 software and interrupts]] (the section on interrupts has been completed), [[Media:SampleCode6-1.c|sample code 6.1]], [[Media:SampleCode6-2.c|sample code 6.2]]
: '''Assignment 14 out''': Problem 2 of Chapter 9. '''Due Tues 2/26. Demo with your NUscope on 2/26.'''
: '''Assignment 4 out''': [[Media:HW4_Interrupts_and_Programming.zip|Assignment 4 on Interrupts]] The assignment is described in the pdf included with the zip file. Solutions must be uploaded to [https://courses.northwestern.edu/webapps/login/ Blackboard] by Thursday, February 9 at 11:00AM.


'''Class 10''' (T 2/7)
'''Class 14''' (Th 2/21)
: No assignment due
: '''Quiz''': On the topic of Assignment 3. [[Media:ME333_2012_quiz4_solns2.c|Solutions; average 4.67/6, stdev 1.37]]
: '''Quiz 5''': [[Media:ME333-2013-q5.txt|Solutions]] On Chapters 5 and 6
: '''Topic''': Digital I/O, counter/timers, and output compare (PWM).
: '''Class Topic''': analog input, sensors, interfacing, control loops
: '''Reading''': [[Media:PIC32Chapters.pdf|Chapters on digital input and output, timers, and output compare]].
: No assignment out


'''Class 11''' (Th 2/9)
'''Class 15''' (T 2/26)
: '''Assignment 4 due''': Handed out on Thurs 2/2. [[Media:Assignment4Solutionsv2.zip|Solutions]]
: '''Assignment 14 due'''
: '''Class Topic''': DC motor theory
: '''Topic''': RC LPF (and its Bode plot) of PWM for analog output; analog input; LED and phototransistor pairs; PID control and integer math; analog input example.
: '''Reading''': [[Media:PIC32Chapters.pdf|Chapter on analog input]].
: '''Reading for next class''': Chapter 11 on Brushed Permanent Magnet DC Motors from [[Media:ME333-mech.pdf|Chapters 11-14 of the class notes]]
: '''No assignment out'''


'''Class 12''' (T 2/14)
'''Class 16''' (Th 2/28)
: '''Quiz 6''': PWM and RC filtering for analog output
: '''Quiz''': On the topic of Assignment 4. [[Media:ME333_2012_quiz5_solns.txt|Solutions]] (average 5.57/7, stdev 2.0)
: '''Topic''': Sensors, op amp circuits for signal conditioning.
: '''Class Topic''': experiments with a DC motor
: '''Assignment 15 out''': Problems 1, 2, 3(a), and 3(b) of Chapter 11, due by 11 AM Tues 3/5 ('''No demo next class''')
: '''Reading''': [[Sensor Overview]], [[Rotary Encoder]], [[Operational Amplifiers (Op-Amps)|wiki page on op amps]], [http://en.wikipedia.org/wiki/Operational_amplifier_applications wikipedia page on op amps]
: '''Assignment 5 out''': [[Media:ME333_winter2012_Assignment5.pdf|Simple real-time control with the PIC32]] Note that if you do not get the entire assignment done, you can turn in screenshots from your NUScope demonstrating the tasks that you did accomplish. If you do this, in the filenames, clearly indicate which section the image corresponds to.


'''Class 13''' (Th 2/16)
'''Class 17''' (T 3/5)
: '''Assignment 15 due'''
: '''Topic''': DSP: digital filtering, FIR, IIR, FFT, iFFT.
: '''Class Topic''': H-bridge, current control, and motion control for a DC motor; final project overview
: '''Reading''': [http://www.falstad.com/dfilter/directions.html A cool digital filter applet]. Background material (not required): [http://www.dspguide.com/pdfbook.htm Chapters 14-17, on FIR filters, of this pdf book], and these wikipedia pages on [http://en.wikipedia.org/wiki/Low-pass_filter low-pass filters], [http://en.wikipedia.org/wiki/Fir_filter FIR filters], [http://en.wikipedia.org/wiki/Iir_filter IIR filters], and [http://en.wikipedia.org/wiki/Fast_fourier_transform FFT].
: '''Reading for next class''': Chapter 13 on DC motor control
: '''Final project out''': [[Media:ME333_2013_FinalProject1.pdf|ME333 2013 Final Project]]


'''Class 14''' (T 2/21)
'''Class 18''' (Th 3/7)
: '''Quiz 7''': DC motor basics from Chapter 11
: '''Assignment 5 due''': Handed out on Tues 2/14. [[Media:Assignment5Solutions.pdf|Solutions]] ([[Media:MyProjectCode.zip|MyProject Code]])
: '''Topic''': DSP (continued).
: '''Class Topic''': H-bridge, current control, and motion control for a DC motor; final project overview (continued)
: '''Reading''': [[Media:PIC32Chapters.pdf|Chapter 11 on DSP]].
: '''Reference reading for next class''': Chapter 12 on motor gearing
: '''Assignment 6 out''': [[Media:Asst6.zip|Introduction to Digital Filtering with the PIC32]].


'''Class 15''' (Th 2/23)
'''Class 19''' (T 3/12)
: '''Class Topic''': motor sizing and gearing
: '''Quiz''': On the topic of Assignment 5. [[Media:ME333_2012_quiz6_solns.txt|Solutions]] (average 5.5/7, stdev 1.65)
: '''Reference reading for next class''': Chapter 14 on RC servos and steppers, [[Media:ME333-ch15.pdf|Chapter 15, for MAF extra credit]]
: '''Topic''': Brushed DC motor theory.
: '''Demo of Final Project Part 5 due next class'''
: '''Reading''': [[Media:PIC32Chapters.pdf|Chapter 12 on brushed DC motors]].


'''Class 16''' (T 2/28)
'''Programming Party''' (W 3/13 6-9pm)
: Come to L361 for pizza and extra help from 6-9pm
: '''Assignment 6 due''': Handed out on Tues 2/21.
: '''Topic''': In-class DC motor characterization.
: '''Reading''': [[Media:PIC32Chapters.pdf|Chapter 12 on brushed DC motors]].
: '''Assignment 7 out''': Motor characterization and the three problems at the end of Chapter 12.


'''Class 17''' (Th 3/1)
'''Class 20''' (Th 3/14)
: '''Final Project Part 5 demo'''
: '''Quiz''': On the topic of Assignment 6. You should be able to recognize the magnitude responses of the different kinds of filters, understand the impulse response of an FIR filter, understand the axes of a filter magnitude response, and understand the axes of the FFT magnitude plot (e.g., Nyquist frequency and the frequency spacing between components). [[Media:ME333_2012_quiz7_solns.txt|Solutions]] (average score 5.8/7, stdev 1.56)
: '''Topic''': DC motor control.
: '''No quiz'''
: '''Class Topic''': RC servo motors and stepper motors
: '''Reading''': [[Media:PIC32Chapters.pdf|Chapter 14 on DC motor control]] (updated 3/1/2012).


'''Class 18''' (T 3/6)
: '''Assignment 7 due''': Handed out on Tues 2/28. [[Media:MotorDataSheet.pdf|Solutions]]
: '''Quiz''': On the topic of Assignment 7. You should know Chapter 12.1-12.4. [[Media:ME333_2012_quiz8_solns.txt|Solutions]] (average 5.0/8, stdev 2.1)
: '''Topic''': Work on final demo. You should have built three circuits as indicated in email (H-bridge, current sensor, encoder reading) before class.
: '''Final demo assignment''': Demos on 3/12 and 3/14. [[Media:FinalProjectV2.zip|Final ProjectV2]] ('''Version 2.0 of the code should allow you to open port 0 from the TerminalV2 executable. Follow the steps in this pdf to test your setup: [[Media:TestingTerminalV2.pdf|TestingTerminalV2.pdf]]. If you are having problems with TerminalV2, please contact the TAs ASAP.''')


'''Final Demo''': Monday 3/18, 3-5 PM or Wednesday 3/20, 9-11 AM. Electronic submission by Wednesday 3/20, 11 AM.
'''Class 19''' (Th 3/8)
: '''Topic''': Time permitting: steppers and RC servos; gearing, inertia and torque, motor sizing and selection.
: '''Reading''': [[Media:PIC32Chapters.pdf|Chapter 15 on steppers and RC servos]], [[Media:PIC32Chapters.pdf|Chapter 13 on gearing and motor sizing]].


== NUScope ==
'''Final Demo''': Monday 3/12, 3-5 PM and Wednesday 3/14, 9-11 AM. See email to sign up for a time.
[[NUScope|NUScope instructions]]

[[Media:NuScope3-3.zip | (v3-3 for the board that says 'NUScope')]]

[[Media:NuScope1-3.zip | (v1-3 for the smaller board)]]


== FAQ ==
== FAQ ==
Line 217: Line 265:
Q: Is there an independent project?
Q: Is there an independent project?


A: There is no large independent project. There will be an individual two-week project at the end of the course, but there will be no machining. For a significant project, do a quarter-long project in ME 433 Advanced Mechatronics, offered in the spring quarter. ME 333 is good preparation for ME 433.
A: There is no large independent project. There will be a two-week project at the end of the course, but there will be no machining. For a significant project, do a quarter-long project in ME 433 Advanced Mechatronics, offered in the spring quarter. ME 333 is good preparation for ME 433.




Line 223: Line 271:


A: You need a laptop with at least 2 USB ports. Any operating system is fine.
A: You need a laptop with at least 2 USB ports. Any operating system is fine.

== ME 333 Winter 2010 (obsolete) ==

* [[ME 333 Circuits Review Material]]
* [http://www.youtube.com/NUmechatronics NUmechatronics youtube channel]
* [[ME 333 final projects]]
* [[PCB Artist]]
* [[ME 333 Suggested Final Projects]]
* [[ME 333 end of course schedule]]
* [[ME 333 Lab Kits]]
* [[Processing]] (software allowing you to create GUIs on your PC and interface through your USB port)
* Labs from Winter 2010
** [[Getting Started with PIC32|ME 333 Lab 1: Getting started with the PIC32]]
** [[ME 333 Lab 2]]
** [http://lims.mech.northwestern.edu/~lynch/courses/ME333/PIClabs/lab3/lab3.html ME 333 Lab 3]
** [[ME 333 Lab 4]]
** [[ME 333 Lab 5]]
* Ungraded study problems (be sure to attempt to solve the problems before looking at the solutions!)
** [[ME 333 Circuits Review Material]]
** [[Media:MotorProblems.pdf|Practice DC motor problems]] and their [[Media:MotorProblemSolutions.pdf|solutions]]
** [[Media:PIC32StudyGuide.pdf|PIC32 Study Guide]] and [[Media:PIC32StudyGuideSolutions.pdf|solutions]]



[[NU32v2: A Detailed Look at Programming the PIC32]]

Latest revision as of 15:21, 25 November 2013

Winter Quarter 2013

First day of class is Tuesday Jan 8

  • Section 20: Prof. Kevin Lynch, T Th, 11:00-12:20, Tech LR5
  • Section 21: Prof. Nick Marchuk, T Th, 12:30-1:50, Tech LR5
  • TAs: Alex Ansari, AlexanderAnsari2011 at u.northwestern.edu; Jian Shi, JianShi2011 at u.northwestern.edu
  • C Peer Instruction Sessions:
  • Final demo (in lieu of final exam): Monday March 18 3-5 PM (12:30-1:50 section) and Wed March 20 9-11 AM (11-12:20 section) in LR5
  • Office Hours:
    • Mon-Fri 3-5 PM: Prof. Marchuk, Mechatronics Lab, Ford B100
    • Mon 11:30-1:30 PM: Alex Ansari, Willens Wing Atrium
    • Tues 2-3 PM: Prof. Lynch, B290
    • Wed 12:00-2:00 PM: Jian Shi, NxR Lab, B230
    • Thurs 3-4 PM: Prof. Lynch, B290


Purpose of this Course

The purpose of this course is to provide tools that help you express your creativity. Maybe you want to build a robot, or a piece of kinetic art, or an automatic ball-throwing device to entertain your dog; maybe you've identified a market for a new smart product and you'd like to prototype the device. This course provides fundamentals of mechatronics to give you confidence to take on these projects. You are encouraged to take what you learn in this course and apply it in the project-based ME 433 Advanced Mechatronics course, Design Competition, or independent projects.

Approximate Syllabus

This course is for students that want to build microprocessor-controlled electromechanical devices.

To do this, ME 333 focuses on three topics: (1) general C programming; (2) Microchip PIC microcontroller architecture and C programming specific to the PIC (e.g., using the PIC's peripherals, such as analog inputs, digital I/O, counters/timers, comm ports, etc.); and (3) interfacing the PIC to sensors and actuators, some theory of sensor and actuator operation, and interface circuitry and signal processing.

You will do a lot of programming in this course! If you are certain you hate programming, then this is not the course for you. But knowing how to program is very useful for any modern engineer. The language we will use is C, a fairly low-level language that works well for microcontrollers, without being nearly as painful and low-level as assembly language. If you don't know C, that's not a problem, most students don't before taking ME 333; but you should plan to learn it, and rather quickly. You will have all the materials you need to start learning C before class starts, and the first assignment on C is due on the first day of class! The reason: even though we start out with C, that's not the main goal of this course. The main goal is to teach you about microcontrollers and mechatronics. Plus some students already have C background.

You will bring your laptop to each class. As the quarter progresses, we will be handing out other equipment that you will need to bring to class, such as the NU32 development board that breaks out the PIC32MX795F512L microcontroller.

It is essential you do the assigned reading in advance of class. Classes will begin with you turning in a short problem set related to the reading. (This includes the very first day of class!) Once a week we will have a short quiz. Most classes will be a combination of a brief review, Q&A, and working individually or in small groups on problems while the instructors help answer any questions.

Topics we will cover include:

  • introduction to C programming
  • introduction to the PIC32 hardware, and programming the PIC32 in C
  • digital I/O
  • counters/timers and interrupts
  • analog input
  • sensor smorgasbord
  • digital signal processing: filters and FFTs
  • analog output and pulse-width modulation
  • brushed permanent magnet DC motors: theory and control
  • stepper motors and RC servo motors
  • communication by SPI, I2C, and RS-232

Checklist to Complete Before the First Day of Class

Attendance at the first day of class (Tuesday Jan 8) is mandatory. By the first day of class, you should:

  • Complete the reading and assignment 1, which is due the first day of class! In fact, the first two weeks of assignments are already posted, so you are welcome to complete them all over the break and coast through the first two weeks of class. The first assignments are designed to get you up to speed on the C programming language, which we will use throughout the course.
  • Have a laptop with at least 2 USB ports. Any operating system is fine. One port will be used to program and communicate with your PIC microcontroller, and the other will be used for your portable oscilloscope.
  • Be prepared to buy your class kit, consisting of the portable NUscope oscilloscope, the NU32 PIC32 development board, and lots of other goodies. Price $125 if you are starting from scratch; $75 if you already have the NUscope.

Student Contract

By signing up for this course, you agree to complete the checklist above before the course starts. You understand that learning from classmates is encouraged, up to the stage of conceptualizing solutions. You understand that copying assignment solutions and program code plagiarism is not tolerated. You will report instances of code plagiarism you are aware of. Code plagiarism includes, but is not limited to:

  • Allowing another student to copy your code.
  • Copying another student's code, in whole or in part.
  • Transforming copied sections of code to try to disguise their origin.
  • Borrowing code from others not in the course, e.g., code found on the internet, without attribution. Borrowing code found on the internet is acceptable if the source is clearly indicated in your code comments, and if you understand how the code works.

On our part (faculty and TAs), we commit to do our best to provide you a curriculum and set of experimental materials to get you up to speed on sophisticated mechatronics integration as quickly and efficiently as possible, while giving you a foundation in concepts needed to go further in future projects and courses.

Prerequisite

ME 233 Electronics Design or similar (EECS 221, 225) is required. You will be expected to analyze circuits with resistors, capacitors, inductors, diodes, transistors, and op-amps. You can find refresher material and a sample quiz at this page.

Reading

Required:

  • A Crash Course in C: A brief introduction to the C programming language. Sample code from this appendix can be found here.

(Essential C is also a very nice intro to C)

  • handouts associated with individual classes
  • wiki info on Microchip PICs
  • PIC32 Data Sheet (256 pages, 5 MB pdf)
  • PIC32 Family Reference Manual, by chapter, and an earlier version that conveniently has all chapters in one document. Lots of useful and detailed information on the PIC32 architecture and how the peripherals work, including detailed description of their SFRs. Only certain parts of certain chapters will be assigned. These chapters include quite a lot of example code. Be warned though, Microchip was not very careful when writing the sample code; some of it contains syntax errors, or values in registers that are incorrect. Even with this being the case, this is still a very useful document.
  • PIC32MX Peripheral Library (included as a .chm file under "Program Files\Microchip\MPLAB C32\doc" with your C32 compiler installation)

Useful, but not required:

Grading

Grades will be approximately 40% quizzes and 60% assignments (including the final project). We will have short quizzes once a week at the beginning of class covering material on the previous assignment. Bring a sheet of paper you can turn in with your quiz answers. (Your lowest quiz score and homework score will be dropped.) We will have a final project and demo in lieu of a final exam.

All quizzes and assignments have equal weight, regardless of how many points they are graded out of. If one homework is graded out of 20 points, and the next out of 40, the formula for calculating your total grade for these two assignments would be 0.5*(score1/20) + 0.5*(score2/40).

Homework Submission

All homework will be submitted on Blackboard. All homeworks should be submitted by 11 AM on the day it is due (i.e., before the first section of the day). Late homeworks will not be accepted.

Here are a few guidelines/tips associated with homework submissions:

  • We expect the required files for each assignment to be compressed together in a zip file (no rar files).
  • When asked to submit C code for a given programming assignment, we are only concerned with receiving the relevant source files, i.e., all *.c and *.h files. We do not want entire IDE/MPLAB X projects or executables/object files. And put all your source files and your documents including your answers to all the questions IN ONE FOLDER with the name "Lastname_Firstname_a#"(# is the assignment index number).
  • When writing your responses, please follow any instructions on how to write your response. For example, if we ask for a snippet of code, please do not submit your entire C program with header files and a main routine. We typically are only expecting a few lines of code that solves the problem.
  • When submitting written responses, we prefer PDF files, but will accept word documents (.doc, .docx), .txt, and .rtf files.
  • It helps both us and you if you format your code nicely. Clean looking code is easier for us to grade and easier for you to debug. Text editors with IDEs such as Netbeans and MPLAB X have tools for auto-formatting code. For example, highlighting a region and hitting Alt+Shift+f (Linux and Windows) will format that region according to your local formatting preferences.
  • When you compile your code, pay attention to any compiler warnings. They are there for a reason! You should be able to eventually get your code to produce no warnings. Often if a piece of code is not working, the warnings will give a clue as to why.

Schedule

All tutorial C code from "A Crash Course in C," as well as sample PIC32 code, can be found at this page: Sample Code for ME 333. The draft notes from Winter Quarter 2013 are compiled into a single file here: ME 333 Winter 2013 Draft Notes.

Winter Break

Reading due for first class: pages 1-10 of A Crash Course in C
Assignment 1 due: problems 1-4, 6-8, 10-11, 14-15 of A Crash Course in C. Bring your laptop to class and demonstrate your HelloWorld.c program.

Class 1 (T 1/8)

Assignment 1 due: Hand in paper versions of your solutions at the beginning of class. No blackboard today. Also, bring your laptop to class to demonstrate HelloWorld.c.
Class Topic: Course overview and C programming
Reading for next class: pages 10-15 of A Crash Course in C
Assignment 2 out: problems 16-20, 23

Class 2 (Th 1/10)

Assignment 2 due
Class Topic: C programming continued
Reading for next class: pages 19-34 of A Crash Course in C (most of this is reference; the real goal is to fully understand the program invest.c)
Assignment 3 out: problems 24-26, 28-30, 32

Class 3 (T 1/15)

Assignment 3 due
Class Topic: C programming continued
Reading for next class: make sure you fully understand invest.c
Assignment 4 out: problem 33

Class 4 (Th 1/17)

Assignment 4 due
Class Topic: C programming conclusion. Thanks to Elliot Hevel, C newbie, for this C code he wrote in class today to solve problem 34 of a Crash Course in C. (The code seems to work fine, but we haven't tested exhaustively! No claims that it is the best or most efficient way to solve the problem, but definitely a nice job in the short time period. We removed an extraneous & seen in class today.)
Reading for next class: make sure you fully understand invest.c and are ready for a quiz on related C topics
Assignment 5 out: Purchase your ME 333 equipment here. If you have problems contact your instructor. Also, download the following (we will use them in Class 5):
Download and install:  
* the free Microchip XC32 compiler and Microchip MPLAB X IDE for your operating system
* the FTDI virtual COM port (VCP) driver for your operating system
* the Processing language for your operating system
* a terminal emulator program like CoolTerm
Also, download the PIC32 Data Sheet and the PIC32 Reference Manual.

Class 5 (T 1/22)

Assignment 5 due
Quiz 1: Solutions (average score: 16.2/20) On C programming (data types, pointers) and syntax similar to invest.c. As with all quizzes, no notes, computers, calculators, etc. are allowed.
Class Topic: our first programs for the PIC32, following chapter 1 and the quickstart
Reading for next class: Chapters 1 and 2 of the class notes
Assignment 6 out: problems 1-7 of Chapter 2

Class 6 (Th 1/24)

Assignment 6 due
Class Topic: PIC32 and NU32 hardware
Reading for next class: finish Chapter 2 of the notes
Assignment 7 out: problems 8-16 of Chapter 2

Class 7 (T 1/29)

Assignment 7 due
Class Topic: PIC32 software
Reading for next class: Chapter 3 of the notes through Chapter 3.6
Software update: Change your NU32.h file to include "#include <plib.h>" (without the quotes) as the first line
Assignment 8 out: problems 1-6 of Chapter 3. Problem 6: makefile (save as "makefile") Demo next class: If you succeeded in using the makefile in problem 6, demo the makefile. If not, demo the compiling from problem 5 (no need to load the code).

Class 8 (Th 1/31)

Assignment 8 due
Quiz 2: Solutions PIC32 and NU32 hardware (know things like the clock speed of the PIC32, amount of RAM and flash, what the physical memory map is [no need to memorize address numbers], what the modules/peripherals in Sec 2.1.2 do)
Class Topic: PIC32 software
Reading for next class: finish Chapter 3 of the notes
Assignment 9 out: problems 7-12 of Chapter 3. Demo next class: Problem 8

Class 9 (T 2/5)

Assignment 9 due
Class Topic: using libraries and header files
Reading for next class: Chapters 4 and 5 of the class notes; only Chapter 4 for next class
Assignment 10 out: problems 2, 3(a), and 5 of Chapter 4. Demo next class: Problem 3(a).

Class 10 (Th 2/7)

Assignment 10 due
Quiz 3: Solutions On Chapter 3
Class Topic: disassembly and map files
Reading for next class: Chapter 5 of the class notes
Assignment 11 out: Problem 3(b) of Chapter 4, Problem 4 of Chapter 5. Demo next class: Problem 3(b) of Chapter 4.

Class 11 (T 2/12)

Assignment 11 due
Class Topic: interrupts
Reading for next class: Chapter 6 of the class notes
Assignment 12 out: Problems 8, 9, 10 of Chapter 5. No demo next class

Class 12 (Th 2/14)

Assignment 12 due
Quiz 4: Solutions On Chapter 4
Class Topic: programming assignment, problems 16 and 17 of Chapter 6
Assignment 13 out: Problems 1, 2, 4, 5, 6, 12, 15, 16, 17 of Chapter 6. Turn in your code for Problem 17. Demo next class: Problem 17.

Class 13 (T 2/19)

Assignment 13 due
Reference reading: Chapter 7 to Chapter 10 (v2) of the class notes
Class Topic: timers, PWM, analog output by RC filtering
Assignment 14 out: Problem 2 of Chapter 9. Due Tues 2/26. Demo with your NUscope on 2/26.

Class 14 (Th 2/21)

No assignment due
Quiz 5: Solutions On Chapters 5 and 6
Class Topic: analog input, sensors, interfacing, control loops
No assignment out

Class 15 (T 2/26)

Assignment 14 due
Class Topic: DC motor theory
Reading for next class: Chapter 11 on Brushed Permanent Magnet DC Motors from Chapters 11-14 of the class notes
No assignment out

Class 16 (Th 2/28)

Quiz 6: PWM and RC filtering for analog output
Class Topic: experiments with a DC motor
Assignment 15 out: Problems 1, 2, 3(a), and 3(b) of Chapter 11, due by 11 AM Tues 3/5 (No demo next class)

Class 17 (T 3/5)

Assignment 15 due
Class Topic: H-bridge, current control, and motion control for a DC motor; final project overview
Reading for next class: Chapter 13 on DC motor control
Final project out: ME333 2013 Final Project

Class 18 (Th 3/7)

Quiz 7: DC motor basics from Chapter 11
Class Topic: H-bridge, current control, and motion control for a DC motor; final project overview (continued)
Reference reading for next class: Chapter 12 on motor gearing

Class 19 (T 3/12)

Class Topic: motor sizing and gearing
Reference reading for next class: Chapter 14 on RC servos and steppers, Chapter 15, for MAF extra credit
Demo of Final Project Part 5 due next class

Programming Party (W 3/13 6-9pm)

Come to L361 for pizza and extra help from 6-9pm

Class 20 (Th 3/14)

Final Project Part 5 demo
No quiz
Class Topic: RC servo motors and stepper motors


Final Demo: Monday 3/18, 3-5 PM or Wednesday 3/20, 9-11 AM. Electronic submission by Wednesday 3/20, 11 AM.

NUScope

NUScope instructions

(v3-3 for the board that says 'NUScope')

(v1-3 for the smaller board)

FAQ

Q: Do I need to know the C language to take this course?

A: No. But if you already know C, there is still plenty else in this course for you. If you already know C, know how to use microcontrollers for real-time control, and have a good understanding how common sensors and actuators work and how to interface to them, this course may not be for you. Consider taking ME 433 Advanced Mechatronics in the spring quarter.


Q: Is there an independent project?

A: There is no large independent project. There will be a two-week project at the end of the course, but there will be no machining. For a significant project, do a quarter-long project in ME 433 Advanced Mechatronics, offered in the spring quarter. ME 333 is good preparation for ME 433.


Q: What kind of laptop do I need?

A: You need a laptop with at least 2 USB ports. Any operating system is fine.