How to use Arduino to control DC motors?

Hi guyz,
For my project, i need to control DC motors( Preferably Power Window motors) to control the steering of an actual car to drive it remotely( It may seems insane, but im trying to make it real).

I'm new to arduino and its coding systems and currently trying to study the procedures. Ive orderd a UNO from amazon and it will be with me in 3days. Before that i would like to know how can i control a 12V DC motor using an arduino?
What extra part i needed ?
And how can i do it? example code will appreciated.

Thanks

Hello and welcome.

The part you need for a DC motor is called an "H-bridge". It allows the Arduino to control the speed and direction of a dc motor. There are lots of different models available on ebay and other sites.The model you need will depend on the motor you are using. You need to know the current as well as the voltage.

But are you sure that a dc motor is appropriate for this? I would image something more precise would be needed, such as a servo or stepper motor.

Before we give you any more advice, what can you say to reassure us that your project will cause no harm to others or yourself?

Paul

Ummmmmm...

Well... You can use a DC motor, but since you want to control the steering amount, you'll want to use some sort of sensor - if I were attempting this, I'd just paint some gray code (google it) on the steering wheel shaft and read it using IR reflection sensors... I would then use Arduino (for prototype, tiny84 or something similar for the final version) to drive the shaft using H-bridges. I would make sure that the gearing from the motor to the shaft is stiff and doesn't wobble around, since that would make the whole system behave silly. I believe the whole drive system will have considerable dynamics to it, so I'd then design a regulator to compensate for it, first measuring a step response from set rotation to actual rotation, analyzing it as a system, and... and so on, but, really, I am not sure if this is a good and safe idea!

you can use H bridge for this project to control the direction of the motor. and to monitor the position of the motor you can add some rotary encoder. also kindly check of the motor can actually steer the car you may also want to use chains or gears for torque.
very interesting project good luck

Plenty of example code is in the Arduino software.

You will need a very powerful motor to turn a steering wheel. It will be expensive.

Plan on using a motor that has 40lb or more stall weight otherwise feedback from the road/tires/car will take control.

PaulRB:
Hello and welcome.

The part you need for a DC motor is called an "H-bridge". It allows the Arduino to control the speed and direction of a dc motor. There are lots of different models available on ebay and other sites.The model you need will depend on the motor you are using. You need to know the current as well as the voltage.

But are you sure that a dc motor is appropriate for this? I would image something more precise would be needed, such as a servo or stepper motor.

Before we give you any more advice, what can you say to reassure us that your project will cause no harm to others or yourself?

Paul

First of all, sorry for the late response.
Paul Thanks for your info, i'm ordering an H bridge soon after final decision on the motor spec. And also What my main aim is to park a car by controlling from outside. So initially this will be tested on public only after multiple track tests.

thegoodhen:
Ummmmmm...

Well... You can use a DC motor, but since you want to control the steering amount, you'll want to use some sort of sensor - if I were attempting this, I'd just paint some gray code (google it) on the steering wheel shaft and read it using IR reflection sensors... I would then use Arduino (for prototype, tiny84 or something similar for the final version) to drive the shaft using H-bridges. I would make sure that the gearing from the motor to the shaft is stiff and doesn't wobble around, since that would make the whole system behave silly. I believe the whole drive system will have considerable dynamics to it, so I'd then design a regulator to compensate for it, first measuring a step response from set rotation to actual rotation, analyzing it as a system, and... and so on, but, really, I am not sure if this is a good and safe idea!

Thank you so much for helping me out. Lemme go through what you said in detail and lemme make a rough sketch on it. Safety will be on top of the list. I'm only testing this in tracks only.

Spartan1203:
you can use H bridge for this project to control the direction of the motor. and to monitor the position of the motor you can add some rotary encoder. also kindly check of the motor can actually steer the car you may also want to use chains or gears for torque.
very interesting project good luck

Spartan Thanks. What kind of encoder ? could you please tell me in detail?

Hi,

Can you tell us your electronics, programming, arduino, hardware experience?

This is not a beginner exercise.

Tom...... :slight_smile: