Control Intensity of Vibration at Constant Frequency

Status
Not open for further replies.

chrisgr99

Member
I need to drive a vibrator motor such as this https://www.pjrc.com/teensy/td_pulse.html at a constant frequency of say 50 cps but be able to control the intensity of vibration within a range between zero and some maximum amount. The intensity should be able to vary in real time based on some other variable such as an ADC input.

I know the the way to control the intensity of a vibrator motor is with PWM much like a loudspeaker. I plan to use a transistor to increase the drive current.

I assume the tone(pin, frequency) function would produce a vibration at a given frequency, but how can the intensity of the tone be controlled while keeping the frequency constant?

This is with a Teensy 3.2.
 
Use the elementary PWM functions:
analogWriteFrequency(pin, 50); //50cps PWM freq
analogWriteResolution(pin, 8); //8bit resolution
to configure, and analogWrite(pin, value); to set the desired intensity.
 
Status
Not open for further replies.
Back
Top