BME 553 Program 07  

BME 553 Program 07  

Program 7

To interface sensor with arduino/raspberry Pi  and write a program to turn on/ of linear actuator when sensor data is detected

Outcome: able to control linear actuator with the help of microcontroller and sensor.

 

What is a linear actuator?

 

A linear actuator is a motion device that creates force and motion in a straight line. A linear actuator consists of a rotary motor (stepper, brush DC or brushless servo) and a threaded lead screw with a precision nut.

Why Use an Arduino to Control a Linear Actuator?

One of the biggest advantages of using an Arduino, or any microcontroller for that matter, to control a linear actuator is that you have greater control over your linear actuator. Microcontrollers allow you to use more complex inputs from sensors or other devices to control your linear actuator. They allow you to preform real-time calculations to position your actuator in the ideal position or implement timers to automate position changes of your actuators.

Controlling a Linear Actuator with an Arduino

You won’t be able to directly interface your linear actuator to an Arduino like you can with a switch as the operating voltage of the Arduino is only 5V and has very small current limits.

 

Firgelli Automations

*  Limited or no support: we do not have the resources for Arduino code support

*/

 

void setup() {

pinMode(7, OUTPUT); // Configure pin 7 as an Output

pinMode(8, OUTPUT); // Configure pin 8 as an Output

 

digitalWrite(7, HIGH); // Initialize pin 7 as Low

digitalWrite(8, HIGH); // Initialize pin 7 as Low

 

}

 

void loop() {

  // Extend Linear Actuator

  digitalWrite(7, LOW);

  digitalWrite(8, HIGH);

 

  delay(2000); // 2 seconds

 

  // Stops Actuator

  digitalWrite(7, HIGH);

  digitalWrite(8, HIGH);

 

  delay(2000); // 2 seconds

 

  // Retracts Linear Actuator

  digitalWrite(7, HIGH);

  digitalWrite(8, LOW);

 

  delay(2000); // 2 seconds

 

  // Stop Actuator

  digitalWrite(7, HIGH);

  digitalWrite(8, HIGH);

 

  delay(2000); // 2 seconds

}

Firgelli Automations
 * Limited or no support: we do not have the resources for Arduino code support
 * 
 * Program demos how a motor driver controls direction & speed of a linear actuator 
 */
 
byte Speed = 0; // Intialize Varaible for the speed of the motor (0-255);
int RPWM = 10;  //connect Arduino pin 10 to IBT-2 pin RPWM
int LPWM = 11;  //connect Arduino pin 11 to IBT-2 pin LPWM
 
void setup() {
pinMode(10, OUTPUT); // Configure pin 10 as an Output
pinMode(11, OUTPUT); // Configure pin 11 as an Output
 
}
 
void loop() {
  // Extend Actuator at Full Speed
  Speed = 255;
  analogWrite(RPWM, 0);
  analogWrite(LPWM, Speed);
  
  delay(2000); // 2 Seconds
  
  // Stop Actuator
  analogWrite(RPWM, 0);
  analogWrite(LPWM, 0);
 
  delay(2000); // 2 Seconds
 
  // Retract Actuator at Half Speed
  Speed = 127;
  analogWrite(RPWM, Speed);
  analogWrite(LPWM, 0);
  
  delay(2000); // 2 Seconds
  
  // Stop Actuator
  analogWrite(RPWM, 0);
  analogWrite(LPWM, 0);
 
  delay(2000); // 2 Seconds

Leave a Reply

Your email address will not be published. Required fields are marked *