Hello,
I am trying to control the speed of a stepper motor using an arduino analog output through a Tic 36v4 motor driver.
I am using the SDA pin on the Tic to recieve a PWM signal from the arduino.
the issue is scaling since arduino is theoretically sending a -5V to 0 to 5V for -100% to 0 to 100% while Tic is expecting 0V to 5V for -100% to 0 to 100%.
I am not sure if I am doing this correctly at all and any help is appreciated.
Hello.
Assuming you’re using a typical Arduino board with analogWrite()
, there are a couple problems with what you’re describing:
-
As you mentioned, the Arduino does not output a true analog signal (which is what the Tic expects); it outputs a PWM with the specified duty cycle.
-
The Arduino does not output negative voltages. The analogWrite()
command uses values between 0 and 255 to specify the duty cycle (which are from 0% to 100%). The PWM output is high (5V) for the specified duty cycle time and low (0V) otherwise.
You might be able to filter the PWM signal to look more like a true analog signal, but since you’re using an Arduino anyway, I recommend using the Tic’s TTL serial or I2C interface instead, which should be much more precise and reliable. You can find information about those interfaces in the “Setting up serial control” and “Setting up I2C control” sections of the Tic user’s guide. Additionally, you can use our Arduino library for the Tic, which has multiple examples for using either interface.
Brandon