TrueRMS Digital Voltmeter - Page 1
Forum section: electronics / projects

author: septer012
author_rank: Regular Contributor
timestamp: December 10, 2009, 08:13:17 am
content: Gotta design one, so I can be considered for an internship. Anyone have any advice? I am researching, but if anyone knows of any good white papers, I would love to hear from you!!!For instance, I was reading about but couldn't quite locate the necessary steps to compute a Crest Factor.Thanks

author: EEVblog
author_rank: Unknown
timestamp: December 10, 2009, 09:43:43 am
content: Analog devices make True RMS converter chips:http://www.analog.com/en/other-products/rms-to-dc-converters/products/index.htmlThey have plenty of info on how they work in the datasheets and other white papers:http://www.analog.com/en/training-tutorials-seminars/books-seminars/resources/other-products/rms-to-dc-converters/listing.htmlandhttp://www.analog.com/en/technical-documentation/resources/other-products/rms-to-dc-converters/index.htmlDave.

author: Zero999
author_rank: Super Contributor
timestamp: December 10, 2009, 04:52:03 pm
content: https://www.eevblog.com/forum/index.php?topic=106.msg889#msg889

author: septer012
author_rank: Regular Contributor
timestamp: December 10, 2009, 04:55:00 pm
content: Wow Dave thanks alot. I was on Analog.com for an hour yesterday and didn't find any of that. I was trying to learn about Integrating A/D converters because I read that was how most current cheap meters are made. Reading alot on maxim-ic and agilents websites.The paper question really reads "Design a RMS Voltmeter that uses a microcontroller" I am just trying to make mine a little more impressive. So I can measure triangle waves, squarewaves, higher then powerline frequency, etc. Hopefully it works.

author: septer012
author_rank: Regular Contributor
timestamp: December 10, 2009, 05:17:33 pm
content: Thanks Hero, I just re-looked at that thread and it is helpful,To be honest the first time I looked at that thread I left when people started talking about transformers because they dont use transformers in digital meters. But now that I look a little deeper it is alot of good info for what im doing. Thanks.

author: EEVblog
author_rank: Unknown
timestamp: December 10, 2009, 08:47:19 pm
content: Are you actually allowed to use a True RMS converter chip? If so your job is easy, you just read the DC output of the True RMS chip with the PIC's ADC.Otherwise you have to sample at a high rate and get your PIC to do the RMS calculations. That could either be done on a "snapshot" of data, i.e. sample the input signal and then do the processing (easiest), or do a continuous "moving window" type display with background sampling (harder).What is your input voltage range(s)?Dave.

author: Zero999
author_rank: Super Contributor
timestamp: December 10, 2009, 11:26:29 pm
content: I'm not expert with this kind of thing but is it not possible to sample at a lower frequency over a long period of time?Maybe that would be as as accurate as sampling at a high frequency.

author: Simon
author_rank: Unknown
timestamp: December 11, 2009, 09:37:09 pm
content: I think basically the more samples taken per second the more accurate measurements will be and the higher the frequencies that can be accurately measured

author: septer012
author_rank: Regular Contributor
timestamp: December 12, 2009, 06:01:48 pm
content: Really it doesn't say. I could use a PIC and do the math but the chip will most likely give me better results. I got almost a week break from the project because I emailed the guy and told him I had prior obilgations (finals) this upcoming week.I think im going to use one of those analog devices chips to a PIC18F A/D port (I will have to decide if 10 bit is good enough) I have to figure out how to switch between the Resistor (range) Load on the input and also notify the PIC which of the ranges im in.

author: qno
author_rank: Frequent Contributor
timestamp: December 12, 2009, 10:25:50 pm
content: Why not bet on both horses?Make the software for the RMS calculation and order the chip.It will take some tinkering to get the circuit working.10 Bits is 1024 resolution or a bit better than 0.1% because RMS is always a positive number.With some errors in the circuit you can shoot for a 1% accuracy.

author: Zero999
author_rank: Super Contributor
timestamp: December 12, 2009, 11:35:31 pm
content: You'll need to put a precision rectifier before the ADC input if you want to meause it using a PIC.

author: qno
author_rank: Frequent Contributor
timestamp: December 17, 2009, 10:10:48 pm
content: Or you can use a -2.5 to 2.5 range having your zero point half way the range.

author: Zero999
author_rank: Super Contributor
timestamp: December 17, 2009, 10:22:37 pm
content: That will work but a precision rectifier effectively adds another bit to the level of accuracy and can be easily DC coupled to the input.

