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





 

Issue 160 November 2003
RF Made Simple



DEAD-EASY APPLICATION

Well, almost. This is an embedded project, and you all know the first rule of embedded programming (repeat after me): nothing is free.

I wanted various microcontroller-supported easy-Radios to report to a central module that reports to me with an e-mail message. The idea was to have the CH2124-equipped easy-Radio station poll the remote easy-Radio stations for their data. Every easy-Radio station within an earshot picks up a transmission, so I’m also considering having each radio listen for a transmission, wait for a predetermined amount of time, and then transmit its data. Whether to poll or use a timed sequence for transmission depends on the application.

In any case, the central CH2124-equipped easy-Radio station simply assembles the incoming data from the radios in the network into an e-mail I can read and shoots it down the line using the CH2124. The concept is simple; however, the implementation is a click above dead easy. In the CH2124 and the easy-Radio, we have two intelligent devices. The easy-Radio and the CH2124 have serial ports, which presents Problem 1. Although both of the smart devices have serial interfaces, the easy-Radio serial interface’s speed seems to be fixed at 19,200 bps. The CH2124 wants to see a 2400-bps serial datastream at its serial interface, which stands to reason, because it’s an intelligent 2400-bps modem module.

Checking the CH2124 datasheet, the CH2124 cannot be commanded to do 19,200 bps at its serial interface. My goal was to not have a microcontroller in the CH2124-equipped easy-Radio station. There’s more than enough intelligence between the easy-Radio and the CH2124 to make this RF-to-e-mail thing happen. Now “dead easy” has turned into “dead in the water.”

OK, if I have to add a microcontroller to solve Problem 1, it’s going to be an itty-bitty one, and the code is going to be itty-bitty, too. Because the CH2124 won’t be retrieving e-mails in this application, all that’s needed is to convert the easy-Radio’s 19,200 bps to 2400 bps, and then feed the lowered data rate data to the CH2124’s 2400-bps serial interface.

The production easy-Radio/CH2124 units didn’t need the RS-232 conversion circuitry present on both the CH2124 and easy-Radio evaluation platforms. But remember that this was supposed to be easy, so I verified the data rate converter hardware and firmware using the known-good easy-Radio and known-good CH2124 evaluation hardware already on hand. After I had a working data rate converter circuit, I was able to eliminate the RS-232 conversion ICs and stick the itty-bitty microcontroller between the easy-Radio and CH2124 serial interfaces.

REMODELING THE BOARD

The blue power indicator LED on the easy-Radio evaluation boards stayed. Right now, I don’t know about the rest of the easy-Radio’s evaluation board’s power train. There it is, the potential Problem 2. Easy-Radio engineers warned me that I didn’t have the latest spin of the easy-Radio evaluation boards. They also said that the voltage regulator currently on the evaluation boards wasn’t up to snuff for the new 900-MHz hoppers.

I’m not planning on adding much more of a load to the easy-Radio evaluation board’s power supply, but I don’t want to add enough load to cause a shutdown of the evaluation board’s on-board 78L05 SMT voltage regulator. There’s ample ground plane area on the bottom of the evaluation board to clear some heatsink space for a small-package 78M05 voltage regulator that can handle up to 500 mA, which is more than enough to handle the easy-Radio hopper module and what little else I’ll add.

You can power an easy-Radio evaluation board with either a 9-VDC wall wart or 9-V battery. The evaluation board’s on-board, 5-V SMT regulator pre-regulates the incoming 9 VDC provided by the wall wart. Pre-regulation is a good thing, because as the average unregulated 9-VDC wall wart actually supplies about 12 VDC under light load conditions. The easy-Radio has an internal 3.6-V regulator and a 5 V-tolerant I/O interface. It’s a safer bet than applying 5 VDC, because it won’t tax the easy-Radio’s internal regulator.

The easy-Radio and the CH2124 are both configured as DCE, which allows a straight-through cable to connect either of them to a standard DTE PC serial port. Because I wanted to stick with the CH2124 and easy-Radio evaluation boards, one of them had to be converted to a DTE configuration. I’m already chopping on the easy-Radio evaluation board, and, in the traditional sense, the CH2124 evaluation board should be the DCE device because it holds the modem, which is considered a DCE device. So, one of the Easy-Radio evaluation board’s serial receive and transmit lines will be swapped to transform the board into a DTE device.

If I poll for data, I will need a microcontroller on the CH2124 end of the RF link to initiate the polling sequence. If I allow the easy-Radios to police themselves, I still would require a microcontroller on the CH2124 side of the RF link because I need data rate conversion between the CH2124 and the easy-Radio module. So, it looks like my no-microcontroller-at-the-modem-station idea is a bogus concept. With that, I’ve got a couple of ideas about which microcontroller I should use.

My first inclination was to use an eight-pin PIC12F675 for the data rate converter. If I go with the little eight-pin PIC, I’ll have to allow the easy-Radios to operate on a timed basis, because I’ll most likely consume all of the PIC12F675’s processing time converting data rates and transferring data. To allow the CH2124-equipped easy-Radio station to poll, I’ll need a microcontroller with a USART and USART interrupt capability. That takes the “easy” out of it, so I’ll go with the itty-bitty PIC.

The PIC12F675 doesn’t need an external crystal because it contains an internal 4-MHz oscillator. All I need externally to support the PIC12F675 is a 0.1-µF bypass capacitor.

The simplicity of the PIC12F675-based data rate converter allows you to mount the PIC12F675 in an in-line fashion using one of the unused in-line radio receptacles on the easy-Radio evaluation board. The evaluation board is a simple double-sided board, which allows you to cut and reroute existing traces to accommodate the data rate converter’s power and I/O. All of the data rate conversion is performed on the TTL side of the serial link. The CH2124 and the easy-Radio are both designed to use TTL levels on the serial link and eliminate the need for RS-232 voltage levels to communicate serially with a host processor.

Normally, the addition of a microcontroller would allow for the buffering of the data between the easy-Radio and the CH2124. In this case, the little PIC has no USART or USART interrupt structure, and I’ve tied up the PIC12F675’s time to such an extent that there may not be enough cycles to perform a buffering operation without missing an incoming bit. The solution is to not attempt to buffer the data with the PIC and allow the data rate-converted data to flow freely from the easy-Radio to the CH2124 modem.

The CH2124 can be instructed to store a message and transmit the message using @T iModem commands. Because the channel is always open between the easy-Radio and the CH2124, the @T commands can be embedded in the incoming datastream that originates at a remote easy-Radio station. A typical message from a remote easy-Radio is shown in Photo 4.

(Click here to enlarge)

Photo 4—The remote non-modem-equipped easy-Radio generated the entire line beginning with @TM1. The end of a message is signaled by a carriage return dot carriage return. The @TDM1 was also generated by the easy-Radio on the non-modem side of the RF link. The rest of the messages, which were ignored, are from the CH2124. You can see them because I have Serialtest Async tracing both the CH2124 and the easy-Radio serial connections.