circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

June 2004, Issue 167

Wireless Monitoring System


by Alberto Ricci Bitti
Alberto’s MC68HC908-based wireless monitoring system is adaptable for use in domestic and industrial settings. The central monitoring station, which consists of a computer-controlled receiver with a relay output and LCD, logs and displays data from up to 20 different sensors. Read on to learn how to build, program, and test your own system.

One of the things I have learned from my everyday engineering practice is that there is always room for ingenuity and improvement. This is particularly true for this project, which applies a couple of inexpensive microcontrollers to an unusual device: a live-catch mousetrap.

Mousetraps of this kind imprison mice instead of killing them with chemicals or bloody mechanisms. They are useful when regulations, laws, or just plain common sense forbid the use of poisons and chemicals. This applies to the food industry, from farms to your preferred restaurant, as well as places like schools and homes (where children and pets can open traps) and even hospitals and pharmaceutical facilities (where contamination should be avoided). As you can see, I’m talking about a worldwide market with millions of customers.

Unfortunately, live-catch traps are extremely expensive to maintain because of the labor costs required to continuously check them. Although a single mouse catch is a rare event in today’s hospitals or pharmaceutical depots, the traps must be checked every few days. Making matters worse, the traps are often located in places that are difficult to access.

I designed my system with the objective of drastically cutting the labor costs involved with checking traps (see Figure 1). Now you can leave the traps unattended until the system calls for assistance.

(Click here to enlarge)

Figure 1—My goal was to cut labor costs and eliminate the need for weekly trap checks. A transmitter is placed in every trap to signal the presence of mice. If a trap needs to be emptied, the system automatically calls home.

My system consists of a monitoring station—a computer-controlled receiver with an LCD and relay output—and up to 20 mouse sensors. It works by placing a mouse sensor (a small plastic box) inside each trap. When a mouse is captured, the sensor transmits its trap identifier to the monitoring station, which logs and displays it where it’s conveniently viewed. Alternatively, the receiver can dispatch the call to an external service, triggering an ordinary automatic phone dialer connected to its relay out. Refer to the “The System at Work” sidebar for more information.

 

NONTRIVIAL REQUISITES

Although conceptually simple, such a system design is nontrivial. The parts count must be kept to a minimum in order to contain costs. The dimensions are essential to fit even the smallest traps on the market. In addition, mouse sensors must be battery operated, so the batteries must last for years of continuous service. This calls for low-power parts and carefully designed software.

Another requirement is that the system be able to resolve collisions that result from the simultaneous transmission of two or more mouse sensors. It should also tell you when the batteries need to be replaced and be able to detect when a trap is lost or destroyed, which isn’t an unlikely event in industrial environments. And, of course, the system must be simple, resistant to dirt, reliable, and easy to manufacture.

On the receiver side, the monitoring station must be cost-effective, dependable, and easy to set up and use. It must show complete trap information, and the configuration data must be retained after power interruptions. The design should be compact, modular, and flexible. As with all new products, additional requirements are expected to emerge as work on the design progresses; therefore, high-level programming languages are preferable.

 

MCU SELECTION

Not many years ago, I would have started this design by selecting a specialized remote control encoder/ decoder IC pair, looking for ultralow-power parts, and adding glue logic. If a microcontroller were required, I would have selected an MCU with a familiar architecture and instruction set. The time it takes to learn the development tools (not to mention the cost) would have influenced my choice.

Nowadays, the design path is somewhat reversed: MCU selection is one of the first steps in the design process. You can use general-purpose, low-cost microcontrollers for tasks previously done with dedicated ICs, with the extra advantage of adding functionalities in the software. Tools are inexpensive and sometimes free. In addition, it’s no longer necessary to know assembly language because high-level language compilers are available for programming (including the smallest possible controllers).

I selected the 8-bit MC68HC908 microcontroller for this design. The same MCU core comes in a tiny eight- (QT suffix) or 16-pin (QY) package, with 128 bytes of RAM and 1 to 4 KB of flash memory. This IC includes unique features that make it perfect for this application. It does not require external reset, and its flash memory-calibrated internal oscillator is suitable for battery-operated devices because it keeps steady despite varying power voltages. Therefore, all of the pins—except the power supply—are available for input and output, which makes the eight-pin packaging effective for the trap transmitter. The 16-pin version nicely fits the receiver’s requirements.

At an aggressive price, I’m talking about a truly classic MCU, with a true stack, capable of running true ANSI C code. Note that there is also hardware support for one-pin in-circuit debugging (ICD), so an emulator isn’t required. Furthermore, flash memory can conveniently emulate EEPROM, a feature I used to store trap IDs.

As for the tools, the Metrowerks Codewarrior IDE includes an assembler, ANSI C compiler, simulator, programmer, in-circuit emulator/ debugger, and even a light version of Processor Expert, which is an automatic C code generator. Although the tools are professional-grade, they are available for free.