In this Simple tutorial, you will learn how to control the position of a linear actuator using the Arduino and L298N DC motor driver.
Watch the Video!
Step 1: What You Will Need
- Arduino UNO (Or any other Arduino)
- Linear Actuator
- LN298N DC Motor Driver
- Potentiometer module
- Jumper wires
- Power Supply
- Visuino program: Download Visuino
Step 2: Brought by PCBWay
Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.
What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!
Go check them out here. They also offer a lot of other stuff in case you might need it like assembly, 3D printing, CNC machining and a lot more.
Step 3: The Circuit
- Connect Power supply (batteries) pin (gnd) to motor driver controler pin (gnd)
- Connect Power supply (batteries) pin (+) to motor driver controler pin (+)
- Connect Power supply (batteries) pin (+) to Arduino pin (VIN)
- Connect GND from Arduino to motor driver controler pin (gnd)
- Connect digital pin(6) from Arduino to motor driver pin (IN1)
- Connect digital pin(8) from Arduino to motor driver pin (IN2)
- Connect Linear Actuator to the motor driver as you can see on the schematic
- Connect potentiometer pin [DTA] to arduino analog pin [A0]
- Connect potentiometer pin [VCC] to the breadboard positive pin [5V]
- Connect potentiometer pin [GND] to the breadboard pin [GND]
Step 4: Start Visuino, and Select the Arduino UNO Board Type
The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.
Start Visuino as shown in the first picture Click on the “Tools” button on the Arduino component (Picture 1) in Visuino When the dialog appears, select “Arduino UNO” as shown on Picture 2
Step 5: In Visuino Add Components
- Add “Dual DC Motor Driver Digital and PWM Pins Bridge (L9110S, L298N)” component
- Add “Ramp To Analog Value” component
Step 7: In Visuino Connect Components
- Connect Arduino Analog pin  to “RampToValue1” pin [In]
- Connect “RampToValue1” pin [Out] to “DualMotorDriver1” > Motors  Pin [In]
- Connect “DualMotorDriver1” > Motors  Pin [Direction]” to Arduino digital pin
- Connect “DualMotorDriver1” > Motors  Pin [Speed]” to Arduino digital pin Analog PWM
Step 8: Generate, Compile, and Upload the Arduino Code
In Visuino, at the bottom click on the “Build” Tab, make sure the correct port is selected, then click on the “Compile/Build and Upload” button.
Step 9: Play
If you power the Arduino module and change the potentiometer position then the Linear Actuator will start to move in one direction and if you move the potentiometer position to the other side it will reverse.
Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it here and open it in Visuino.