Connect with us

Convert PWM output to variable frequency

Discussion in 'General Electronics Discussion' started by Cirkit, Jan 27, 2016.

Scroll to continue with content
  1. Cirkit

    Cirkit

    124
    10
    Oct 28, 2015
    I have a circuit which outputs a PWM signal to control a motor's speed in response to an input sensor. The sensor amplifier, feedback circuit and PWM signal are based on a series of Op-Amps.

    I'd like to convert the PWM signal to a frequency variation to control a stepper motor driver based on a TI DRV8834. Is there an easy way to do this in hardware without a micro-controller?

    Thanks.
     
  2. Alec_t

    Alec_t

    2,904
    784
    Jul 7, 2015
    You could perhaps use something based on this sim, where V2 is a control voltage derivable by integrating the PWM signal :-
    VFO.PNG
     
    CDRIVE likes this.
  3. Fish4Fun

    Fish4Fun So long, and Thanks for all the Fish!

    464
    105
    Aug 27, 2013
    @Alec_t....hrmmm, let me see if I understand what you are doing....you are using D1 and C1 to turn the Schmitt trigger into an oscillator when the PWM signal is LOW....is this correct? That is going to make for a very jerky/noisy stepper! LoL. But I like the thought! I am NOT a huge fan of 555 timers.....but I felt certain someone was going to pony up one of the 10,000 stepper driver schematics based on them....So...hats off for an original approach!

    @Cirkt...so Alec followed your directions....no micro-controller...but I suspect if you go that route you are going to be shocked to find out how noisy a stepper can be! I am curious why you specify "without a micro-controller"....for less than $1 a micro controller could do everything you want......Anyway, in an effort to solve this as per your stipulation: I would suggest you convert the PWM signal to a voltage and then use a Voltage to Frequency chip (Look @ the VFC320CP https://www.digikey.com/product-search/en?vendor=0&keywords=VFC320CP ) The project is going to cost about 10X more than a functionally superior micro-controller based circuit....Here is a link to a single chip on ebay: http://www.ebay.com/itm/Burr-Brown-...374563?hash=item3d07883ee3:g:HBAAAMXQrNtR0nQ8 (Buy it now $7 + $3 Shipping) You should be able to design a circuit that will give you a reasonable speed range based on just about any PWM signal...but it sure is an expensive way to go, LoL. The VFC320 is easy to work with and very versatile....just not a high volume chip any more....Radio Shack use to sell them way back when, but with the advent of micro-controllers they have fallen into the "specialty" realm....

    Good Luck!

    Fish
     
    Harald Kapp likes this.
  4. Cirkit

    Cirkit

    124
    10
    Oct 28, 2015
    Thanks both for your replies. I know that I could implement the whole circuit post the bridge sensor amplifier using a micro-controller however, I am still learning how to program them and am not very confident in doing so yet.

    Anyway, if I take the signal from the bridge sensor amplifier and feed that into a voltage-frequency converter, would that work? I don't necessarily need to use the PWM output it's just how the DC motor is currently driven which I am replacing with a stepper motor for precision. Incidentally, I didn't notice much noise from the stepper motor but that could be because I'm using a precision 3V one?

    Are there any stepper motor drivers that work with a PWM input which will work with a 3V stepper motor?
     
  5. Fish4Fun

    Fish4Fun So long, and Thanks for all the Fish!

    464
    105
    Aug 27, 2013
    Hey Cirkit!

    Use the Digikey link to get the data sheet for the VFC320CP....it is a very straightforward chip to use....and it does exactly what you would think it does...converts a voltage to a frequency (or a Frequency to a Voltage)...RPM in a Stepper motor driven by a stepper driver is determined by the frequency of the step input line....if you already have a feedback system that outputs either a PWM signal or better yet a native analog voltage then a V/F-F/V chip is a natural choice....(well, a natural choice second to a micro-controller)....I will say that if you have ANY interest in micro-controllers NOW would be the time to "play".....Something like an ATTINY2313A and a hand full of ASM instructions and you are off to the races....(NOTE: the ATTINY2313A does NOT have an A/D converter built in, so you would need the PWM output from your existing system....a more robust micro-controller with an on-board A/D converter could use either PWM or your analog voltage). All the micro-controller needs to do is measure the "On" period of the PWM signal and then use a hardware PWM timer to create the pulse train for the stepper driver....even in ASM it should be pretty quick and easy...if you know the particulars on the PWM signal (frequency and pulse-width to RPM) I would be happy to write a quick program that will work....maybe there is someone in the UK close enough to you that might program a chip for you? Or you could go with an Arduino....but that is soooooo much more processing power than you need.....

    Good Luck!
     
  6. Cirkit

    Cirkit

    124
    10
    Oct 28, 2015
    Thanks again for your reply Fish4Fun. I feel at a real disadvantage not being to program micro-controllers :(. I am trying to learn on an MSP430 Launchpad but also have an Arduino Mini.

    I was looking at the Linear Tech. LTC6990 IC which is a voltage controlled silicon oscillator. The stepper motor has around 3000 steps for a full rotation but I need to operate it around sub 1kHz for a reasonable rotation rate. If I try to feed the driver with a frequency above around 2.5kHz the motor stalls or fails to start? Too low and the motor doesn't rotate either? I have configured the driver IC (TI DRV8834) to full step mode.

    I don't need to use the PWM signal at all - that was just to drive a DC motor which I am no longer using. So in theory, I could take the output from the bridge sensor amplifier and feed it into a voltage to frequency converter and then into the stepper motor driver.

    If I knew how to program a micro-controller proficiently, I could also replace the bridge sensor and amplifier with a digitally compensated sensor with I²C/SPI output :cool:.
     
  7. Alec_t

    Alec_t

    2,904
    784
    Jul 7, 2015
    Not quite. R1/Q1 form a voltage-controlled constant-current source for charging C1 towards the negative rail. When C1 has charged to the lower threshold point of the Schmitt trigger, the trigger output goes high, discharging C1 back towards the positive rail via D1. Thus a sawtooth-wave oscillation is generated. This is converted to a 50% duty-cycle square wave by the 4013 flip-flop. Frequency is proportional to the controlled current through C1. In other words the circuit provides a voltage to frequency converter.
     
  8. Cirkit

    Cirkit

    124
    10
    Oct 28, 2015
    That is an ingenious circuit Alec_t! Still trying to work out how the capacitor is discharged via D1?

    Edit: I think I've worked it out? The Schmitt trigger is inverting so as the capacitor charges to the lower threshold point, the output goes high and the lower leg of the capacitor is taken high via the diode.
     
    Last edited: Jan 29, 2016
  9. Alec_t

    Alec_t

    2,904
    784
    Jul 7, 2015
    Yup, you've worked it out ;). The discharge current via the diode is limited by the internal resistance (a few hundred Ohms) of the inverter. The charge current via the transistor needs to be less than this discharge current.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-