MCU based PWM meter input isolation  - Page 1
Forum section: electronics / beginners

author: RoadRunner
author_rank: Frequent Contributor
timestamp: March 05, 2012, 01:36:08 pm
content: hi guysi have posted the same thing on the microcontroller section but only 2 unsatisfactory reply were there.my problem isi have created a PWM meter based on a PIC microcontroller, the software is working fine and very accurate.but my problem is who to isolate the input pin of the mcu from the external circuitry? so that it can't put any load on input signal.the current range of the mcu is about 0.001 Hz to the 6 Mega Hz with at least 0.01% accuracy.optical isolation is not good enough for high frequency like 6Mega Hz.so what are possible ways to do that?

author: Psi
author_rank: Super Contributor
timestamp: March 05, 2012, 02:07:39 pm
content: There are different kinds of isolators than just optical.Digital isolators often use a ultra low powered RF transmitter and receiver separated by an electrical barrier inside the ICDigikey list them under the 'Digital Isolator' sectionHere's a random one i picked that can run up to 150mbpshttps://www.silabs.com/Support%20Documents/TechnicalDocs/Si8410.pdf

author: Unknown
author_rank: Unknown
timestamp: March 05, 2012, 08:17:04 pm
content: Quote from: Gaurav on March 05, 2012, 01:36:08 pmPosting another copy of the thread and complaining about the quality of the previous reply is a good way to earn some goodwill, I guess. People respond much better if you show them who's boss and who is paying their high consulting fees.Quote from: Gaurav on March 05, 2012, 01:36:08 pmFrom 1 milliHertz to 6 milliHertz should be well within the bandwidth of opto-couplers, but the 0.01% is going to be a problem. What does isolation have to do with circuit loading? It's not like it increases the input impedance, they actually draw a fair amount of current, since they need to light an LED.I would go with BoredAtWork's 'unsatisfactory' suggestion from your previous thread. Get an isolated DC to DC converter (or even a separate transformer), stick a micro on the 'hot side', and connect it over SPI/UART via a digital isolator (optical or RF) to another micro on the 'low' side. Transmitting a digital signal across an opto-coupler with almost perfect accuracy is much easier than an analog signal.Analog isolation can be done, Tektronix used a combination of optical (low frequencies) and modulated RF (higher frequencies) in some of their isolators, but these had nowhere near 0.01% accuracy, maybe 1%.

author: Bored@Work
author_rank: Super Contributor
timestamp: March 05, 2012, 08:46:54 pm
content: Quote from: alm on March 05, 2012, 08:17:04 pmNo, I wouldn't go with it. I don't want to be responsible for causing my master unendurable emotional stress because of having an unsatisfying solution.

author: Rufus
author_rank: Super Contributor
timestamp: March 05, 2012, 08:50:36 pm
content: Quote from: Gaurav on March 05, 2012, 01:36:08 pmMeasuring PWM at 6MHz with 0.01% accuracy requires 16ps edge resolution which would be very impressive, but then maybe it really is 6 milli Hertz or maybe you are not measuring PWM, who knows what you have done or are trying to do.

author: RoadRunner
author_rank: Frequent Contributor
timestamp: March 05, 2012, 09:00:07 pm
content: sorry about if i used some hard words in the post but i really i didn't mean like thatand Thats 6 Mega Hz , i mistakenly typed small m interested off capital M

author: Rufus
author_rank: Super Contributor
timestamp: March 05, 2012, 09:05:29 pm
content: Quote from: Gaurav on March 05, 2012, 09:00:07 pmand are you measuring PWM (duty cycle) or just frequency?

author: RoadRunner
author_rank: Frequent Contributor
timestamp: March 05, 2012, 09:12:16 pm
content: i m just measuring duty cycle

author: ejeffrey
author_rank: Super Contributor
timestamp: March 05, 2012, 09:21:51 pm
content: There are logic level optocouplers that are fast enough. Here is a 50 MHz optocoupler:http://eu.mouser.com/ProductDetail/Avago-Technologies/HCPL-7723-020E/?qs=sGAEpiMZZMtd3yBnp8bAgMhsn5Iee23BDeSrfc7UssM%3dYou aren't going to get 0.01% duty cycle accuracy on a 6 MHz signal without some serious effort. Since your non-isolated circuit almost certainly doesn't achieve that, I am not worried.

author: sorin
author_rank: Frequent Contributor
timestamp: March 05, 2012, 11:08:44 pm
content: If you want to measure 6MHz duty cycle with at least 0.01% accuracyyou need a circuit capable to measure frequency higher than 60GHz (6*10^4 Mhz, 0.01%= 10^-4)I think that is impossible!!

author: george graves
author_rank: Super Contributor
timestamp: March 05, 2012, 11:26:28 pm
content: Quote from: alm on March 05, 2012, 08:17:04 pmDon't get your panties in a bunch.