author: septer012
author_rank: Regular Contributor
timestamp: December 18, 2009, 08:39:07 am
content: I will have to research all of this.How did you measure negative voltage on a Positive ADC?

author: jahonen
author_rank: Super Contributor
timestamp: December 18, 2009, 04:35:38 pm
content: Quote from: septer012 on December 18, 2009, 08:39:07 amThis is usually done with biasing the input voltage zero point on mid-scale of the ADC range, e.g. if your ADC input range is 0-5 V, input zero volts produces 2.5 volts on the ADC input. Full negative input then makes 0 volts and full positive 5 volts at the ADC input, respectively.As far as the accuracy is concerned, I'd keep the analog portion as simple as possible. Simple front-end with protection, scaling and perhaps filtering is optimum solution. Each component you put there, adds (frequency dependent) error, drift, noise etc. Then do all the processing possible in the digital domain. Digital computation is exact and predictable, analog is not.Regards,Janne

author: Zero999
author_rank: Super Contributor
timestamp: December 18, 2009, 11:07:39 pm
content: I must add that an AC coupling capacitor is required to couple the AC signal to the input.Here's a schematic for a precision rectifier, it's more complicated but has the advantages of better precision and it's DC coupled so it won't reject DC signals.Source: CA3140 data sheet.

author: qno
author_rank: Frequent Contributor
timestamp: December 21, 2009, 01:03:25 pm
content: There are 2 issues with the circuit.You need to connect the output to a high impedance load. It will not drive an ADC correctly.It is slew rate limited.

author: jahonen
author_rank: Super Contributor
timestamp: December 21, 2009, 07:40:20 pm
content: Rectifier is not required at all, a simple resistor network shown here will accomplish the negative inputs DC-coupled quite easily, here is one for -10…+10 volts in and 0-5 volts out. Of course, one would still need a buffer for ADC driving but that is required more or less anyway.

author: Zero999
author_rank: Super Contributor
timestamp: December 21, 2009, 10:19:34 pm
content: Quote from: qno on December 21, 2009, 01:03:25 pmWhat's the bandwidth and input impedance of the ADC?EDIT: The resistor network does look like the simplest approach.

author: septer012
author_rank: Regular Contributor
timestamp: December 21, 2009, 10:38:36 pm
content: I am going to try to design with this flowchart:measurement probes => Resistor range select => Analog Devices AD636 TrueRMS/DBout => Jahonens Midpoint scaler => High impedence buffer? => PIC18F4550 A/D.Thank you Jahonen, I really had no idea how to do that!Hero, I was just going to try to keep it easy and use one of the 13 onboard, 10-bit ADCs on a Microchip PIC18F4550. I am looking through the datasheet for bandwidth and input impedance. (maybe these are characteristic measurements they require you to measure yourself?)Thank you all!

author: jahonen
author_rank: Super Contributor
timestamp: December 22, 2009, 05:50:11 pm
content: If you are using an AD636, then you shouldn't need the scaling network, at least for the RMS output. The RMS output is never negative. An AD636 can produce buffered unipolar output, as AD636 contains internal buffer amplifier (in=pin 7 and out=pin 8) perfectly capable of driving the ADC directly. Only caveat there is that the buffer is an emitter follower. Thus it can't sink current. See datasheet fig. 5 and fig. 13. The dB output however, requires level shifting. It also seems to have a quite large temperature coefficient.Nasty thing about ADCs is that their input impedance is often nonlinear. When the sampling switch closes, the apparent input impedance may drop considerably. Although seemingly low-bandwidth circuit, you might end up with quite fast buffer anyway to reduce the settling time. You might need a buffer if the signal goes also somewhere else. Otherwise, the ADC sampling can cause noise (glitches) on the signal. Figure 21-3 in the PIC datasheet shows the ADC input structure. PIC ADC has several kilo-ohms of internal series resistance (Rss+Ric).There are some caveats using the AD636 but it can give greater bandwidth than just plain PIC ADC. I'm not so sure if AD636 will improve the accuracy, as the ADC is in the loop anyway. Direct digital computation is better at low frequencies and has better temperature stability. Perhaps just using the MCU ADC could work up to some kHz, if sampling rate would be at least 20 kHz. The cost is of course greatly increased computation requirement, but digital hardware is amazingly cheap nowadays.Regards,Janne

author: septer012
author_rank: Regular Contributor
timestamp: December 22, 2009, 07:39:12 pm
content: You know Janne that makes more sense, its simpler.Probes > Range R Network > AC Coupling capacitor > Midpoint Scaler > Buffer > PIC ADCMy PIC will know range selected by circuit logic.I will Sample on the ADC as fast as I can. Store data per nyquist and compute 1) square 2) mean 3) square root of the meanVRMS = [ Avg(v^2) ] ^-1See any flaws in that?I will also measure DC Volts by taking a ADC reading before the AC Couple.I should be able to display four things: VRMS , DC_offset , VRMS+DC_offset , Crest factor

author: jahonen
author_rank: Super Contributor
timestamp: December 22, 2009, 09:07:48 pm
content: Your concept seems ok to me. You could save the AC coupling capacitor by calculating the DC-offset (take mean of the samples) in software and then subtracting this value from samples before RMS calculation to calculate AC RMS, or you could calculate AC+DC RMS without any additional processing, like on some Flukes. This of course reduces the dynamic range, e.g. it is difficult to measure a 1 mV sine on top of 10 volts DC without using any AC-coupling.Calculations seems fine to me. Crest factor is just ratio of peak to RMS.RMS calculation gives best results (zero ripple per definition) if done for integer number of periods. You might need to perform some form of software trigger to find the period so that you'll know when to start taking the samples and when to stop. Or then just calculate long "enough". High frequencies are not the problem, but very low frequencies will need some thought. Obviously, one would have hard time measuring RMS on something like 1 mHz signal with any methodSome simulations and calculations about this might be appropriate here to estimate the requirements.Regards,Janne

author: septer012
author_rank: Regular Contributor
timestamp: December 22, 2009, 10:55:14 pm
content: That sounds like a simple solution so I don't waste time calculating too many extra ADC sources.Here is what my circuit looks like:http://www.danielbjohnson.net/assets/Uploads/TrueRMS-imagecheck1.pngThe image is very large.I am kind of unsure about the input part but ill think about it.

author: Zero999
author_rank: Super Contributor
timestamp: December 22, 2009, 11:17:39 pm
content: Quote from: jahonen on December 22, 2009, 05:50:11 pmI now can see why the precision rectifier I posted would has problems driving an ADC input. I suppose it can be fixed by adding a buffer but it's not worth it and much easier to use the resistors.Just for future reference: bandwidth wouldn't have been a problem with the op-amp I suggested.

author: jahonen
author_rank: Super Contributor
timestamp: December 23, 2009, 05:42:54 am
content: Quote from: septer012 on December 22, 2009, 10:55:14 pmI don't know if you really meant to buffer the ADC input with 74LS07, but it won't work with analog signals. Use single-supply opamp instead, something like OP777 etc. Also consider carefully the effect of the midpoint scaling network input impedance to divider network, it might have significant effect (just a hunch, I haven't checked it).Regards,Janne

author: septer012
author_rank: Regular Contributor
timestamp: December 23, 2009, 10:43:05 pm
content: I didn't I just couldn't find the right part, but I have now.

author: septer012
author_rank: Regular Contributor
timestamp: December 29, 2009, 08:12:55 pm
content: It does affect the circuit but in simulation it has a linear effect so I can math out a good solution. Now in a real world with temperature differences im sure it wouldn't be a great solution.

author: septer012
author_rank: Regular Contributor
timestamp: December 31, 2009, 10:05:42 am
content: Alright thank you everyone who helped me!I just submitted the final design. If you are interested in what I came up with, with some of your help of course.Daniel-Johnson-A2D-TrueRMS-Voltmeter.pdf

author: migsantiago
author_rank: Frequent Contributor
timestamp: February 03, 2010, 03:10:33 pm
content: Maybe it's too late but here you have an RMS function in C language. It calculates the RMS value from an array. I wrote it using the multiple trapezium discrete integration. I have used it on audio signals on a PIC18 microcontroller and it works perfectly.http://www.todopic.com.ar/foros/index.php?topic=24142.msg238149#msg238149It's written in spanish but the C code is easy to understand.

author: EEVblog
author_rank: Unknown
timestamp: February 03, 2010, 10:40:15 pm
content: Quote from: septer012 on December 31, 2009, 10:05:42 amNice work!Loved the "The problem statement left much to be desired." bit. That's the kind of subtle shit stir I'd do!Dave.

author: septer012
author_rank: Regular Contributor
timestamp: February 04, 2010, 08:23:19 am
content: They never called me back that was alot of work! none the less I found a job doing DSP but getting paid as an Intern.

author: migsantiago
author_rank: Frequent Contributor
timestamp: February 05, 2010, 01:08:04 am
content: Quote from: septer012 on February 04, 2010, 08:23:19 amGratz Man!