I tried l298n before but its output voltage wasn't high

so I use relay shield but it seems that the car can only go forward or stop

Can I control the speed and direction of dc motors?

  • Please can you expand on your question? What do you motors need V and A? – Code Gorilla Aug 17 '16 at 12:26
  • You can change the polarity of the power going to the motor using only a single DPDT relay. You'd need a second relay to turn the motor on and off. Using a relay to control speed will wear out the relay pretty fast. – Gerben Aug 17 '16 at 12:53

Using a mechanical relay to control the speed is not a good idea. But you can control the directions.

I prefer you to use Solid state relays (SSR) to do this. Arrange 4 SSR as Hbridge and Use PWM to control the speed.

refer this

or you can use the devices like this which has direction control as well.

| improve this answer | |

Yes you can, but the easiest way is by using a "motor shield". There are more options than just L298N.

Are you sure it was the voltage that wasn't high enough, its normally the current (Amps)?

To do it with a relay you need to change the polarity of the feeds to the motor. You could do this with 2 relays both connected all the time, but if you close the wrong one, you will short everything. It would be better using a motor controller.

| improve this answer | |
  • When I used l298n the output voltage was about 4.6V current was about 120~130mA – 黃銘賢 Aug 17 '16 at 12:34
  • the fast speed occurred when I connect 5V pin of arduino to the positive of motor and GND pin to the negative of motor I measured the current was about 120~130mA – 黃銘賢 Aug 17 '16 at 12:37
  • But I used the 9V battery to connect logic 5V of l298N ,the speed didn't increase. I am sure I connected I don't know why it didn't work – 黃銘賢 Aug 17 '16 at 12:40
  • Would this be better? learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/… – Code Gorilla Aug 17 '16 at 12:42
  • 9V batteries can't provide a lot of power/current. – Gerben Aug 17 '16 at 12:55

Most refer to relays when talking about mechanical devices which are either closed or open. If you arrange several in an H-bridge configuration, you can make you car go forward, stop and reverse. But controlling speed is not possible.

| improve this answer | |
  • Ok thank you it seems the only choice is l298n – 黃銘賢 Aug 17 '16 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.