Hey! I’m working on a project where I need to control the tilt of a platform using a gyroscope (MPU6050) and three 12V linear actuators. The setup is controlled by an Arduino Mega, and each actuator is connected through its own L298N motor driver.
The actuators are powered by an external 12V supply, and I’m using IN1/IN2 + ENA (PWM) to control them from the Arduino.
→ the actuator doesn't move at all. Even trying HIGH-HIGH (brake) doesn’t help.
It only seems to work if I use a long delay(), but that blocks the code and I can't stop it in time when I need to — I want real-time control (like inside a while() or based on sensor feedback).
My questions: Has anyone faced this?
Is L298N not suitable for this kind of control?
Should I switch to relays instead?
For context:
The actuators have encoders, and I plan to implement a control algorithm (probably PID) later, so I need precise movement and real-time stopping — no blocking delays.
Any advice or experience would really help. Thanks in advance!
Always show us a good schematic of your proposed circuit.
Show us good images of your ‘actual’ wiring.
Give links to components.
In the Arduino IDE, use CtrlT or CMDT to format your code then copy the complete sketch.
Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.
…then the actuator doesn’t move at all.
It only works if I insert a delay (e.g., delay(500)) between those commands.
But I don’t want to use delay() — I need to stop the actuator at a specific position later using feedback (encoders), so delay() just blocks everything and messes up the timing. This is essential for the control algorithm I want to implement (probably PID), so I’m trying to figure out how to make it work without relying on fixed delays.
Let me know if this wiring and approach looks fine, or if I should change something. I’ll also upload a schematic and photos shortly.
Post a link to the linear actuators. Many 12V ones draw over 5 Amperes every time they start moving, which is far above the maximum current that the L298 can handle.
The product page is not entirely clear, but it appears that the rated maximum steady state current is 3A, so the start/stall current could be as high as 10A.
The L298 can handle only 1 Ampere steady state, so it is totally inadequate. Pololu has the best selection of motor drivers, and I recommend this one.
Achieving precise actuator movement with a relay would be very difficult if not impossible.
In order to make a 1mm adjustment with an 80mm/second speed you would have to close and open the relay in 12.5 milliseconds. Depending on the relay, that just may not be possible.
The L298N is a bipolar transistor-based H-bridge driver that has a significant voltage drop (up to 2V or more),
It is not ideal for inductive loads like actuators. It provides poor braking control (particularly with HIGH/HIGH). L298N is outdated compared to modern MOSFET-based drivers.
When you write:
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
You disconnect both ends of the motor coil, leaving it floating (a condition called coasting). If you’re also writing analogWrite(ENA, 255), it’s irrelevant in this case since there's no path for current.
Replace L298N with a MOSFET-based H-Bridge like VNH5019 https://www.st.com/resource/en/datasheet/vnh5019a-e.pdf
Sorry, I put my words in a wrong way. I wanted to say that L298 is not good for inductive loads like many of the linear actuators, which draw a lot of current.
Ok, so with the new driver BTS7960 43A, controlling the motors will surely be easier, I just need to find out how to determine the piston position for control algorithm. Do you have any suggestions?
You said your actuators have encoders. You use the encoder to count the number of turns the motor has made. From that you can determine the actuator movement.