"Microcontroller Based Mechatronic Design"


Each group must design, build, test, and demonstrate a device controlled by a PIC microcontroller. (Alternative controllers like Arduinos, Raspberry Pis, Galileos, PLCs, FPGAs, and DSPs are allowed, but a PIC running PicBasic Pro must also be involved and integrated into the system.)  The device should have functioning elements in all six categories listed below. The device will be rated (graded) based on the level of functionality achieved in each category. There will also be grading adjustments for qualitative attributes and how well the project is documented.

You are allowed to use circuits and code you find on the Internet or in other books, but make sure you have a full understanding of what the code or circuit does. You should also "add value" to what you use by incorporating it into your system creatively and effectively. Also, make sure you cite in your report and during your presentation sources of any code or circuits you use.

NOTE - the choice of your project concept could have a large impact on the grade you receive; so please evaluate your alternative concepts carefully, based on the grading criteria below.

Project Deliverables

Each group must present the following over the course of the project:

Each of these is described in detail below. See the syllabus for due dates.

We expect each group to be creative in coming up with a unique "device" that performs some useful function. Past project and alternative ideas are displayed at Please choose an "appropriate" project concept, and avoid project ideas involving alcohol or drugs, weapons, anything illegal, explosives or fire, anything dangerous (e.g., electrocution or finger loss possible), etc.


The proposal must contain:

You should consider the proposal as a preliminary draft for portions of the final design report. If you do a good job with the proposal and create high quality illustrations and diagrams, you will be able to reuse the material in your final report.

Please do not bind or cover the pages of the report in any way. We want single-sided paper with a single staple or small binder clip in the top-left-hand corner only. Also, the proposal must be free from spelling and grammar mistakes.

Group Design Notebook

The design notebook is a loose leaf binder containing notes, sketches, schematics, documents and designs. It will be separated by tabs for each week of the design cycle. Pages must be dated and initialed. The notebook will be reviewed weekly by the TA in Lab (per the instructions on the syllabus). The TA will record a score each week.

Required Functional Element Categories

Your device should contain functioning elements in each of the six categories listed below. The examples under each element category are generally listed in order of increasing rating score (see below), depending on how you use and what you do with the element. Other components not listed as examples below are acceptable and encouraged. Note - you cannot receive credit for any category until you have a device that is mostly complete. You must have a functioning device, not just a collection of independently functioning elements. Also, all category components must be interfaced to a PIC or alternative controller (e.g., a power switch or a switch hard-wired to a motor does not count as manual data input). Having several different components in a single category can help your rating, but quality is more important than quantity.

  1. Output Display
  2. Audio Output Device
  3. Manual Data Input
  4. Automatic Sensor
  5. Actuators, Mechanisms, and Hardware
  6. Logic, Processing, and Control; AND Miscellaneous (functional elements not covered in the categories above)

Functional Element Category Ratings

The group's grade for the project will be based on the device's performance in each functional element category listed above (A, B, C, D, E, F) and on several grading adjustments described below. The rating for each category will be based on the following system:

Description of performance
nothing implemented (built, wired, interfaced, programmed).
something implemented, but non functional.
something implemented (i.e., has some level of functionality and is interfaced to the PIC or alternative controller), but not functioning as designed in a repeatable and reliable way.
something functioning as designed (i.e., performs some intended, useful function) and repeatable (i.e., it works every time), but did not require much research or effort on your part (e.g., you purchased something requiring very little interfacing and work, or you are using something presented in detail in class or Lab).
something functioning as designed and repeatable, and required significant research and effort on your part (e.g., you built something discussed in the text book, but not presented in detail in class or Lab, that required significant research and effort).
something functioning as designed (i.e., performs some intended, useful function) and repeatable, and required substantial independent research and effort on your part (e.g., you built something requiring knowledge and skills not presented in the textbook or used in Lab).

Each category will receive a rating, and the base project score will be the sum of the six ratings. For example, if the project is rated 10 for category A, 15 for B, 10 for C, and 10 for D, 20 for E, and 15 for F, the base project score would be 80.

NOTE: These ratings are somewhat qualitative, so official scores will not be released until the end of the semester, after the instructor and TAs meet to discuss all of the results. But if your device functions well in all of the categories listed above, and some or all of the functional elements required significant research and/or work on your part, you can expect a high rating score.

Final Design Report

The final report is due in class the last Friday of the semester. Please do not bind or cover the pages of the report in any way. We want single-sided paper with a single staple or small binder clip in the top-left-hand corner only.

The report must include the following sections, free from spelling and grammar mistakes:

If anything is not done as described above, there will be deductions.

