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

From Mech
Jump to navigationJump to search
Line 73: Line 73:
* We expect the required files for each assignment to be compressed together in a zip file (no rar files).
* 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.
* 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.
* 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 Ctrl+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. 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.
* 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 (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.



Revision as of 12:42, 24 January 2012

Winter Quarter 2012

(Here is an Archive of Winter 2011)

First day of class is Thursday Jan 5!

  • 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: Nelson Rosa, nelsonrosa2013 at u.northwestern.edu; Jarvis Schultz, JarvisSchultz2012 at u.northwestern.edu
  • Circuits Review Session: Mon Jan 9, 7 PM, Prof. Lynch, Tech L221; Wed Jan 11, 7 PM, Prof. Marchuk, Tech L221
  • 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): 11-12:20 section Wed March 14 9-11 AM; 12:30-1:50 section Monday March 12 3-5 PM
  • Office Hours:
    • Mon 4-6 PM: Jarvis Schultz, Mechatronics Lab, Ford B100
    • Tues 2-3 PM: Prof. Lynch, B221
    • Wed 3-5 PM: Nelson Rosa, Mechatronics Lab, Ford B100
    • Thurs 3-4 PM: Prof. Lynch, B221
    • Fri 3-4 PM: Prof. Marchuk, Mechatronics Lab, Ford B100
    • Mon-Fri 4-5 PM: Prof. Marchuk, Mechatronics Lab, Ford B100


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:

  • Be able to solve circuit problems similar to those on the practice problem set and last year's quiz at the bottom of 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.
  • Buy your class kit 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.
  • 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 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 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.

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.

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 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 this page.

Reading

Required:

(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. 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.
  • 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. 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 demo in lieu of a final exam.

Homework Submission

All homework will be submitted on Blackboard. 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 NetBeans/MPLAB X projects or executables/object 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.
  • 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.

Approximate Syllabus

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 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.

Topics we will cover include:

  • introduction to C programming (here's a simple tutorial C program)
  • quiz on circuits
  • 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

By class (note: DS = Data Sheet, RM = Reference Manual):

Class 1 (Th 1/5)

Quiz: None.
Topic: Course overview. Circuits review.
Reading: Practice problem set and quiz on this page, as well as background reading as needed.
Assignment out: If you do not already have a C compiler, install a C compiler following the instructions here. For all students: compile and run the tutorial code here and begin to understand it.

Class 2 (T 1/10)

Quiz: None.
Topic: Introduction to C (bits, bytes, binary, hex, data types, memory, pointers, compiling and linking).
Reading: Sample program, A Crash Course in C (section numbers referenced in program comments).

Class 3 (Th 1/12)

Quiz: Circuits. (Solutions; high score 45/46, average 33.4, stdev 7.8)
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 sample program, A Crash Course in C (section numbers referenced in program comments).
Assignment 1 out: Problems 1-6 and 9 of 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 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.

Class 4 (T 1/17)

Topic: Introduction to C (syntax).
Reading:
Assignment out:

Class 5 (Th 1/19)

Assignment 1 due: Handed out on Thurs 1/12. Solutions (lightbulbs.c)
Topic: The PIC32 microcontroller hardware.
Reading: PIC 32 hardware handout, Data Sheet, Reference Manual
Assignment 2 out: Complete the questions at the end of the reading. Solutions must be submitted by blackboard at 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)

Quiz: On the topic of Assignment 1, particularly Section 1.1 and Sections 1.2.5-1.2.8 of the CCC document.
Topic: virtual and physical memory, NU32 board, beginning PIC32 programming, digital I/O SFRs
Reading: PIC32 Family Reference Manual Section 12, I/O Ports. This version is clearer than the current version on Microchip's website. We will discuss this simple PIC program. Also, NU32: A Detailed Look at Programming the PIC32 on the NU32.

Class 7 (Th 1/26)

Assignment 2 due: Handed out on Thurs 1/19.
Topic:
Reading: Continued from previous class.
Assignment 3 out:

Class 8 (T 1/31)

Quiz: On the topic of Assignment 2.
Topic:
Reading:

Class 9 (Th 2/2)

Assignment 3 due: Handed out on Thurs 1/26.
Topic:
Reading:
Assignment 4 out:

Class 10 (T 2/7)

Quiz: On the topic of Assignment 3.
Topic:
Reading:

Class 11 (Th 2/9)

Assignment 4 due: Handed out on Thurs 2/2.
Topic:
Reading:
Assignment 5 out:

Class 12 (T 2/14)

Quiz: On the topic of Assignment 4.
Topic:
Reading:

Class 13 (Th 2/16)

Assignment 5 due: Handed out on Thurs 2/9.
Topic:
Reading:
Assignment 6 out:

Class 14 (T 2/21)

Quiz: On the topic of Assignment 5.
Topic:
Reading:

Class 15 (Th 2/23)

Assignment 6 due: Handed out on Thurs 2/16.
Topic:
Reading:
Assignment 7 out:

Class 16 (T 2/28)

Quiz: On the topic of Assignment 6
Topic:
Reading:

Class 17 (Th 3/1)

Topic:
Reading:

Class 18 (T 3/6)

Quiz: yes
Topic:
Reading:

Class 19 (Th 3/8)

Topic:


Final Demo: Monday 3/12, 3-5 PM, for 12:30-1:50 section; Wednesday 3/14, 9-11 AM, for 11:00-12:20 section

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 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.


Q: What kind of laptop do I need?

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

ME 333 Winter 2010 (obsolete)


NU32v2: A Detailed Look at Programming the PIC32