Super-imposing a dither / ripple over PWM

Discussion in 'The Projects Forum' started by Jim_cliff11, Apr 3, 2016.

  1. Jim_cliff11

    Thread Starter New Member

    Sep 5, 2015
    18
    0
    Hi,

    I am controlling a proportional coil on a proportional hydraulic solenoid valve. My circuit is very basic but it works well using the Arduino Uno and a MOSFET transistor. I am currently running PWM to control my coil at a 122hz frequency. You can see my attached circuit.

    In order to reduce stiction and hysteresis inside the valve I am trying to introduce a dither / noise ripple over my PWM control as shown below.

    [​IMG]

    I know at low frequency PWM dither is produced naturally as a by-product of PWM. (see below).
    [​IMG]

    However my PWM duty cycle varies depending on an input from a potentiometer and so it is impossible to control the dither frequency and amplitude independently of the PWM frequency and duty cycle. I am wanting to run my PWM frequency much higher eg. 3kHz, but superimpose a constant and periodic dither of 140Hz in which I can control the frequency and amplitude separately.

    I've already done quite alot of research into this and have a few ideas. The first is a software induced dither, creating small fluctuations in the duty cycle using code such as this.

    Code (Text):
    1. analogWrite(pinNumber, dutyCycle+random(-x,y));

    The problem is, I am still unable to control the frequency of the dither.

    My other option is some form of hardware method. So basically using an additional mosfet with its gate controlled by 3kHz PWM, but also its source linked to a separate PWM pin operating at 140hZ @ 10% duty cycle of the 3kHz PWM pin. The drain from this MOSFET is then used to drive the gate of a second MOSFET? See my attachment PWM Mosfet config.

    Is this a feasible method of achieving my goal? Or has anyone had luck introducing dither in other ways?

    Many thanks,
    Jim
     
  2. dannyf

    Well-Known Member

    Sep 13, 2015
    1,775
    360
    1. generate your 122Hz primary pwm;
    2. generate a 70-350hz secondary pwm;
    3. Use the primary pwm to gate the 2ndary pwm to obtained a gated 2ndary pwm;
    4. Use an opamp to add the two together.
    5. done.

    quite frankly, it seems quite convoluted to have an essentially analog pwm wave.
     
  3. crutschow

    Expert

    Mar 14, 2008
    12,993
    3,229
    Can't you modulate the output from the pot to get your required dither frequency and amplitude, either by an analog op amp or in software, and use that to generate the PWM signal?

    For example, if the pot output is converted to a digital signal by Arduino then I would think you can add and subtract a value to that digital signal with the amplitude and frequency desired for your dither before it's converted to the PWM signal.
     
  4. Jim_cliff11

    Thread Starter New Member

    Sep 5, 2015
    18
    0
    Thanks for the replies guys,

    Danny I have a few questions regarding your suggestion:

    1. Why would I generate a 70-350hz secondary PWM? Would this PWM not be the primary current controller @ 3khz? And the dither the secondary 122hz PWM?
    2. Can you explain a little more on your MOSFET configuration and the circuitry configuration as If I'm honest I don't fully understand.
    3. Would the OP AMP go after the mosfets?

    I'm wanting to keep the square wave of the current controlling PWM but just super-impose a ripple / dither.

    Crutschow, same again really, sorry to sound clueless as to your suggestion, but I'm still learning and could use a little more clarification regarding your comment.

    Thanks and sorry for the questions.
    Jim
     
  5. crutschow

    Expert

    Mar 14, 2008
    12,993
    3,229
    Okay, I'm not familiar with Arduino programming or its capabilities, so my suggestion may or may not be doable with that device. But I assume the analog input A/D converter converts the input voltage to a digital word and that word is then used to generate a PWM duty-cycle proportional to the word value.
    So if you add or subtract some fixed value from that word you will change the PWM duty-cycle, and if you add or subtract that fixed value at a 140Hz rate then you will get an amplitude dither on the PWM average output voltage, as you want.

    Generating the frequency of the dither will likely require some delays in the loop that adds and subtracts the value from the A/D word to get a loop that takes 1/140 seconds to complete. I assume that there are some delay type of programming commands that can generate such a delay in the Arduino.
    The value of these delays may require some experimentation to get the timing right.

    That all make sense?
     
  6. mah

    Active Member

    Mar 15, 2010
    276
    2
    in another words ,do you mean a loop that takes 1/140 seconds of add and subtract then use the result value to generate secondary dither pwm frequency?
     
  7. mah

    Active Member

    Mar 15, 2010
    276
    2
    the PWM port of arduino give 0 or 5 Volt so the dither can't be generated inside this Microcontroller as it will interfere with the primary PWM, you can't control its amplitude except the arduino has analog output.
     
Loading...