Hello I am a newbie here ! know there's a difference between the regular pwm pins and servo pwm pins. I feel like I've been seeing mixed information on if I can use servo pwm pins as regular pwm pins to send to an HBridge.
I have a uno with a 2 motor and 16 servo shield and I'm needing to drive 2 DC motors and 2 steppers.
2 DC motors each on a BTS7960
2 steppers on a dual HBridge https://www.amazon.com/dp/B078TDKC4F/ref=cm_sw_r_cp_apa_gCJTBb9WG7BPF
I guess the hbridges to steppers don't need to be on pwm pins. So I can run those on a mux?
Any help would be appreciated.
There is no such thing as a servo PWM pin. You can drive a servo from any pin.
If you are controlling a stepper motor I expect you are not using PWM (analogWrite() ) so there is no need to use PWM pins.
Stepper Motor Basics
Simple Stepper Code
Isnt the signal pin on a servo connector is pwm that controls a servos position via pwm? But duty cycle is less. Is it possible to change timing or frequency to increase duty cycle?
Isnt the signal pin on a servo connector is pwm that controls a servos position via pwm?
It is called PWM but it is very different from the PWM that is produced by analogWrite(). It is unfortunate that the same name is used for 2 different things.
For a servo the width of the pulse defines the angle that the servo arm should move to, For a DC motor PWM defines the amount of power available to the motor from 0/255 to 255/255.
A servo signal is basically a PWM signal, but with a lower frequency and less 'variation' than Arduino's default PWM.
Therefore different code is used to generate that PWM signal, and any pin can now be used.
An Adafruit 16-channel PCA9685 servo shield (if that is what you referred to) is using regular PWM to drive servos. But the PCA9685 can easily be set to the lower frequency (~50Hz) servo signal, and has a 4096 step resolution to play with. Enough 'steps' left for that smaller variation.
The PCA9685 uses I2C to communicate with the Aduino, and only to set a new servo position.
You linked to brushed motor drivers. Usually NOT suited to drive steppers.
Only high impedance motors will work without overheating the motor driver.
Post a link to the stepper motors.
The Servo library is interrupt driven, using timer1 (which becomes unavailable for other uses such
as analogWrite()). This means with the Servo library on the Uno there are only 4 usable hardware PWM pins.
If other interrupts (such as the timer0 interrupts that maintain millis()) flying around, the Servo library
signals display some jitter (unlike a true hardware PWM signal), as interrupt servicing can delay other