author: Bored@Work
author_rank: Super Contributor
timestamp: March 06, 2012, 12:58:36 am
content: Quote from: george graves on March 05, 2012, 11:26:28 pmGood to see you volunteer to become Gaurav's personal servant.

author: ejeffrey
author_rank: Super Contributor
timestamp: March 06, 2012, 04:48:41 am
content: Quote from: sorin on March 05, 2012, 11:08:44 pmThat is not true at all. You need a circuit with less than 16 picosecond pulse width distortion, but you do not need 16 picosecond rise/fall time. If you are willing to average for a while, you don't need 16 picosecond jitter, and you certainly don't need 60 GHz toggle frequency.

author: RoadRunner
author_rank: Frequent Contributor
timestamp: March 06, 2012, 09:24:54 am
content: I hope we all know how rigol 1052e samples @ 1 giga samples per second with. 6 dual channel adc .I arranged. A lots of circuit to do the same for digital

author: sorin
author_rank: Frequent Contributor
timestamp: March 06, 2012, 05:21:38 pm
content: Quote from: ejeffrey on March 06, 2012, 04:48:41 amare you sure??suppose that the duty cycle is 99.99% or 0.01%What is the impulse duration in that case???Did you know how is measured the duty-cycle??6MHz ~ 0.166us0.166us * 0.01%= 0.166*10^-5 us= 16.6 ps16.6 ps ~ 0.06 Thz = 60Ghz

author: ejeffrey
author_rank: Super Contributor
timestamp: March 06, 2012, 07:44:43 pm
content: Quote from: sorin on March 06, 2012, 05:21:38 pmYes.QuoteMost PWM detectors can't measure all the way down to the extreme limits for exactly this reason. You might get 0.01% accuracy, but only over a range of 5% to 95%.QuoteI have no idea how he measures the duty cycle, but the easiest way is a RC filter and an ADC with its reference voltage connected to the 'high' logic level. With care this can get to the required resolution over a wide range of frequency and duty cycles as long as the pulse width is longer than the rise time.

author: sorin
author_rank: Frequent Contributor
timestamp: March 06, 2012, 08:33:12 pm
content: Quote from: ejeffrey on March 06, 2012, 07:44:43 pmI doubt that this method is accurate, because the capacitor and the resistor don't are ideal, so the voltage vs duty cycle don't is linear curve.maybe with this method you can get 0.01% resolution but in impossible to get 0.01% accuracy.the only method that I know to measure precise duty cycle, is to use the timer of PIC, or the equivalent mode using a reference frequency and a timer. (I read this in my school book)

author: sacherjj
author_rank: Frequent Contributor
timestamp: March 06, 2012, 08:48:38 pm
content: Convert input to pulse train. Pulses to drive a counter. Count over a fixed period. Do the math. -> Period.Then you just need an accurate time base. If you were to try to measure the exact period of only one cycle, then yes, you need 60 GHz response. But the signal is repetitive, so you do what engineers do well, you cheat. Use multiple cycles to measure a single cycle.(The OP stated that his circuit it working, so it is obvious that it can be done.)Since you are dealing with a reoccurring signal, you now don't care about what effects your protection circuity has on the input (within range).I'm assuming you are looking for something like a high impedance resistor divider that goes into an op amp. This can then drive an opto isolator. I'm seeing tons of these with > 6 MHz capability.

author: sorin
author_rank: Frequent Contributor
timestamp: March 06, 2012, 09:06:04 pm
content: Quote from: sacherjj on March 06, 2012, 08:48:38 pmfor what I know , use multiple cycles to measure a single cycle is aplicable only if the signal is sinusoidal.

author: sacherjj
author_rank: Frequent Contributor
timestamp: March 06, 2012, 09:23:30 pm
content: Quote from: sorin on March 06, 2012, 09:06:04 pmIt is applicable for any type of signal if the delay to rise and delay to fall past your detection level is the same. You are going from signal to digital. As long as you convert the same position of every signal to a 1 and the same position to a 0, delays in the conversion and type of signal don't matter. You will still be counting the number of times that you are seeing a 1 and 0 pair. This could be an actual digital 1 and 0 pair in, a triangle wave, a sine wave, or whatever. If it is periodic, you can measure the period.

author: sorin
author_rank: Frequent Contributor
timestamp: March 06, 2012, 09:57:30 pm
content: Quote from: sacherjj on March 06, 2012, 09:23:30 pmtheoretically, yes is possiblebut...how many sample rates did you need??how many cycles did you need?I think that, the math is very more complicated than the sinusoide sampling.

author: sacherjj
author_rank: Frequent Contributor
timestamp: March 07, 2012, 12:12:22 am
content: Quote from: sorin on March 06, 2012, 09:57:30 pmIf your digital conversion is converting the waveform's 0 to 1 transition at the same point in each cycle, then a period calculation is simply finding the number of 0 to 1 transitions during a certain time. You can have as many cycles as you need to be as accurate as required, driven by the accuracy of your timebase.1 seconds of samples is too many for 6 MHz, but not too many for 4 or 5 Hz.