CTEC1630 Embedded Systems Design

Course Description

A design course concentrating primarily on building skills to exploit the technology of the microcontroller (MCU). Students will study the architecture of a typical microcontroller (the PIC 18F family from Microchip), basic programming, debugging, and testing techniques for assembly-language programs. As well, devices such as LCDs and matrix keypads will be interfaced to these MCUs. The course culminates in a term project designed, constructed, programmed, and tested by the student. The project serves as a vehicle in which students examine the identification of requirements for a system as well as develop project management skills.

Happy Puppy project At a final-term project demonstration, Darryl demonstrates his project to VP Martha Casson. Darryl's project involved retrofitting a Scampstm toy with a PIC microcontroller allowing full Win-32 control of the toy. The microcontroller was tied into existing circuitry including an H-bridge used to control the motor and various sensors in the toy. Interactive responses can be programmed via the Windows-based front-end program. Envisioned applications include use as a learning tool for emotionally troubled children.

Spectrophotometer Project Pictured here is Krish beside his project which was to build the controller for a spectrophotometer. While the mechanical system of the spectrophotometer was impeccable it lacked a scanning and control system. Krish used a PIC16F877 processor to control the step motor of the unit and acquire data from the photomultiplier feeding it back to a PC running a Win-32 program written in C++. The finished system will be used in the lab by students in the Photonics program.

Prerequisites

Co-requisites

You Are Here ...

This course is offered as part of the 'hardware stream' of courses in the Computer Engineering Technology (3 year, co-op) Program at Niagara College.

Text

Evaluation ...

PROJECT DUE DATES

Labs

For 2009F ...

The two-hour lab period, each Monday, is a general-purpose tutorial session to be used for debugging labs as well as specific discussions around projects. It is not anticipated that labs will be completed during the lab period as labs will generally consume more time than available during this period. Attendance at the lab period IS required when a lab or other assignment is due (unless it is handed-in ahead of time). Aside from this period, project discussions or assistance with a lab may be arranged with the professor during any of the posted office hours (posted on the EL panel on the office door in L-17) ... there is generally NO time available immediately before or after lectures for this.

Project

A major portion of this course is a microcontroller-based project. This project represents a typical design and construction project given to a new technologist. It consists of designing and constructing the project, testing it to ensure it meets specifications, and writing-up the entire project in a report.

The project is to be chosen by the student from a list of acceptable topics. If a student has a particular idea not on the list, discuss it with the professor. Only ONE student will be allowed to choose each topic on a first-come, first-taken order. Choose a topic which is of interest to you: If you are interested in writing an interpreter then the micro-PLC project might be of interest to you. If you like communications, perhaps a networking project is a good choice.

Each lab incorporates important principles such as interfacing the MCU to a 16 char by 2 line LCD display and matrix keypad, data acquisition, real-world interfacing, etc. Software will consist of the actual control task programming in RISC assembly language. Software must be reliable, functional, as well as user-friendly.

Timeline 2009F (the project is to be completed concurrently with labs in this course):

Project Timeline

Example of a Commercial Microcontroller-Based Design

Nighthawk CO Detector Nighthawk CO Detector

The popular Nighthawk brand of CO detector uses a PIC16C622 as it's brain. This processor, seen highlighted in the right photo, provides an on-chip ADC to convert analog values from both the electrochemical cell (which senses the presence of CO) and a thermistor (which senses ambient temperature) into binary values. The amount of CO is then computed in the PIC and is displayed on the multiplexed LEDs. This application illustrates a major advantage in the use of microcontroller-based designs in reducing component count. If built with conventional electronic components and discrete logic circuitry the unit would hardly fit into a suitcase let alone a small plug-in unit.

Past Projects

Future Projects (Available for Fall 2009)

Note: Each project incorporates a demonstrable milestone - essentially a check to ensure the hardware design is functional - to which marks will be assigned. Hardware must be demonstrated as working during the lab period on week 9 allowing time for redesign along with component ordering lead time. This mark will count for up to 17% of the project mark so it is imperative that the student complete the hardware design on time.

SD Card Datalogger
An SD card is wired to a PIC controller and, using the on-chip SPI interface, is used as a massive storage element allowing huge amounts of data to be logged. The data can be logged from a serial port and could be written to the SD card in a PC-compatible format (e.g. FAT-32) or could be acquired via a parallel interface and uploaded to a PC via the serial port: numerous options exist here. The system must be capable of logging over 256 MB of data points proving the capabilities of the SD-card. Note that the SD card uses 3.3V so the use of some interface circuitry (from simple resistors to a level-converter chip) is required. Demonstrable Milestone: Ability to write a byte of data to the SD card and read it back.

