element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Open Source Hardware
  • Technologies
  • More
Open Source Hardware
Blog Very Low-Cost Pulse-Width Modulation (PWM), and Isolated Analog Measurements
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Open Source Hardware to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: shabaz
  • Date Created: 24 Nov 2023 11:25 PM Date Created
  • Views 6311 views
  • Likes 13 likes
  • Comments 14 comments
  • isolator
  • pwm
  • tl494
  • isolation
  • optoisolator
Related
Recommended

Very Low-Cost Pulse-Width Modulation (PWM), and Isolated Analog Measurements

shabaz
shabaz
24 Nov 2023

This is just an ultra-quick blog post about an interesting circuit.

I wanted to be able to measure an output up to about 1kV, and so I really desired the measurement to be isolated! I also wanted it to be cheap. This blog post shows the method I won’t use in the end for my specific use case, but is still worth documenting because it could be useful for other projects that either require cheap PWM or require very low-cost isolated measurements. This method costs under £1/$1. The result is not very instrumentation-grade at this price!

The method involves converting the analog signal of interest into PWM and then using an opto-coupler to send it to the other side (where low-pass filtering can be used to get back the analog signal). PWM can be created with a ramp (sawtooth) signal connected to a comparator chip. The diagram here shows the general idea.

image

A 555 plus a transistor could be used to generate a sawtooth output. However, despite being low-cost, the 555 was missing a comparator function. Op-amps could be used, but I was curious if there was something out there already designed for PWM type of purposes.

Looking around, I realized that a super-low-cost chip already contains the oscillator and comparator! It’s the TL494 , which is an ancient chip but still used in a lot of switching power supplies. Ordinarily, the TL494 generates PWM for driving transformer windings, and the control signals arrive at op-amp inputs on the chip. However, since we are only interested in simple PWM generation, it is possible to force the op-amp outputs low, putting them out of the equation, and instead feed an analog control voltage into a pin called Feedback, as can be seen in the block diagram.

image

 (image source: Texas Instruments website)

In the circuit below (which is pretty much just the test circuit from the datasheet), resistor R2 and the connections to pins 1,2,16, and 15 are used to permanently set the op amp outputs to low.

Components R1 and C1 are used to set the sawtooth oscillator frequency; it is about 12.5 kHz with the values shown. The TL494 requires at least 7V to operate, and there is an internal 5V regulator with an output on pin 14. It is used to provide the pull-up voltage using resistor R3, for the 5V PWM output. There is a spare output which isn’t being used (the CTRL pin is used to select the single-output mode).

image

That’s it! The above circuit costs about £0.70 even in a single quantity since the TL494 is so cheap. For isolation, adding an optocoupler to the output would add another 0.20 to the cost.

image

About the only main drawback* to the circuit is that the PWM duty cycle cannot quite reach zero percent. That’s because the TL494 isn’t intended as a fully general-purpose PWM output. It is intended for power supply applications. The PWM is inhibited from reaching 0% because of a small positive voltage that is added to the input of a pin called DTC (pin 4). There is a trick to forcing the chip to output PWM down to zero percent, but it isn’t straightforward; it needs a small negative voltage applied to pin 4 (this isn’t a documented method, but it seems to work with the TL494 that I tried). Anyway, it’s not always necessary to require 0% PWM for many other applications (for instance, hobby servo control doesn’t require zero percent; by replacing R1 with 47k and C1 with 100nF, the circuit above can be used as a servo tester), so I left the circuit as it is, with just the single supply.

*Actually, another drawback is that the chip requires at least 7V. It would be nice if it operated from 5V.

Testing It

I applied known voltages at the input and measured the output duty cycle using a ‘scope. The results are in the chart below. It was fairly linear between 1V and 3.4V. From the chart, it is clear this is not an instrumentation-grade solution. Nevertheless, it could be suitable for far less demanding use cases, and as mentioned, it’s super-cheap and will provide isolation with a low-cost opto-isolator. I didn't use it in the end because the low-pass filtering has a slow response, at least tens of milliseconds for the PWM rate being used (although there are ways to reduce this). However, that would be perfectly suitable for many applications.

image

Thanks for reading!

  • Sign in to reply
  • shabaz
    shabaz over 1 year ago

    The high voltage measurement boards arrived, and I have soldered one up, to see if there are any glaring errors! Turns out there are. I'll write a separate blog so that it can be tracked outside of comments here!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelkellett
    michaelkellett over 1 year ago in reply to shabaz

    Looks good. I'll be interested to see the boards.

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 1 year ago in reply to michaelkellett

    Thanks for spotting that! I've added that in.

    I also added a -5V generator (TPS60403) so that only a single +5V source is needed to operate it all. 

    image

    For the optional enclosure, there is an SMA connector added to the output, simply because that's smaller than BNC and cheap+easy to break out to wires using another socket at the end of the cable, or back to BNC with an adapter.

    image

    I need to re-do the traces, but I have done a first pass to ensure it can be routed:

    image

    There's no connector for the HV input, it could either be wires, or panel-mount banana sockets, although shrouded ones probably won't fit in this enclosure. I think I'll just use wires and no connector.

    image

    I'll get it tidied during the week, and then place the board order (hopefully it arrives before Xmas!).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • michaelkellett
    michaelkellett over 1 year ago in reply to shabaz

    The only change I'd suggest now is to improve the noise and stability of the bias connections via R14 and R15.

    Because of the switcher the stability and noise of the +5V (even with filters) won't be that good.

    I think I would use a 4.096V reference like MCP1541T-I/TT to provide the bias voltage. (This part has about 1mV pk-pk noise and costs about £0.80. Quieter and more stable parts exist for more money, but this is just about good enough for 12bit ADCs)

    I may be going over the top here.

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 1 year ago in reply to michaelkellett

    Hi Michael,

    Thanks for the feedback! This was great, I've implemented all the changes you mentioned. I had a rethink about the input potential divider (the input was originally not wired to the GNDA directly for a bit of current limiting in case there was some issue, but there's no benefit to doing that since the circuit is isolated anyway, so I've removed that), and especially the op-amp input capacitance, which reduces the bandwidth a lot, and the OPA192/197 are already pretty low capacitance, so R6 has been reduced to 100k, which will then require the buffer amp to have a gain. I've tried simulating bits of it, and if there's not much extra capacitance added at that input, then the -3dB bandwidth might reach 125 kHz. The LEDs are now biased on using R14 and R15, and I've added the filtering too.

    image

    I'm quite excited, it will be nice to have an isolated HV measurement method! I've not thought about enclosure or types of connectors (e.g. maybe banana or BNC on the output - or simply pin headers, to allow any arbitrary connectors to be wired.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube