Need to amplify a hardware filtered square wave - Page 1
Forum section: electronics / beginners

author: MarkM
author_rank: Regular Contributor
timestamp: October 25, 2015, 08:17:40 pm
content: I'm outputting a square wave with one MCU pin. I'm reading the peak values and using the duty cycle to calculate the RMS voltage of the output. That works great with no issues.What I'm trying to do now is to output a second square wave, filter it via RC filter and amplify that signal to match the actual RMS voltage that was calculated to be read with a standard 3 wire mini voltmeter. These have about 500ms startup/refresh time, so there's plenty of time for some decent filtering. The project is powered with a lipo pack and the actual load(resistive) is heavy enough that the input voltage can sag quite a bit if that helps.PS, using any kind of display would go against the idea. Trying to use a voltmeter.Any ideas for this?

author: TheUnnamedNewbie
author_rank: Super Contributor
timestamp: October 25, 2015, 08:46:23 pm
content: I'm quite confused as to what it is you are trying to do.Why are you filtering the signal? do you want to produce a sine wave with RMS value equal to the RMS value of the of the square wave?

author: MarkM
author_rank: Regular Contributor
timestamp: October 25, 2015, 09:47:25 pm
content: I want to produce as close to a flat DC signal of a calculated RMS voltage that was previously calculated.The whole idea is I'm trying to read a higher DC signal with a mini voltmeter than the MCU(ATtiny) can output. If it can work without filtering that would be great, but these voltmeters might have an issue with that. Maybe not with some of them, though. Either way, the Attiny is running at 5v, so 0-5v(maybe filtered) PWM. I need to amplify that PWM output to about 10v and hopefully filtered to the point where these little Chinese meters can read the signal with no problem.It might be easier to think about with one output. Think about a simple Attiny(5v) outputting a filtered signal that goes from 0-10v.

author: dom0
author_rank: Super Contributor
timestamp: October 25, 2015, 09:52:10 pm
content: I dunno if they're fundamentally different today, but almost every older digital meter has either +- 200 mV (for a display of +-2000) input scale and literally every other "range" is done by input dividers. So if you bridge/remove these, typically one or two, resistors, you can just divide your filtered PWM down.Tip: The PWM output voltage in itself depends on the supply voltage, and the output after a RC lowpass depends on the loading. Feed the filtered PWM back into an ADC pin and servo the PWM. This way you eliminate both supply and load dependence.

author: retrolefty
author_rank: Super Contributor
timestamp: October 25, 2015, 09:54:26 pm
content: QuoteThat is usually done using the output pin to drive a npn or nfet (through a base or gate resistor) that is wired to the higher desired DC voltage. A collector (or drain) series resistor is also used. Then you will have a PWM signal having a larger amplitude that you can filter as desired.

author: MarkM
author_rank: Regular Contributor
timestamp: October 25, 2015, 10:07:46 pm
content: Quote from: retrolefty on October 25, 2015, 09:54:26 pmI can see this working, but the battery will going from unloaded to loaded while the heavy load is switching with a varying duty cycle. I don't know about microcontrollers enough to make that happen, but I haven't actually tested it yet. Any tips?