Jack, H., “Using the Parallax Propeller for Mechatronics Education”, ASEE Annual Meeting, Atlanta, GA, June 2013.
Microcontrollers have become a mainstay of mechatronics laboratories. For example, the Arduino boards, and shields, are low cost flexible hardware that can provide substantial capabilities. At Grand Valley State University all engineering students learn to program microcontrollers using Atmel ATMega processors, the same processors used on the Arduino boards. In the mechatronics course, EGR 345 - Dynamic System Modeling and Control, the students use Parallax Propeller based hardware. The alternate, Parallax Propeller, hardware platform broadens the students’ knowledge and gives them access to a multiprocessing environment.
The paper objectively outlines the hardware/software platform and how it can be used in a mechatronics course for Manufacturing Engineering students. The supported topics include data collection, feedback control, various sensors, networking, and human interfaces. Educational activities include laboratory work and small projects.
A computation platform is the backbone of any introductory course focused on mechatronics and/or modern controls. The number of available platforms easily reaches into the thousands. However for the purposes of education there are a few wise alternatives. The typical selection criteria for these systems are:
Naturally each platform has strengths depending on the focus of the academic program and the students. The two major divisions for control systems are industrial and embedded. Industrial control systems normally include Programmable Logic Controllers (PLCs), Programmable Automation Controllers (PACs), System Control and Data Acquisition (SCADA), Numerical Control (NC), etc. Programs with an industrial focus will have at least one course in industrial controls1. Embedded controls use some sort of microcontroller, or full computer, interfaced to sensors and actuators. Embedded control system topics are an essential part of every electrical and computer engineering (ECE) program. Embedded control systems courses are increasingly available for many other programs, such as Mechanical Engineering (ME) and Chemical Engineering2. For the purposes of discussion the term Mechatronics will be used to describe a mechanical engineering approach to industrial and embedded control.
Student prerequisite knowledge varies by curriculum. At the lower end of the scale, students have not had a programming course, no digital circuits course, and little procedural problem solving3. When the Mechatronics course does not require much prerequisite knowledge the instructor often selects a system with a very shallow learning curve. There are a few approaches that have been used including the Lego Mindstorms NXT4 and Parallax Basic Stamp 25. Mindstorms based experiences have been used successfully by educators working with high school students, and college freshman. Students construct the system using the ubiquitous blocks and then they construct simple graphical control programs. This approach provides exposure to the programming concepts and the context for the system components6,7.
The systems with shallow learning curves are not a replacement for embedded system controls. However, they have proven very effective when dealing with students who are reluctant to program and/or do not have the right prerequisite knowledge. When self-motivated students have already learned the fundamentals of programming, they are much better off to focus on a much more mature platform. An example of the mature platform is the Arduino controller8 which uses the Atmel ATMega processor9. The Arduino platform is designed to be modular for the hobby market, but the core processor is industrial grade and used in many commercial products. The processor can be programmed in languages such as C and assembly language. The basic Arduino system can be expanded using shields10 produced by hundred of third party vendors and open source advocates. These shields range from basic input-output boards11, to touch screen displays12, and cell phone SMS/Data capabilities13. Given the variety of hardware and large number of support websites14 these are one of the best choices for a mechatronics curriculum. The Raspberry Pi computer15 is also showing potential for this role. However, these platforms do require some knowledge of microcontroller level hardware interfacing.
The Parallax Propeller16 occupies a middle ground between the Mindstorm and Arduino platforms. It is possible for a new programmer to produce a functional control system with inputs and outputs using the Spin language. The hardware has eight processors, called cogs, using 32K shared RAM and 32 IO pins. Each processor has 2K of RAM and can run up to 80MHz each. Instead of using interrupts, programmers write subroutines that run on separate cogs. For example, on a typical microcontroller a pulse width modulated (PWM) output is generated using a system counter. To generate a PWM output in SPIN, one cog would run an endless loop that counts on and off steps, forcing the pin manually on and off. Interestingly, the Propeller processor also has a built in capability to generate regular VGA output signals.
Surprisingly, the only ASEE paper to reference the Parallax Propeller hardware was written by Fraser17. He switched to the platform in 2010 from a PIC processor. His assessment was “The Parallax environment is far superior to the PIC development environment making for easier learning by non-computer science students.” This authors experience is similar, by replacing interrupt driven programming with the polled nature of SPIN, students were able to understand and apply concepts in less time. Some of the advantages and disadvantages of the processor include:
An example of a SPIN program is shown below, to pulse an output pin with a 50% duty cycle. The first three lines of the program define the constants that set the clock speed to 80MHz. Although it is a bit cryptic, beginners accept this quickly. The VAR definition includes a few bytes for the stack of the pulse() thread. The X value becomes a global variable. The Main routine sets the flag value, X, to 0, and sets pin 16 as an output. The cognew function starts another processor cog running the Pulse function. After this there are two threads of execution running in parallel. The following is an endless repeat loop. outa is used to set an output pin value, and the waitcnt delays until the system clock, cnt, matches the given value.
The course in question is offered to junior level students in the Product Design and Manufacturing Engineering program at Grand Valley State University. The students have had sophomore level experience programming in C on Atmel processors. This course is entitled Dynamic System Modeling and Control19. The course topics20 begin with developing differential equations for mechanical and electrical systems, solving the differential equations explicitly, and numerical methods. The course moves into feedback control, motion control, sensors, actuators, and LaPlace transforms. The course is a combination of 3 hours of lecture and 3 hours of lab per week for a semester. The laboratories cover a variety of issues from basic modeling to system control.
In the past the course has used a number of platforms including the Parallax Basic Stamp 2, Motorola 6811, and Atmel ATMega 16/32. In 2010, the Parallax Propeller system was tested in one laboratory experience. The outcome was very encouraging and this was expended to cover more laboratory experiences in 2011, and was fully deployed in 2012.
Students buy their own controller for the course, a P8X32A QuickStart board from Parallax for $25, or from Radio Shack for $40. The reason for student purchased hardware is twofold. When they own their hardware they are likely to use it for other projects in the future. And, experience from previous years showed that students are much more careful with hardware they own.
Students normally worked in pairs in the laboratory. Simpler exercises or tutorials were offered early in the semester to familiarize the students with the hardware and programming approaches. They were encouraged to create and maintain source code for reuse later. As the semester progressed, weekly laboratory work was assigned, along with some outside projects. These provided a useful mix of creative work on projects, and disciplined work on system modeling and data collection. Weekly exercises included:
The natural parallel structure of the Propeller processor makes it easier for students to break down tasks and write programs. In particular, the cog structure was simpler than interrupts, and easier to debug. Although the author would recommend the use of the Arduino platform for students continuing on to additional Mechatronics courses, the Propeller hardware is very well suited for a mid-level terminal Mechatronics experience.
20. Jack, H., “Dynamic System Modeling and Control”, Lulu Press, 2012. http://www.lulu.com/shop/hugh-jack/dynamic-system-modeling-and-control/paperback/product-20321449.html;jsessionid=0FE494FEB3D31021BE63B452B9EAE983