Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano and BTS7960 Motor Driver-Based Linear Actuator Control with Force Sensing

View and Edit Project In Cirkit DesignerImage of Arduino Nano and BTS7960 Motor Driver-Based Linear Actuator Control with Force Sensing

Circuit Documentation

Summary

This circuit is designed to control a linear actuator based on the input from a Force Sensing Resistor (FSR). The FSR measures the force applied, and when the force exceeds a certain threshold, the actuator is activated to push. The circuit includes an Arduino Nano microcontroller, a BTS7960 motor driver, a rotary potentiometer, resistors, an LM358 op-amp, a power supply, and an XL4015 DC-DC buck converter.

Component List

  1. LMA

    • Description: Linear Actuator
    • Pins: +, -
  2. POWER SUPPLY 12V 5AMP

    • Description: Power supply providing 12V DC at 5A
    • Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND, GND (DC), 12V-24V Output (DC)
  3. BTS7960 Motor Driver

    • Description: Motor driver for controlling the linear actuator
    • Pins: Pin 1, Pin 2, Pin 3, Pin 4, Pin 5, Pin 6, Pin 7, Pin 8, Pin 9, Pin 10, Pin 11, Pin 12
  4. Rotary Potentiometer

    • Description: Adjustable resistor for tuning
    • Pins: leg1, wiper, leg2
    • Properties: Resistance: 10k Ohms
  5. XL4015 5A DC Buck Step-down

    • Description: DC-DC buck converter for voltage regulation
    • Pins: Output +, Output -, Input +, Input -
  6. LM358 Op-Amp

    • Description: Operational amplifier
    • Pins: 8, 1, 2, 3, 4, 5, 6, 7
  7. Arduino Nano

    • Description: Microcontroller for controlling the circuit
    • Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
  8. Force Sensing Resistor

    • Description: Sensor for measuring force
    • Pins: pin 0, pin 1
  9. Resistor (10k Ohms)

    • Description: Fixed resistor
    • Pins: pin1, pin2
    • Properties: Resistance: 10k Ohms

Wiring Details

LMA

POWER SUPPLY 12V 5AMP

BTS7960 Motor Driver

Rotary Potentiometer

XL4015 5A DC Buck Step-down

LM358 Op-Amp

Arduino Nano

Force Sensing Resistor

Resistor (10k Ohms)

Code Documentation

/*
 * Linear Actuator Control Based on FSR
 * This code reads values from an FSR to control a linear actuator via a BTS7960
 * motor driver. When the FSR value exceeds a threshold corresponding to 50N,
 * the actuator is activated to push. When below the threshold, the actuator
 * returns to its initial position.
 */

// Pin definitions
const int fsrPin = A5; // FSR connected to analog pin A5
const int actuatorControlPin1 = 3; // Control pin 1 for actuator
const int actuatorControlPin2 = 5; // Control pin 2 for actuator

const int threshold = 500; // FSR threshold for 50N

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Set control pins as outputs
  pinMode(actuatorControlPin1, OUTPUT);
  pinMode(actuatorControlPin2, OUTPUT);
}

void loop() {
  // Read FSR value
  int fsrValue = analogRead(fsrPin);

  // Debugging output
  Serial.print("FSR Value: ");
  Serial.println(fsrValue);

  // Control actuator based on FSR value
  if (fsrValue >= threshold) {
    digitalWrite(actuatorControlPin1, HIGH);
    digitalWrite(actuatorControlPin2, LOW);
  } else {
    digitalWrite(actuatorControlPin1, LOW);
    digitalWrite(actuatorControlPin2, HIGH);
  }

  // Small delay to avoid rapid switching
  delay(100);
}

This code reads the value from the FSR connected to analog pin A5 of the Arduino Nano. If the FSR value exceeds the threshold (500), the actuator is activated by setting actuatorControlPin1 to HIGH and actuatorControlPin2 to LOW. If the FSR value is below the threshold, the actuator is deactivated by setting actuatorControlPin1 to LOW and actuatorControlPin2 to HIGH. The serial monitor is used for debugging to print the FSR values.