Common ground issue in voltage feedback - Page 1
Forum section: electronics / projects

author: 3dgeo
author_rank: Frequent Contributor
timestamp: June 08, 2018, 03:57:51 pm
content: Hi,in my circuit Mosfet PWM down voltage from 50V to ~24V, but PWMed voltage fluctuates, I would like to control PWM according to feedback like this:But common ground "breaks" voltage feedback, so my solution for now is:Is there a better solution? If not is there a recommended opto isolator for this purpose?PWM – 32kHz, H11L1M should be fast enough, tho it inverts logic so not very suitable unless I invert signal again.Thanks in advance

author: ajb
author_rank: Super Contributor
timestamp: June 08, 2018, 06:47:11 pm
content: Without a filter, PWM does not reduce the voltage, it just chops it up so that theaveragevoltage is lower. So even if you do directly measure the output you're not really going to get the results you want--you'll just see the minimum and maximum voltages alternately. If you're driving a capacitive load and there's some series impedance, (which is a de facto filter), then you can at least measure the minimum voltage on the load and you do a constant on-time control might work okay depending on the load characteristics. If you're driving an inductive load, then you'll just see the voltage flip between the supply voltage and the forward voltage of the MOSFET's body diode.For a simple load, like a resistor, the amount of power delivered to the load by a PWMed voltage is proportional to the duty cycle, so there's not much benefit to feedback since you can set the duty cycle to whatever you want and be confident in what that means for the load. If you really want to regulate the output voltage, then you need to filter the PWM (essentially build a buck converter).Anyway, what you've drawn will more or less work as long as the 5V supply and the MCU are isolated from the 50V supply and the load. Using a high-side switch instead of a low-side switch will give you a simpler topology where both supplies to share a common ground. Alternatively, you could use a differential amplifier to measure the voltage between the 50V supply and the bottom end of the load. This can be as simple as an op-amp and four resistors, provided the resistors are sufficiently matched (otherwise the common mode rejection goes out the window).

author: b_force
author_rank: Super Contributor
timestamp: June 08, 2018, 06:55:39 pm
content: Also, I don't know how fast you're switching, but optocouplers aren't always fast enough.Lol, never mind, I missed something, but the other solution still stands of course.Another option is using a capacitive isolated solution, but in that case there are all-in-one drivers that have the input isolated from the output.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: June 08, 2018, 08:48:16 pm
content: Quote from: ajb on June 08, 2018, 06:47:11 pmLoad is 2 DC motors, is there a simpler solution? (I'm not that advanced in this) For example adding small cap to smooth voltage divider output? Or I should just set PWM below 24V and forget feedback?

author: jbb
author_rank: Super Contributor
timestamp: June 08, 2018, 10:00:38 pm
content: What could be good is a differential amplifier (aka diff amp), seehttps://www.electronics-tutorials.ws/opamp/opamp_5.html. It can get your 50V signal down to your micro controller ground.Please note that this kind of circuit has a couple of pitfalls.First, you need to match R1=R2 and R3=R4 well (use 1% or better resistors. 0.1% is good).Second, you need to make sure you don't push too much voltage into the opamp inputs. You can use the tutorial above to work out node voltages Va and Vb.Third, the circuit you have will output square waves. That means you will get square waves (with some distortion) out of the diff amp - is that what you want? What are you trying to detect? Average voltage, peak voltage, the actual waveform?Finally, you will need a flyback diode across the DC motors. Have you heard of these?Say you're working with a 5V supply.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: June 09, 2018, 01:24:29 am
content: Quote from: jbb on June 08, 2018, 10:00:38 pmI apresheate your very comprehensive reply, I was thinking about upamps, but it's way too complicated for what I'm trying to do and I'm not good with them.Yes, I'm using diodes. I'm trying to measure average voltage.I think I'll just go with SFH6326 inverting optos and will replace TC4420 with TC4429 (it inverts output), hook up oscilloscope to Feedback and try bunch of caps to smooth oscillation but still keep fast enough response time (I don't need very fast response, ~0.25s is good enough).

author: ajb
author_rank: Super Contributor
timestamp: June 09, 2018, 06:38:39 am
content: There's no real point in voltage feedback for your application. The average voltage is simply the supply voltage multiplied by the PWM duty cycle, so since you're generating the PWM from your microcontroller you already know what the average voltage is (assuming your supply voltage is fixed--if not, then you can measure that quite easily).If you want any sort of feedback, it might be motor current, since that way you can get an idea of the load, but even that is optional depending on the application.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: June 10, 2018, 11:04:33 am
content: Quote from: ajb on June 09, 2018, 06:38:39 amProbably You are right, but with same PWM I get 2 different voltages while motors go up or down, thats why I want feedback, but I guess simple fixed PWM will do the trick and I probably should use 555 timer instead of MCU for this, shouldn't I?

author: Zero999
author_rank: Super Contributor
timestamp: June 10, 2018, 01:17:44 pm
content: Quote from: 3dgeo on June 08, 2018, 08:48:16 pmNo don't do that. A capacitor will cause a huge current to be drawn, every time the transistor turns on, resulting in a transistor dissipating a lot of power. A filter could be made using an inductor, as will as a capacitor but it would have to be after the free-wheeling diode.Quote from: 3dgeo on June 10, 2018, 11:04:33 amWell the motor generates its own voltage, proportional to the speed. It's possible to low pass filter the output and use that as feedback to the controller, but I don't think it would help much. Is it possible to add an encoder or tachometer to the motor's shaft? You could then directly monitor the motor's speed and position and use that as feedback.

author: 3dgeo
author_rank: Frequent Contributor
timestamp: June 11, 2018, 03:22:51 pm
content: Quote from: Hero999 on June 10, 2018, 01:17:44 pmBoth motors already have rotary encoders, but I can't see how this would help, both motors spin at same speed (it's a sit/stand desk legs), but up/down voltage differs in few volts, I would like to make them even. To be honest it's probably only a „cosmetic“ issue, but I'm designing custom PCB and would like to eliminate it (original PCB did not address this issue).

author: Aspin
author_rank: Newbie
timestamp: June 12, 2018, 04:49:20 am
content: Hi 3dgeoMeasure the voltage across the switch (IRF3710_1) and use a LC to smooth it out.If you know what the V drop is across the switch is then you know and can control the drop across the Motor/LoadAspin

author: Siwastaja
author_rank: Super Contributor
timestamp: June 12, 2018, 05:49:22 am
content: Topics like this come up very often. The default answer would be:You need to realize you are building a motor controller, and shape up your search terms for that.When you compare a DC motor controller and a generic "load PWM", there are more things that are different than similar.At least, you'll need:- A half bridge instead of a single switch (so at least a well laid out FET-diode combination)- Motor (= inductor) current sense and feedback of some sort- Good power layout- Good DC link bypassingWith smallest, most inefficient toy or cassette player motors, you can do pretty much the wrong things and still get something out of it, but knowing the right terms will help you to do the right thing nevertheless.When the discussion has diverted to adding an LC filter to a motor controller (not as an additional filter, but some kind of "necessary" sauce to make it work), it's time to stop, take a deep breath, think, and learn.