I'm new to Arduino, I'm working on an Arduino setup with a potentiometer 10k, Arduino Uno, BTS7960, and a Nanotec actuator. I was able to use the potentiometer 10k because it's simple to code, but when I watch and read tutorials on controlling an actuator. One tutorial is very easy to work with some wiring and copy-and-paste codes but the actuator they use had pot feedback while this actuator doesn't have. Another one has BTS7960 and an actuator similar to Nanotec but it uses buttons to control the actuator.
float floatMap(float x, float in_min, float in_max, float out_min, float out_max) {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin A0:
int analogValue = analogRead(A0);
// Rescale to potentiometer's voltage (from 0V to 5V):
float voltage = floatMap(analogValue, 0, 1023, 0, 5);
// read the angluar position (from 0 to 270 degree):
float angle = floatMap(analogValue, 0, 1023, 0, 270);
// read the actuator position (from 0 to 3 inches):
float lenght = floatMap(analogValue, 0, 1023, 0, 3);
Serial.print("Analog: ");
Serial.print(analogValue);
Serial.print(", Voltage: ");
Serial.println(voltage);
Serial.print(", angle: ");
Serial.println(angle);
Serial.print(", length: ");
Serial.println(lenght);
So I'm unsure how it works.
My guessing is you apply a bigger or smaller current to the coils and this makes the PIN with the thread move out more or less???
But I'm totally unsire if this is correct.
What is a BTS7960?? You are the one who wants help you should provide a datasheet and a description what a BTS7960 is
And it is always a good idea to describe your whole project. Which means to give an overview about your whole project. This is not boring. It is the opposite: the interesting thing is what is your context?
Can you please explain how this linear actuator is working?
And what you want to do in the end with it.
I assume moving the linear actuator back and forth is not only for fun
what is the final purpose of moving the linear actuator?
depending on that purpose it might be sufficient to just switch the coils to move out completely or move in as fast as the actuator can
or maybe controlled in a well defined speed or with different stops in-between
If you don't need the full torque permitted by the 2A stepper of the Nanotech linear actuator, you can use a lower current limit setting.
The Pololu DRV8825 is inexpensive and can handle 1.5A/winding without cooling (2.2A/winding with forced air cooling). The standard stepper libraries with STEP/DIR outputs support it.
Do you want to use the potentiometer to control the position of the actuator along the approximately 19mm stroke length?
You will need to translate the range of the pot into steps for the motor.
How do you plan to determine the home position of the actuator? A limit switch at one or both ends is going to be required as moving against fixed limit stops should be avoided.