After looking at the figures and illustrations, and after reading the BRIEF and CONCISE descriptions in "Design Summary" and "System Details," the reader should be able to quickly and fully understand what your device is, what it looks like, what it does, and how it functions (without seeing a demonstration of the actual device).

Please use software tools for all work. Here are some recommended programs:

Here are some examples of elements from previous student reports:

And some example full reports can be found on the video demonstrations page. However, you should create your report based on the detailed requirements listed above, and not based just on the examples provided (which are not necessarily perfect or complete).

Be sure to cite sources (URLs or book bibliographies) for any circuits or code created by others and used in your design (even if modified).

Grading Adjustments

The base project score (the sum of the category ratings) will be adjusted by the following grading adjustments. The "qualitative adjustments" are judged by Dr. Dave, the TAs, and your classmates during the final project demonstrations in your scheduled Lab section meeting in the last week of the semester.


qualitative adjustments:



Additional Information:

Also, the group will have to multitask, accomplishing various design and testing steps in parallel (e.g., do not wait for the microcontroller to get programmed before testing the motor, input circuits, sensors, etc.).

Lessons Learned From Past Students:


  1. Start everything earlier than you think you should, especially part and device fabrication. Everything will take much longer than you think.
  2. Schedule and manage all of the stuff that needs to get done, allocating lots of time for everything, especially testing and debugging. Use a Gantt chart and elect somebody to be the team leader to delegate tasks and keep things on schedule.
  3. Work on all mechanical stuff and build things early in the semester (before you learn the PIC stuff), so you can focus on the electronics and PIC stuff later in the semester.
  4. Complicated mechanical devices can be a big pain and don't give you much reward in project grading. Keep things as simple as possible.
  5. Research and order all of your parts and devices very early and very carefully. Shipping can be expensive when stuff is needed fast.
  6. Order parts very early, and buy two (or more) of everything, so you will always have backup copies (e.g., if something gets damaged ... which seems to happen often).
  7. Be sure to have fall-back plans to reduce complexity or scale back on ambitions if necessary (i.e., make sure your design in "flexible").
  8. There are lots of good resources online for helping with different project stuff. Keep searching.
  9. Check out Dr. Dave's websites periodically through the semester. They contain lots of good resources and advice to save you a lot of time.
  10. Research and buy stuff on Ebay as much as you can to save money.
  11. Work late at night (especially Friday) or early morning (especially Sunday), when the Lab is not busy.
  12. Get help from classmates and past students. They will often know the "details" better than Dr. Dave or the TAs.
  13. Try to get ahead in your other classes leading into the finial weeks of the semester to give you more time to work on last-minute project stuff ... and there will be lots of this.
  14. Realize that everything will take much more time than you think, especially the system integration stuff after everything has been tested separately.
  15. Testing individual components and subsystems is just half the project. Don't underestimate how long it takes to assemble and test the entire integrated system.
  16. Sometimes you can get help by posting questions on online product and support forums.
  17. Demonstrate to the TAs and video-record functionality often in case things don't work later.
  18. Don't get discouraged ... unforeseen and difficult problems will come it, but you will find a way to manage or get through them. Keep a positive attitude.
  19. Make sure you get one of the early bird awards ... this can help you project grade quite a bit.
  20. It is a group project ... don't assume individuals will get their parts done and be prepared and willing to help.
  21. Be friendly and helpful to all of your classmates and you will get lots of help and friendship in return.
  22. Read and heed all of the lessons learned from past students.