A Voice-activated Mouse
A serial mouse which uses a voice-recognition module allowing the user to say commands such as "Mouse Up", "Mouse Right", or "Mouse Click". Could be used as an aid for the handicapped. The device must emulate a serial Microsoft mouse and can utilize the voice recognition module from Sensory, Inc. Demonstrable Milestone: Plug it into a PC and have it recognized, and operate, as a serial mouse.

An Infrared remote-control Mouse
A serial mouse which uses a regular remote control. The number keys may hence be used to move the cursor and four other keys for 'click' and 'double-click'. IR signals may be received using a standard IR detector/demodulator module and any desired protocol could be used. Intended usage is for presentations (e.g. PowerPoints). The device must emulate a serial Microsoft mouse. Demonstrable Milestone: Plug it into a PC and have it recognized, and operate, as a serial mouse.

A Dial-In Home Monitor
Using an inexpensive external modem, this system allows a remote user to dial-into a house and check the status of home security, temperature, etc. using a remote terminal package. A "second ring" scheme may be used to allow concurrent use with an answering machine. On connection, the user should be provided with a simple menu of options which includes checking the status of various home-control systems as well as display temperature in the house. This project involves use of communications protocols (e.g. "ATDT" codes) and serial communications. Demonstrable Milestone: Ability to communicate with the modem and make connection with a remote terminal.

A Voice-synthesized Dial-In Home Monitor
This system allows a remote user to dial-into a house and check the status of home security, temperature, etc. all accessed using a regular touch-tone (tm) phone. A "breakthrough-code" scheme may be used to allow concurrent use with an answering machine. On connection, the user must provide a simple passcode and the status of various home-control systems, as well as temperature in the house, will be spoken via a voice synthesizer such as a General Instruments SPO-256 chip. This project involves interfacing to the telephone line, DTMF reception (via, for example, an 8870 chip), and voice synthesis. Demonstrable Milestone: Ability to read DTMF codes from a line and generate a voice message (e.g. "Test 1,2,3") via the synthesizer.

