An mbed Module to the Rescue

-May 16, 2010

A request for design help arrived by email: An engineer needed ideas about how to get data from several sensors into a PC in a format he could easily use. Each sensor circuit provides an SPI port for communication of commands and setup information to the sensors, and communication of 2's complement data to a microcontroller, so I thought of several options, starting with a bare MCU chip. But because I recently worked with an mbed module that provides an NXP LPC1768 ARM Cortex-M3 processor, it seemed like a good choice to start.

The mbed module provides two SPI ports and has plenty of digital outputs for sensor chip-enable signals. An mbed serial port could communicate information to a host computer. To learn more about the mbed module, documents, and online compiler, go to:

The utility of the mbed module centers on its library of functions that greatly simplify the setup and use of its many peripherals. Easy-to-use functions establish port-control bits and bytes without forcing engineers to learn about data-direction registers, flag settings, and so on. You can get into that level of detail if you wish.

In the sensor project, the serial port would require a 3.3V-logic to RS-232 (EIA-232) converter, but not much more. Many people use what's called "wedge" programs to take ASCII characters and place them into an Excel spreadsheet. Or, the mbed could convert the binary information from the sensors into values for a comma-separated-values (CSV) file that other software could read, too. The mbed module's USB connection with a host PC used to create code and download binary files to the module, also can serve as a virtual serial port.

While thinking about this sensor problem, I connected my mbed module to a Digi International XBee radio transceiver and used a Parallax USB/XBee adapter on my lab PC to provide another transceiver. The mbed Web site provides some information and sample code, but it took a bit more digging to get all of the information necessary to set up my PC with a virtual serial port to connect with the mbed module. Within about 30 minutes I had one XBee radio communicating with the other XBee module. The code example took only 21 lines of code, six of which controlled LEDs on the mbed board. Perhaps my email correspondent could also take advantage of wireless communications and battery power near the sensors.

Here's my quick set up for XBee-to-XBee transceiver communications that used HyperTerminal and Digi International's X-CTU software to act as a terminal on each side of the RF link. The range for these modules can extend to 100 feet or more.  The mbed module made it easy to create and download code.

For more information on the mbed module and how to use it, read my "Lab Rat" review in the May 2010 issue of Design News magazine. The printed review includes a link to a longer online review.

Loading comments...

Write a Comment

To comment please Log In