ME 333 Introduction to Mechatronics (Archive Winter 2011)

From Mech
Jump to navigationJump to search

Note: This page is an archive of a previous offering of the course.

Winter Quarter 2011

  • Instructor: Prof. Kevin Lynch, kmlynch at northwestern.edu
  • TA: Nelson Rosa, nelsonrosa2013 at u.northwestern.edu
  • Mechatronics Lab Coordinator: Nick Marchuk, nick.marchuk at gmail.com
  • Class Hours: T Th, 12:30-1:50 Tech LR5
  • Office Hours for Nick Marchuk: daily, 4-5 PM, Mechatronics Lab, Ford B100
  • Office Hours for Nelson Rosa: M 4-5, F 11-12, Mechatronics Lab, Ford B100
  • Office Hours for Kevin Lynch: TTh 4-5 PM, Tech B221
  • Circuits Q&A Session: Thurs Jan 6, 5 PM, Tech L150
  • Assignment 1 (and C programming) Q&A Session: Thurs Jan 20, 5 PM, Tech L150
  • Final demo (in lieu of final exam): Wed March 16, 7-9 PM


Reading

Required:

  • Essential C: A brief introduction to the C programming language
  • PIC32 Data Sheet (254 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. Most days we will have short quizzes at the beginning of class, and your lowest two scores will be dropped to accommodate days you have to run late or miss the class. No makeup tests will be given. There is no midterm or final exam, but a final demo will be held during the scheduled final exam period.

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 NU32v2 development board that breaks out the PIC32MX795F512L microcontroller.

Most days we will begin class with a short quiz. Bring a sheet of paper you can turn in with your answer.

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

Quiz: None.
Topic: Course overview. Introduction to C via sample program invest.c.
Reading: Sample program and Essential C (page numbers referenced in program comments).

Class 2

Quiz: None.
Topic: Continue with introduction to C via the sample program. MPLAB IDE.
Reading: Sample program, Essential C, and using the MPLAB IDE simulator. Circuit prep problems found here.

Class 3

Quiz: Circuits. Solutions (average: 18.3/29, median: 19.7, high: 29, stdev: 7.2)
Topic: Using the MPLAB IDE, simulating and debugging, and other programming topics.
Reading: Using the MPLAB IDE simulator.
Assignment out: Assignment 1 (Due January 18th, Class 5)

Class 4

Quiz: C syntax (from invest.c). Solutions (average: 9.7/12; median: 11, high: 12; stdev: 3.0)
Topic: PIC32 and NU32v2 hardware.
Reading: NU32v2: Introduction to the PIC32, DS p. 3 (summary), ch. 1 (first page only), ch. 3.2.2 Multiply/Divide Unit; RM ch. 1

Class 5

Assignment due: Assignment 1 Solutions (to run the code, don't forget to setup Uart1)
Quiz: PIC32 capabilities/hardware.
Topic: Getting started with the NU32v2.
Reading: starting a project and the reading associated with assignment 2
Assignment out: Assignment 2 (Due January 25th, Class 7)

Class 6

Quiz: Creating an MPLAB project and programming the NU32v2
Topic: Understanding programming of the PIC32.
Reading: NU32v2: A Detailed Look at Programming the PIC32, RM Ch.12 I/O Ports pg 2-7 & 25-28

Class 7 (1/25)

Assignment due: Assignment 2 Solutions (Whenever possible we will post your solutions. Thanks to Justin LeMaster for sharing his solutions.)
Quiz: Topics covered in Assignment 2 (convert to/from binary, reading a data sheet, setting bits in a register)
Topic: An in-depth look at digital I/O
Reading: NU32v2: Digital Input and Output, NU32v2: A Detailed Look at Programming the PIC32, RM Ch.12 I/O Ports pg 2-7 & 25-28
Assignment out: Assignment 3 (Due February 1st, Class 9)

Class 8 (1/27)

Quiz: Know the digital I/O SFRs described in NU32v2: Digital Input and Output, what they do, and how to write to them to get different pin behaviors
Topic: Counter/Timers
Reading: C32 Peripheral Lib Guide (under Help->Topics), RM Ch.14 Timers pg 2

Class 9 (2/1)

Assignment due: Assignment 3 Solutions (Thanks to Joe Mullenbach for Assignment 3 solutions.)
Topic: Output compare, PWM, analog output, and using the NUscope
Reading: NU32v2: Interrupts, NU32v2: Output Compare, PWM, and Analog Output, and NUScope
Assignment out: Assignment 4 (Due February 8th, Class 11)

Class 10 (2/3)

Quiz: Demo partial solution to Assignment 4: Generate 0.5V, 1V, and 3.3V analog signal using OC1 and the low-pass filter (LPF) described in class Tuesday (2/1). You should change to the next voltage in the list every time a button is pressed and display the output on your nuScope. You can use the 10 kohm resistor and 0.01 uF capacitor you have for the low-pass filter. (Are these good values to use for your RC filter?)
Topic: Analog input
Reading: NU32v2: Analog Input

Class 11 (2/8)

Assignment due: Assignment 4 Solutions (Thanks to Anonymous for Assignment 4 solutions.)
Topic: Sensors
Reading: Sensor Overview, NU32v2 Plotting Tool
Assignment out: Assignment 5v2 (Due February 15th, Class 13)

Class 12 (2/10)

Quiz: Low-pass filtering a PWM signal (duty cycle, RC filter cutoff frequency, etc.)
Topic: Encoders, PID control
Reading: Rotary Encoder, NU32v2: Using the LS7183 Quadrature Clock Converter

Class 13 (2/15)

Assignment due: Assignment 5 Solutions (Thanks to Andrew Kessler for Assignment 5 solutions.)
Topic: Digital FIR filtering of noisy sensor signals
Reading: This is background only, if you're interested in going further: Chapters 14-17, on FIR filters, of this pdf book; also see this nifty digital filter applet
Assignment out: Assignment 6, Assignment6.zip

Class 14 (2/17)

Quiz: LED and phototransistor pairs; encoders
Topic: DC motor theory
Reading: Brushed DC Motor Theory

Class 15 (2/22)

Assignment due: Assignment 6; here is a partial solution set and follow-up to assignment 6
Topic: DC motor theory (continued)
Reading: Brushed DC Motor Theory
Assignment out: Assignment 7

Class 16 (2/24)

Quiz: FIR low-pass filters
Topic: Driving DC motors using transistors, push-pull, H-bridge and PWM; opto-isolation; current sensing; reading an encoder with an LS7183
Reading: See the final project, assigned in the next class.

Class 17 (3/1)

Assignment due: Assignment 7 Solution1 and Solution2. Note that there are 6 independent parameters, 5W is not the maximum power rating of the motor (see Solution 1 for the correct calculation), and your motor values should be similar to those in these well-documented solutions. (Thanks to David Meyer and David Ma for this week's solutions.)
Topic: Motor control: voltage control vs. inner current/torque control loop; outer motion control loop, feedforward and PID feedback; example system: Copley amplifier
Reading: In the text of the final project description, below
Assignment out: Final project, due 3/16 at 7 PM (time of the final demo); milestone demo in class on 3/8

Class 18 (3/3)

Quiz: DC motor equations, data sheets, and speed-torque curves
Topic: Gearing, inertia and torque, motor sizing and selection
Reading: Choosing a Motor and Gearing Combination
Assignment out: Final project milestone pdf, Final project milestone zip file, due 3/8 in class

Class 19 (3/8)

Assignment due: Final project milestone (demo only): reading the current sensor; using an H-bridge with PWM; reading an encoder
Topic: Stepper motors and RC servos
Reading: PIC32MX: Driving a Stepper Motor, PIC32MX: Servo Control
Assignment out: Final Project Starter Code PDF, Final Project Starter Code, Final Project Processing App, due 7 PM, 3/16 in LR5

Class 20 (3/10)

Quiz: None
Topic: Types of communication (I2C, SPI, UART, XBee, USB, ethernet, CAN, etc.); wrap-up
Reading:

Final Demo (3/16), 7 PM, LR5

Important Information: Changes to ME 333 for Winter 2011

  • ME 333 will be taught differently in 2011 than it has been in recent years. In particular, there will be no lab groups and no large final projects. Each student will be issued a PIC microcontroller and electronics, sensors, and actuators needed to complete the programming and interface assignments on his/her own. Every student will do a significant amount of programming. An example of an assignment is to write PIC software to control a motor based on encoder feedback.
  • You need a laptop for this course. You will need to bring it to class. (There are some similarities to ME 233.)
  • ME 333 assumes some familiarity with circuits, e.g., transistors and op amps. ME 233 is good preparation. EECS 221 or 225 should suffice, too.

If you are signed up for ME 333 and this does not sound like a course you want to take (e.g., you don't want to do a lot of programming), please unregister. If you would like to be on the waiting list, send me an email, kmlynch at northwestern.edu. If you are already on the waiting list (you received a mail from me) but would like to be off the waiting list, or if you don't have experience with circuits, please let me know, and I will take you off the waiting list.

Checklist to Complete Before the First Day of Class

Attendance at the first day of class is mandatory. If you will be unable to make the first day of class, please give up your seat in ME 333 now (unregister or email Prof. Lynch to be taken off the waitlist) so that another student can have it. By the first day of class, you should:

  • Be able to solve circuit problems similar to those on the practice problem set at the bottom of this page. Be prepared for a short quiz on this material on the second day of class.
  • Have a laptop with at least 2 USB ports running a Windows operating system (see FAQ below on using running Windows on a Mac). One port will be used to program and communicate with your PIC microcontroller, and the other will be used for your portable oscilloscope.
  • Download and install software described on this page.
  • Make sure your laptop has Matlab installed.

On the first day of class, January 4, you should come to class with your laptop, ready to use all of the software mentioned above, since we will use it on the first day of class. If you are unable to meet the checklist (and downloading and installing the software may take you an hour, so plan ahead), you will be asked to drop the course to make space for someone else.

Student Contract

By signing up for this course, you agree to complete the checklist above before the course starts. You understand that ME 333 is being revised extensively, and there will be some uncertainties as the curriculum and equipment are ironed out. 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 TA), 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 Analog and Digital Electronics 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 second day of class, but you are on your own to prepare for it. 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 on this page.


FAQ

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

A: No. 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 any independent project at all?

A: There is no large independent project. There may be a small 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: Do I need a PC laptop, or is a Mac fine? Any other requirements?

A: You need a laptop with 2 USB ports, and you need to be able to run a Windows OS. The Microchip MPLAB Integrated Development Environment runs only on Windows operating systems:

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en019469

I use a Mac with VirtualBox (free) to run Windows (which you have to pay for). You can get a full version of Windows 7 Pro using the Microsoft Student Deal for $64.95; see

http://www.it.northwestern.edu/software/microsoft/

http://www.microsoft.com/student/en/us/software/windows/default.aspx

You can get a wide variety of Windows software by becoming a student member of the IEEE for $32; see

http://www.ieee.org/membership_services/membership/students/students_software.html



ME 333 Winter 2010 (obsolete)


NU32v2: A Detailed Look at Programming the PIC32