Printer emulator
Some older pieces of test equipment (e.g. the college's logic analyzers) can only use an Epson printer as an output device. This emulator plugs-in between the piece of equipment (via a Centronics printer connector) and a PC (via a serial or USB connection), emulating an Epson printer and converting the output for display on a PC via a Windows program (which is also part of this project). Ultimately, then, output from the test equipment which would have been printed would then appear in a Window (with the ability to cut and paste into any other Windows application). Demonstrable Milestone: The ability to sample and display (on an LCD or a serial connection) 'raw' printer data showing received codes

A Handheld Logic Analyzer or Oscilloscope
The PIC18F452 has a good deal of memory and, combined with a true bitmapped LCD (with an interface different than the normal LCD employed in class) can be used to build a one-chip logic analyzer or simple oscilloscope. The LCD must display four channels simultaneously (or a single analog channel) and must be programmable for sample time and trigger. Timing may be accomplished by using an internal timer and the unit should be capable of at least 200KS/s. Demonstrable Milestone: Display of a 'canned' waveform on the LCD Display

A Video Logic Analyzer
Running at 40MHz, the 18F MCU is capable of at least 1 MSample/sec across eight channels (if desired, the student may use a 30F6012 DSP processor for faster performance and more trace memory). Samples are then displayed as eight parallel traces on a dedicated display panel such as a Finlux EL flat-panel display which features separate vertical and horizontal synchronization signals (see the professor's flat panel driver for details). User selectable parameters include sample rate and trigger channel. A commercial model may be seen here. Demonstrable Milestone: Generation of traces (using 'canned' data such as a square wave) on the video display

A USB-based digital Strip-chart Recorder
Using the on-chip ADC this device samples analog channels at programmable fixed time intervals and stores data in a large, external, serial EEPROM. Time intervals and number of channels are programmed via a Win-32 front-end PC program. Data may then be downloaded to a PC via a USB connection and graphed on a Win-32 program which allows scaling of axes. The graph may then be pasted into other Windows applications. An 18F4550 processor may be employed in this project (instead of the usual 18F452) since it features an on-chip USB transceiver. This is a challenging project involving a good bit of student research. Demonstrable Milestone: USB connection verified on a PC

A Spectrophotometer Interface / Digital Strip-chart Recorder
Similar to the above project, uses the on-chip ADC to sample the analog input at programmable fixed time intervals and stores data in memory. Time intervals are programmed via a Win-32 front-end PC program (the scan rate is programmed on the machine and must be entered via the PC front-end as well) and the device must interrogate a fixed input to skip filter-change intervals. The output from the machine can be seen here - the top line is the analog input which represents % transmission and the lower line shows when the scan is active (when low). The scan starts on the left side and continues until a filter change occurs at which point timing must be interrupted until the scan begins again. Data may then be downloaded to a PC via a USB or serial connection and graphed on a Win-32 program which calibrates axes. The graph may then be pasted into other Windows applications. A commercial device, similar to this one, is employed in V14A and may be seen there - this device lacks the ability to halt recording while filter changes occur. An 18F4550 processor may be employed in this project (instead of the usual 18F452) since it features an on-chip USB transceiver. Demonstrable Milestone: USB connection verified on a PC

Model Railroad Block-detection and signalling
In a traditional approach, each block on a model railroad has a twin-tee current detector wired to up to six signals on either side of that block ...wiring is quite a mess. In this new approach a small network will be used to convey information about block occupancy to signals and operator so that wiring consists of a simple two wire bus onto which all devices are attached. The best network protocol for this application is an RS-485 multidrop with the on-chip serial port used for serial Rx/Tx. With an appropriate protocol, signals can be fully automated and autonomous with signal indication depending on occupied blocks as well as position of switches on the track. The proposed system would have each block detector 'announce' its status, when a block changes state to become occupied or free, on the network and have signals 'listening' for such changes. A table structure inside the signal processor would then determine the correct indication based on occupancy of various blocks. The professor has a document outlining a proposed system of this type but the student will be required to research the operation of ABS block signals (a good start might be here where signals are examined from a modelling perspective) as well as basic model railroad electronics.

Other Possibilities ...

Other Goodies ...

Course Notes

Quick Start Guide A guide to getting "up and running" with the PICPROTO board used in our labs (Password-protected PDF)
Debugging with the ICD-2 A guide to using the ICD-2 as a debugger (Password-protected PDF)
I/O Hardware 101 A look at CMOS and TTL I/O (Password-protected PDF)
Programming Constructs and Timing Writing delay functions and how to count clock cycles for program execution (Password-protected PDF)
How NOT to Program A few tricks and traps NOT to fall into when writing PIC code (Password-protected PDF)
Nixie Thermostat A complete project used as an in-class example, with project notes for guidance
Temperature Alarm Design Example A walk through the entire design process of a small alarm system. Note: Based on an older 16F84 PIC chip no longer employed in this course
Temperature Alarm The complete project including downloadable code. Note: Based on an older 16F84 PIC chip no longer employed in this course
Carillon Project a description of a hypothetical project which addresses the issue of project complexity
Software Safety (PPT, Password Protected ZIP) the in-class presentaton on software safety.
Project Submissions outlines the contents of documentation required for the project
Project Marking Scheme the marking scheme for the project
Final Exam Notes outlining procedures required and allowed aids
USB-101 an example of a PIC USB application (Logic Analyzer) NEW

Links (Serious Course-Material Type)

The following are LINKS to web sites which feature microcontrollers. Some sites allow the downloading of code and designs which may be useful to students in this course.

Microchip Inc. ... The company which produces the PIC controller This site features datasheets and maintains a download library of code for PIC microcontrollers.
PICBOOK.COM The site which accompanies the textbook we use. Example code and resources available here.
MAXIM Semiconductor Inc. This site features datasheets for the MAX232 RS-232 transceiver chip
Circuit Cellar INK The folks who give us the class set of magazines each month. Features an ftp site with code from magazine articles available for download, etc.
LCD SIMULATOR allowing prototyping of commands
TeraTerm Pro a simple terminal emulator for a PC
Therac-25 Accident Investigation a paper by Nancy Leveson on the safety of software employed in the infamous therapy machine
Therac-25 Accidents the original paper by Levenson as published by the IEEE in Computer, July 1993
USB In-A-Nutshell from beyondlogic.org, a good introduction to the hardware and protocol involved.

Links II (Not-So Serious Gee Whiz Type)

The World's Smallest Web Server Running on an 8-pin PIC processor in about 0.5K words of program memory.
The Furby Autopsy Site A fine example of a microcontroller application
Bob Blick's Projects All of which use a PIC. The most interesting is the spinning clock

Code and Circuits

DISCLAIMER: All code and examples are copyright Niagara College 1997-2007. This information is intended for suggestion only and may be superseded through updates. Use of this code in any commercial application is forbidden. Code and examples are provided without warranty and Niagara College and the author assume no liability whatsoever with respect to accuracy of information, use of such information,or infringement of patents arising from such use or otherwise. No licences are conveyed implicitly or otherwise under any intellectual property rights.

Example PIC Assembly Code:

Schematics:
Lab Utilities:
Old Exams:

Contact:

For the Computer Engineering Technology program ...
Telephone (905)735-2211 (Dean of the Technology Division's Office, L-23)

For this course ...
Professor Mark Csele
Telephone (905) 735-2211 x.7629
E-Mail: (Be sure to include 'Computer Technology' in the subject line to avoid deletion by an anti-spam filter)
NOTE that this course, with an intense lab component, is not offered by distance ed nor any other mode of delivery. Niagara College does NOT offer student internships to students outside the regular college system.
URL: http://technology.niagarac.on.ca/people/mcsele


You are visitor # since Nov, 2001

Copyright (C) Niagara College, Canada, 2002-2009
This course is part of the TECHNOLOGY division