Components and Devices:

  1. If using an LCD, make sure you have a pause at the beginning of the program to let it warm up first. Also, backlit LCDs (e.g., white on blue) provide a much better display than the standard black on green LCDs. Also, electrically insulate the LCD from any metal plate or box it might be mounted to.
  2. Make sure you include a 10-20k pot with you LCD to be able to adjust contrast.
  3. If you plan to use Lcdout, make sure the LCD has a driver chip compatible with PicBasicPro (most have this).
  4. If you are using a serial LCD, make sure you use the proper Serout baud rate and use the formatting syntax for Serout, not Lcdout (e.g., # instead of DEC for number display).
  5. Passive Infrared (PIR) motion detectors are very sensitive and require absolute still during start-up calibration, and they can be unreliable.
  6. If using stepper motors, make sure you order drivers that work with your motors (e.g., based on current and unipolar vs. bipolar).
  7. MOSFETs can use different pinout than BJTs ... be sure to read the datasheet carefully before making any connections.
  8. MOSFETs do not switch off unless the gate pin is grounded ... it doesn't switch off by just removing voltage.
  9. Use relays instead of transistors whenever you can, and keep the high-current side isolated (no common ground) from the signal side. Some relays will need a transistor or smaller relay attached to the PIC to provide enough switching current.
  10. If you try to build your own H-bridge (which isn't wise), use MOSFETS and/or relays instead of BJTs.
  11. RC servos require a constant stream of pulses while reaching a position, and to hold torque in a position.
  12. If you need to modify an RC servo motor to turn continuously, you can find instructions online for how to do this.
  13. Make sure you have flyback protection, with diodes, on all inductive loads (motors, solenoids, heaters, etc.). If switching an AC load, a high-wattage resistor in parallel with the load can help provide flyback protection.
  14. Using a capacitor across the leads of a dc motor can help limit power supply voltage fluctuations that might cause PICs to reset.
  15. Make sure you order and test motors as early as possible so you will have enough time to get replacements if you find out you need more torque (or if you find out something else is wrong).
  16. Stepper motors can get very hot if you keep the coils energized ... turn the coils off after each motion if possible.
  17. A cheap or used cordless drill (with integral gear motor) offers good torque at very low cost.
  18. Mountain States Electronics is a good place to order components and get information and advice locally. They stock many components you will need in your projects. Ordering online can take much longer and is usually more expensive (especially with shipping charges).
  19. Sparkfun has a warehouse in Boulder; so if you need parts quickly, you can order them online for pickup the same day. This will also save on shipping costs.
  20. Sparkfun is a great resource because they offer free technical support for all of their parts, and they can offer advice when deciding what to purchase.
  21. Many local industrial supply companies (e.g., plastics and metals suppliers) have scrap bins from which you can get free supplies.
  22. If you can't figure out how to make a device work, call the company who manufactures it for help. Sometimes a phone call can save hours or days of work.
  23. Arduinos can be very useful to complement PICS in your design. There are lots of code and wiring diagrams examples available online.
  24. If your audio is not loud enough, a power transistor can be used to boost the sound to a speaker.
  25. Solenoid valves sometimes require pressure on the inlet for them to open easily; if not, they might require significant current to actuate.
  26. Make sure you mount motors with stiff, strong, and adjustable (if possible) brackets.

Circuit Construction and Debugging:

  1. If you have multiple voltages in your design, be very careful to not apply a large voltage (e.g., 12 V) to digital circuits (e.g., the PIC). This will definitely cause damage.
  2. Before wiring circuits, draw detailed wiring diagrams first (e.g., using the free ExpressSCH software tool). You need to do this anyway for the final report, and they will be very useful as you work and make changes.
  3. Keep printouts of detailed schematics, pin-out diagrams, and datasheets for all components and circuits in you project.
  4. Carefully check all component pin-out diagrams and other datasheet info before wiring or connecting anything.
  5. Make sure you have capacitors and flyback diodes everywhere you should (e.g., 0.1 μF across power and ground of every IC, especially the PICs).
  6. If you have trouble with some inputs triggering due to noise or interference, sometimes pull-down resistors to ground can help limit this.
  7. Follow all of the other troubleshooting advice in Section 15.5 of the Lab Book.
  8. Use large capacitors across power and ground of anything that draws large and/or spiking current, and across your main power supply (especially if using an AC/DC adapter, batteries, of a power supply with no output capacitors).
  9. Check all wiring carefully before connecting power to prevent damage to components.
  10. Always disconnect power when working on circuits (e.g., when moving wires or adding or removing components).
  11. Soldered printed circuit boards (PCBs) or protoboards are much more reliable than breadboards.
  12. If you decide to wire up a protoboard or printed circuit board (PCB), keep your breadboard intact (and buy extra components if necessary) if case things don't work out.
  13. Some breadboards are divided and require wire bridges to continue the power and ground buses down the length of the board.
  14. If you solder up a protoboard or PCB, purchase your own soldering iron. Also, check all of your connections carefully before applying power to your soldered circuits in case there are shorts. And be very careful to not damage components (see Lab 15 for advice on how to solder properly). Use IC sockets to prevent damage to ICs and to allow easy removal.
  15. Use more than one color wire to help keep things more organized and easier to debug.
  16. Physically label all key wires in your design so they don't get attached to the wrong things.
  17. Use ribbon cables and connectors to allow easy disconnects and to help organize wiring.
  18. Keep large magnetic field stuff (e.g., solenoids) away from your circuits to reduce electromagnetic interference.
  19. Always ground yourself to prevent electrostatic discharge when handling delicate components (e.g., MOSFET devices).
  20. When joining two wires (e.g., by twisting them together), it is a good idea to use heat shrink-wrap tube to secure and protect the connection.

PIC and Software:

  1. Start your code as simply as possible (e.g., blink program) and add only a small piece at a time. Take "baby steps!"
  2. Read and try to understand the intro sections of the PicBasic manual, Chapter 7 in the textbook, and the PIC exercises in the Lab book before you start programming. This will save you a lot of time in the long run.
  3. Allocate lots of time to debugging and testing of your code.
  4. Implement an LCD early in your work (even if your project does not require one). It will be very helpful during debugging and testing.
  5. Keep a printout handy for the pin-out of every PIC you are using.
  6. Use only the PIC16F88 when possible (since that is what is used in Lab). Other PICs can require more research and headaches. Take advantage of the free sample offer on the Microchip website and request lots of spares.
  7. Using multiple PICs, each doing something simple, is easier to program and manage than a single PIC trying to do everything; although, it can be difficult to coordinate everything if they all need to communicate back and forth. Be sure to clearly label the different PICs to make it easy to tell them apart as you make changes to code.
  8. Always be careful to plug in the PIC to your board in the right direction to prevent damage.
  9. Make backup copies of working versions of PIC code (and even a programmed PIC) before making any changes.
  10. Read in the PicBasicPro manual the details for all commands you plan to use. This will save you a lot of time in the long run.
  11. If a PIC's pin can't output enough current (e.g., to turn on a relay), use a transistor.
  12. If running into memory problems (exceeding capacity), consider an 18-series PIC instead of a 16-series PIC.
  13. If getting lots of page boundary warning messages, don't worry (see Section 2.5.3 in the PicBasic manual). You can disable these messages by adding the following command at the top of your program: @ ERRORLEVEL -306
  14. If using serial communication, make sure the Serin device is listening before the Serout device starts talking, and make sure both devices are set up with the same baud rate. Also, make sure all of your syntax is correct with both commands (e.g., don't forget the "#" prefix to send a variable's value).
  15. Use separate digital I/O handshaking lines to help synchronize timing of serial communication, and use the timeout feature (e.g., with the Serin2/Serout2 commands) if it is possible to miss or not have a signal.
  16. The Sound command parameter is not directly related to music note frequencies. Here is a table of some example note values:
    Do=94, Re=98, Mi=102, Fa=103, So=106, La=108, Ti=110, Do=111
    For more info, see: Where Math Meets Music.
  17. The Pot command can be difficult to calibrate. Consider using an A/D converter input instead.
  18. The PIC output pins and ports have current limitations. If things don't work properly as you add more components (e.g., additional LEDs), it might be because you are exceeding the total current capacity. Also, PICs can typically sink more current than they can source, so it is better to turn stuff (e.g., LEDs) on with negative logic.
  19. Use the Freqout command instead of the Sound command to easily generate music note frequencies.
  20. Use the multimeter and oscilloscope to probe all of your PIC pins to make sure they are going high and low as desired.
  21. Schmidt triggers are useful to clean up noisy digital signals.
  22. When attaching outputs from an Arduino to the input of a PIC, sometimes a pull-down resistor can help.

Power supply:

  1. When using voltages above 5V, be very careful to not apply them to ICs like PICs or other 5V digital devices ... they will be damaged.
  2. Avoid high-current situations as much as possible to reduce cost, increase safety, and prevent EMI problems.
  3. Try to use 5V power supplies for all components if possible to limit the chances of applying high voltage to sensitive components by mistake.
  4. Use a computer power supply to provided voltages to your project. You can find them cheaply, and they provide stable voltages with ample current. Make sure the PS_on wire is grounded for proper operation. Newer computer power supplies require a constant load (e.g., with an added load resistor) to keep them from powering down.
  5. Make sure your power supply can handle more current than what you think you need.
  6. Make sure you know the current requirements for all components in your project and make sure your power supplies can provide enough.
  7. If you use a voltage regulator, be aware that if the voltage is lowered a lot and the current is large, the regulator will generate a lot of heat and you will definitely need a heat sink. An alternative is to use a dc-dc converter that is more efficient. Another alternative is to use a different power supply that is better matched to the load.
  8. Use a small-amperage fuse on your power supply to limit possible damage caused by shorts.
  9. Keep low-current stuff (e.g., PIC circuits) separate and isolated (on separate boards) from high-current stuff (e.g., actuators), and use separate power supplies for each.
  10. Be sure to include capacitors across the outputs of batteries and any other sources that don't have capacitors built in.
  11. Turn current off to stepper motors and solenoids when not needed. They can get hot, and they can take current away from other stuff that might need it.
  12. A car battery is a good source for large current.