Electronic Design

  
Reprints     Printer-Friendly    Email this Article    RSS        Font Size     What's This?


[Ideas For Design]
PWM-To-RS-232 Translator Boasts Over 11-Bit Accuracy

William Grill  |   ED Online ID #12807  |   June 22, 2006


WILLIAM GRILL, Honeywell Aerospace-Olathe, Olathe, Kansas
william.grill@honeywell.com

Over the years, many sensor monitor designs would have benefited by being able to have their encoded pulse-width modulation (PWM) data forwarded to and post-processed by a PC-based host. However you encode the PWM information, the PWM-to-RS-232 translator described here has a small footprint and a total cost under a few dollars.

Several relatively small and inexpensive controllers are available (in addition to several techniques) to perform this function. This application uses the Microchip 10F20x-series, four-I/O controller. It was selected because of its predictable execution time and small (SOT23) package. Portable into multiple compatible controller footprints, this translator should give new life to dozens of old ideas and serve as a bridge circuit for new designs. The circuit includes the controller (U1), transistor translators (Q1 and Q2), and the 78L05 regulator (U2) (Fig. 1).

Assembly-language-based processes in the controller equalize the branch paths to constant-length loops. Both high and low input states are evaluated by totalizing the number of these 8- s loops in each state, using 16-bit "totalized-count" registers. An 8-bit " loopindex" register allows up to 255 periods to be accumulated. When all periods are processed, the totalized-count registers are copied and zeroed, the loop-index register is reloaded, and the request line is qualified.

The request input is asserted as a high to low transition on U1's P2 (pin 4). When the request is asserted, the saved results are scheduled to an RS-232 serial link. As a result, the period between serial updates depends on the number of selected totalized index loops and the PWM's input period.

The update frequency is approximately:

Update frequency (Hz) ≤ 1/[(no. of totalized loops * PWM period) + RS-232 transmission time]

If no request is detected, the entire process is repeated.

The included Windows-based monitor and control schedules the requests or receives updates continuously over the RS-232 bus. Using a Visual-Basic-based interface migrates the calculation and display processing to the more powerful host. It also provides a platform to extend and adapt this simple and inexpensive implementation to your own particular application.

Five bytes are sequenced into Q1 and onto the serial bus at a fixed, 9600-baud rate, transmitted in the order shown below:

  • Number of loop-index counts selected
  • Low-state totalized-count most significant byte (MSB)
  • Low-state totalized-count least significant byte (LSB)
  • High-state totalized-count MSB
  • High-state totalized-count LSB

With the factory-set calibration of the on-chip's 4-MHz clock, the link timing is adequate over most of the common temperature range. Evaluating both states yields consistent accuracy by eliminating this reference clock's error.

Designs are usually flexible enough to pick the PWM period. Allowing for a range of PWM's period, there's some margin required to ensure that with the selected number of loop-index counts, the totalized count doesn't exceed the 16-bit counter-register space. In general, this limitation is:

216 1 > no. of totalized loops * [(1/Input frequency)/8 μs]

The controller is coded to supply fixed 16, 1, or 8 totalized period counts for the Mode control U1 (P3, pin 6) strapped low, pulled high, or floating, respectively. The loop-index count used in the coded processes, passed in the link, and displayedin the monitor window can also be adjusted by selecting an appropriate capacitor (C1) and resistor (R1) on U1, pin 6, Mode pin.

Upon power-up, the controller qualifies the Mode pin for a high or floating state. Then it discharges the pin and threestates—monitoring its status while indexing a local counter register every 9 μs— until it either detects a logical high or declares it strapped to zero by counting through its maximum count. Because the pin is momentarily driven high and low, this input should always be terminated with at least 220 Ω.

The monitor window created in this application shows the totalized register's raw data, the number of loop counts, and the resulting ratios of totalized high and low counts (Fig. 2).

While 8 bits of accuracy is enough for many applications that need low sample update rates or low information bandwidths, accuracies of 11 bits or more, at the monitor window, are easily available. Trading update time for higher loop counts and increasing the PWM period will reduce the error. The ability to accumulate multiple periods lets the calculated accuracy be improved by filtering input jitter and the process' uncertainty in the input's edge detection.


Reprints   Printer-Friendly  Email this Article  RSS    Font Size   What's This?


  • Engineers Rely On Internet For Product Info
  • Rochester Electronics Establishes New Design and Technology Group
  • Custom Sources Light Way To 22-nm IC Lithography
  • In EDA, A Year Of Mergers, Failed And Otherwise
  • Software Turns Scopes Into Vector RF Signal Analyzers
  • Couple’s $15 Million Gift Advances Rice Engineering Education
  • November 7, 2008
  • Startup Sets Sail For Speedier Spice Simulation
    1) Ten Top Design Skills For Tough Times
    (8632 views today)
    2) Ultracapacitors Branch Out Into Wider Markets
    (610 views today)
    3) Energy Harvester Perpetually Powers WIreless Sensors
    (607 views today)
    4) Technology Has Been Very Good To Obama, And He Plans To Reciprocate
    (446 views today)
    5) Build A Smart Battery Charger Using A Single-Transistor Circuit
    (293 views today)
    ALL TOP 20



    Reader Comments

    Is there a reason why the code is no longer available? (Or maybe I am not looking in the right place. Interesting project.

    Anonymous -April 30, 2008

    I saw a nice companion application which would work nicely with this offering. EDN, December 1, 2006, Voltage to Pulse-Width Converter...by James Christensen. With 2 additional parts, including a controller, 8bit data can be linearly encoded to PWM, which links well and is easily adapted to wireless. At the far end, this PWM to RS232 convertor can then process it in the host.

    William grill -December 01, 2006

    In the past I have published several controller based projects which, like this one, I believe may useful and interesting enough to simulate a closer look. This was a unique project which includes multiple ideas eg:single pin low/high or floating qualification, synchronization and scheduling of an asynchronous request, implemetation of a 232 link and extensive use of branch equalized coding. Please read my other published applications in Electronic Design, EDN's Design Ideas and in Design News. If you have found this or any of those others interesting enough...please add and comment here or I would like to get an email and hear from you.

    William Grill -July 17, 2006

    POST YOUR COMMENTS HERE
    Name:

    Email:
    Your Comments:

    Enter the text from the image below


    Please refresh the page if you have trouble reading this text.

    Search Electronic Design
         
      
     
    Email Newsletter
    Sponsored By:
    Electronic Design UPDATE provides readers with late-breaking news, opinions from industry experts, and timely technology stories. It's a unique opportunity to get your product message in front of engineers, engineering managers, and corporate managers while they're reading about critical information online.

    Enter Email to Subscribe
      

    Electronic Design Europe Electronic Design China EEPN Power Electronics Auto Electronics Microwaves & RF
    Mobile Dev & Design Schematics Find Power Products Military Electronics EE Events Related Resources