For a project I am trying to make a linear stage, actuated by an ultrasonic rotary motor. Attached to the motor shaft is a rotary incremental encoder (500 P/R). My goal is position-control of the stage.
I have a couple of questions concerning the set-up of the arduino (components and how to connect them) for this specific motor. Note: I am very new to arduino, so my apologies in advance if this is a dumb question.
I have an external 24V power supply for the driver and motor. As control board I wanted to use arduino.
In the specification sheet they mention that for rotative-direction change (CW-CCW) two signals of TTL level are required. For speed change, a analog signal of DC 0[V] - 3.2 [V] is required.
So my questions are, how to create two TTL signals? For speed change a assume that I need a simple DAC? Overall: which components should I use and how should I connect them with the arduino / bread board?
For speed use PWM into an RC filter perhaps? 100k and 1µF should do it unless the device has
a low input impedance, in which case a DAC would be best.
TTL level means logic level, ie an Arduino digital pin.
First I would go to: https://www.allaboutcircuits.com/technical-articles/turn-your-pwm-into-a-dac/ and read the full thing. That explains how to take a PWM output of the Arduino and convert it to an analog voltage. It works very well. As for the TTL use any two of the arduino pins, they will properly drive TTL levels. If you have problems reading the signal coming back add a pull up resistor in the 2K range. For the PWM you can add a 3.5 volt buffer to the 5 volt output of the arduino, it will simplify the voltage conversion for you. If you are comfortable you can limit with the PWM. There are a lot of ways of doing this, this is straightforward and simple to implement.
gilshultz:
First I would go to: https://www.allaboutcircuits.com/technical-articles/turn-your-pwm-into-a-dac/ and read the full thing. That explains how to take a PWM output of the Arduino and convert it to an analog voltage. It works very well. As for the TTL use any two of the arduino pins, they will properly drive TTL levels. If you have problems reading the signal coming back add a pull up resistor in the 2K range. For the PWM you can add a 3.5 volt buffer to the 5 volt output of the arduino, it will simplify the voltage conversion for you. If you are comfortable you can limit with the PWM. There are a lot of ways of doing this, this is straightforward and simple to implement.
Have Fun, Good Luck, Gil
Hi Gil, I have a question about this:
If you want the 0-3.2V range (instead of the 0-5V range), what R and C are necessary? And how do you change the arduino code.
I used: (Sample)RC Low-pass Filter Design for PWM - Result - and filled in PMW voltage 0-5V, 490Hz, with duty step 64% (3.2V), I find 10kOhm and 22uF. Did I use the calculator correctly? Or would you recommend other R and C?
Also for the code (using PID). Do I use the range of 255? Or do I have to scale that down to 163.2 (3.2V/5V*255)? Which one of these:
PID1.SetOutputLimits(-255, 255); // PMW max output
PID1.SetOutputLimits(-163.2, 163.2); // PMW max output