1
\$\begingroup\$

I would like to create a PWM generator with a 555 timer (like suggested here), but I would like to be able to adjust the duty cycle with a microcontroller. I would simply use PWM from the microcontroller, but I need a high frequency as I am driving motors and they produce a tone with the frequency of the PWM. This happens to be audible when using PWM from the microcontroller. (The frequency is only 490Hz)

Please note that this signal will not directly drive the motor, as it will be fed into a controller which drives the motor.

What would be the best way to accomplish this?

\$\endgroup\$
  • 4
    \$\begingroup\$ Why can't you generate a faster PWM on your microcontroller? \$\endgroup\$ – jonk May 12 '18 at 20:26
  • 1
    \$\begingroup\$ @jonk 490Hz is what you get when you use the analogWrite() function on an unmodified Arduino. \$\endgroup\$ – Hearth May 12 '18 at 20:34
  • 4
    \$\begingroup\$ @Felthry So it's just a library code problem? Don't use the library. Write some actual code. \$\endgroup\$ – jonk May 12 '18 at 20:34
  • 1
    \$\begingroup\$ @JohnLeuenhagen I'm confused. Looks like Johnny-Five runs on an RPi. Is there a 2nd micro system here? Or just the one? ... Better yet, why don't you DIAGRAM what you have. Bits and pieces are coming out in comments that should be clearly laid out in the question. \$\endgroup\$ – jonk May 12 '18 at 20:37
  • 3
    \$\begingroup\$ @DaveTweed I think you worked it out better than I did. I think the OP would be served better by deepening their knowledge of what they already have in place than by adding yet another electronic module (555) to a growing heap of them. One can stay shallow, I suppose, and just add one colostomy bag after another to get a job done. But it's not interesting to me, then. Oh, well. \$\endgroup\$ – jonk May 12 '18 at 21:14
1
\$\begingroup\$

Linear's LTC6992 might be what you want.

enter image description here

Figure 1. The LTC6992 gives a PWM output at a set frequency up to 1 MHz for an analog input signal of 0 to 1 V.

You could then use your low frequency PWM and low-pass filter to generate an analog voltage, scale this down to 0 to 1 V and generate your high-frequency PWM with the LTC6992.

There will be a response time penalty with this approach and this can be calculated based on the RC time-constant of your filter.

\$\endgroup\$
0
\$\begingroup\$

"Best" is a somewhat flexible concept. Assuming you have access to some kind of serial bus, I would think about a dual-channel digital potentiometer. Maybe something like this: http://www.analog.com/en/products/digital-to-analog-converters/digital-potentiometers/ad5122.html

And do an out-right replacement of the resistors in the traditional 555 astable configuration.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.