
Abstract
Basic Stamp 2 (BS2) is a popular microcontroller used
both in hobby and industrial projects. Similar to other
microcontrollers, the BS2 programming environment lacks
graphical user interface (GUI) capability. In this paper, we
present an approach to endow the BS2 microcontroller with
GUI capabilities by interfacing it with Matlab and by
exploiting Matlab’s abundant GUI tools. The proposed
Matlab-based GUI environment for BS2 relies on the use of
serial communication between the BS2 and a personal
computer. We present three examples to demonstrate the
efficacy of our approach.
1. Introduction
Microcontrollers are inexpensive devices commonly used
in embedded computing applications to impart computing
and smart decision-making capabilities to machines,
products, and processes. Microcontrollers are designed to
interface to and interact with electrical/electronic devices,
sensors and actuators, and high-tech gadgets to automate
systems. Microcontrollers are generally embedded directly
into the product or process for automated decision making.
Because they are not meant to interface with human beings,
however, microcontrollers do not have graphical user
interface (GUI) capabilities that are common in many
personal computer (PC) applications. Although this is not a
problem for end-user applications, the lack of a GUI is a
serious limitation for the developers of microcontroller-
based products.
Even though third party GUI tools are available for
microcontrollers, they are often inadequate for sophisticated
applications and lead to other problems as well. For
example, StampPlot [1] is a graphing utility, developed and
distributed by Selmaware Solutions, for Basic Stamp 2
(BS2) [2] microcontrollers. This program is fairly easy to
use. The user simply connects the BS2 to a PC with a serial
cable and gives the StampPlot software control over the
serial port on the BS2. The program receives data on the
serial port from the BS2. In BS2’s programming
environment a debug command is used to transmit data
serially from BS2 that in turn is plotted by StampPlot.
There are three limitations of this software package. First,
StampPlot does not provide advanced plotting features,
such as three-dimensional plots, which are often of great
interest in the development stage of a product. Second,
StampPlot cannot co-process data. The program only allows
the user to plot the data without the ability to, for example,
filter it. Third, we have found that StampPlot interferes with
certain PBasic commands. For example, the debugin
command, which is used to input a value from the PC to
BS2, cannot be used when StampPlot is running.
This work is supported in part by the National Science Foundation
under grants 0227479 and 0337668 and the NASA/NY Space Grant
Consortium under grant 39555-6519.
In this paper, we address the issue of imparting GUI
capabilities to the BS2 microcontroller by combining a
powerful software, namely, Matlab, with BS2. Although
this paper focuses on BS2 as the microcontroller, our
approach can be applied to any microcontroller that
supports serial communication, such as the PIC series
microcontrollers. This approach can also be extended to
where the microcontroller is not being used as a
development platform, but rather as a stand alone Data
Acquisition and Control Board (DACB). Whereas PC-
based DACBs typically cost a few thousand dollars, a PIC
microcontroller costs only a few dollars. This application of
our approach can be beneficial particularly to educators
specializing in the field of control system technology.
Finally, this paper is in the spirit of [3], which discusses the
integration of BS2 and LabVIEW.
This paper is organized as follows. First, in Section 2, we
describe the hardware environment typically used during
the development stages of microcontroller-based product
design. Next, in Section 3, we describe the software
environment used in this paper. In Section 4, we present
three examples that illustrate data communication between
BS2 and Matlab. Finally, in Section 5, we draw some
concluding remarks.
2. Hardware Environment
The hardware environment for this paper consists of a
microcontroller, a PC, and a data link between the two. The
microcontroller is a device that interfaces to sensors and
actuators and performs embedded computing. The PC is
used to write the user defined embedded program, which is
to be run on the microcontroller. The PC also serves as a
debugging environment when prototyping microcontroller
based products and processes. It allows the user to receive
sensory information and other selected data. A data link is
needed for the microcontroller and PC to communicate. In
this paper, we use a form of serial communication between
the microcontroller and PC.
2.1. Microcontroller
In this paper, we focus on the BS2 microcontroller
installed on a Board of Education (BOE) development
platform. These devices are manufactured by Parallax, Inc.
[4]. The BS2 is a 24-pin Dual Inline Package (DIP)
integrated circuit (IC) [2]. It is based on Microchip Inc.’s
PIC 16C57 microcontroller. The BS2 is powered by a 6-
14V direct current (VDC) power supply. A voltage
regulator on the BS2 provides a steady 5VDC supply to the
BS2. The BS2 comes with ROM, 2KB Electronically
Erasable Programmable ROM (EEPROM), and a small
amount of RAM. The BS2 is programmed in PBasic
language; the instruction set that is permanently stored on
the BS2 ROM. The user-defined program is downloaded
into the EEPROM from a PC through a DB-9 serial cable
connection between the PC and BOE. The excess EEPROM
can be used for long-term data storage. The BS2 has 16
Matlab-Based Graphical User Interface
Development for Basic Stamp 2
Microcontroller Projects
Mechanical, Aerospace, and Manufacturing Engineering, Polytechnic University, Brooklyn NY 11201
Yan-Fang Li, Saul Harari, Hong Wong, and Vikram Kapila
Proceeding of the 2004 American Control Conference
Boston, Massachusetts June 30 - July 2, 2004
0-7803-8335-4/04/$17.00 ©2004 AACC
Komentáře k této Příručce