text: # Difference between a constant DC and PWM
  
  I was wondering what would you get on subtracting a 12V (From 0 to 12V) PWM (50% duty cycle), from a 12V constant DC source?
  
  I am sorry, english is not my first language. I mean that if from an arduino or a comparator, we connect the output pwm to a motor, and other side of the motor to a 12V source, then what kind of voltage drop can we expect across the resistor.
  
  • What exactly do you mean by 12 PWM (50% duty cycle)? If the peak-to-peak voltage 12 V or is the effective voltage 12 V? Either way, you'll get a square wave, but how exactly it will look like depends on the waveform of that 12 PWM (50% duty cycle). Commented Sep 14, 2013 at 20:16
  • I am sorry. I meant 0-12V PWM. Commented Sep 14, 2013 at 20:24
  • What does subtracting have to do with PWM? What you're asking doesn't make any sense. Commented Sep 14, 2013 at 20:34
  • I am sorry, english is not my first language. I mean that if from an arduino or a comparator, we connect the output pwm to a motor, and other side of the motor to a 12V source, then what kind of voltage drop can we expect across the resistor. Commented Sep 14, 2013 at 20:38
  • Perhaps you could clarify this with a schematic :) (Ctrl-M in the editor)
  – user17592
  Commented Sep 14, 2013 at 21:40
  
  I was wondering what would you get on subtracting a 12V (From 0 to 12V) PWM (50% duty cycle), from a 12V constant DC source?
  
  Well half the time you'd get 0V (12V - 12V = 0V) and the rest of the time you'd get 12V (12V - 0V = 12V).
  
  In fact what the subtraction does is invert the squarewave about a mean level of 6V but, because it has a 50% duty cycle it looks exactly the same.
  
  If instead you had a 30% duty cycle (12V 30% of the time) you'd end up with a waveform that has 12V 70% of the time.
  
  • Wonderful! Is it possible, to do a subtraction with hardware? Can an Op Amp Do it? Commented Sep 14, 2013 at 23:44
  • @Sherby yes an op-amp can do this but choose a fast op-amp (to preserve good fast edges of the waveform) and remember you can't drive a motor directly from 99.9% of op-amps - it needs a power amp to do this or power transistors. Commented Sep 14, 2013 at 23:53
  
  First, if you're going to drive a 12V motor with an Arduino PWM pin, you need to do something like this.
  
  simulate this circuit – Schematic created using CircuitLab
  
  The voltage across the motor will be 0V at 0% duty cyle, 12V at 100%, and 6V at 50%. That relationship is about as close to linear as the real world gets.