I need to make a square wave generator to control a stepper motor driver. It needs to be controlled with a potentiometer and get an output range from 40 Hz to 4 kHz.

I don't know a heck of a lot about electronics and I have been doing lots and lots and lots of research but I don't understand enough about it to figure this out on my own so far.

First off, can this even be done with just one potentiometer and second, how would I go about doing it?

  • 1
    \$\begingroup\$ google for '555 astable' to find more links than you can read about how to make a 555 oscillator. Then replace the frequency determining resistor with a potentiometer ('pot'). Ideally use a log pot, so the low end doesn't get all crushed up, and you get a more logarithmic rather than linear control of frequency. If you add the word 'adjustable' to the search, it'll even show you which resistor to make adjustable. \$\endgroup\$ – Neil_UK Jun 4 '18 at 4:49

As pointed out in the comments by Niel_UK, this can be done with a 555 timer in the 'Astable' configuration. Although there are better ways to produce a square wave generator, a 555 timer is an excellent IC for a beginner (which it sounds like you are) so making circuits with this IC is a great idea.

A Google search on the Astable 555 timer will show you how to connect the external components: enter image description here

Replacing R2 with a Potentiomenter will enable you to change the frequency by changing the voltage threshold on the discharge pin.

The next thing you need to do is work out the components you need to give yourself the frequency range you need. There are a few ways to do it, there are many online calculators you can use such as this one HERE that will let you put in the parameters you require and it will calculate the values needed. Or, if you are feeling adventurous, you could try and work it out yourself by using the formula f=1.44/(R1+2R2)C

If you rearrange the formula for R2, you can work out what values you will need to get 40Hz, then what value will be needed for 40kHz.

I would definitely recommend trying to solve it yourself first, as this is a part of electronics, being able to do the required maths so it is good practise! Use the online tool if your results either don't work out or you get too frustrated (in which case I would do some more research)!

  • \$\begingroup\$ Thank you for your responses. It looks like I'm going to need to set it up where R1=1K, R2=3.3k and the capacitor will be .047 microfarad. Then I will have a 500K audio taper potentiometer in series with R2. Should get me from ~30Hz all the way up to a bit over 4,000 with about a 50% duty cycle throughout the range. \$\endgroup\$ – Alan Solomon Jun 5 '18 at 16:29

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.