Power Uno and motors from 12V car battery

I would like to control two motors from an Arduino Uno and power both the Uno and the motors from a 12V car battery.

I know next to nothing about electronics and wiring. How would I wire this?

Would the wiring be different if I used DC motors, servos or stepper motors?
Am I correct that the stepper motors will draw power from the battery even when the motor is not moving but that DC motors and servos will not?

In the simplest of terms you take one pair of wires from the battery for the Arduino and another pair (or pairs) for the motors.

Yes, a stepper motor is normally powered all the time and draws almost the full current when stationary which makes it very inefficient - the price one pays for its ability to move in steps.

A servo would normally be connected to power all the time but if there is little or no force trying to push the servo arm out of position it will probably only draw a few milliamps of current.

With a stepper or a DC motor you will need a suitable driver board between the motor and the Arduino. A servo has the driver electronics inside it which makes it very convenient.

Servos also have the big advantage that they “know” their position.

If you tell us what you actually want to create it will be much easier to give useful advice.

…R
Stepper Motor Basics
Simple Stepper Code

Hobby servos need 4.5V to 6V and as much as 1 Amp each so you need a voltage regulator that can reduce the voltage and handle the current. A buck regulator will be way more efficient than a linear regulator. If your chosen regulated voltage is 5V you can run the Arduino off the same regulator by connecting power to the +5V pin. Allow about 1/2 Amp for the Arduino so a 2.5 Amp regulator will be good for two servos and an Arduino.

Each DC motor or Stepper motor has a specification for voltage and current. If the ones you choose are designed for 12V you can run then off the battery with no additional regulation so that would be a bonus. A car battery can provide hundreds of amps so a fuse in the power line is important to protect against hardware or software mistakes that cause a short circuit. Without the fuse you might get a fire.

Stepper drivers typically have an Enable input to allow you to remove power from the stepper when it doesn't need to hold position.

The application is a heliostat. Initially I would build a tracker and I am confident that I can get the Uno to calculate the sun’s position. Once I have the system tracking I would modify it and add a mirror to make a heliostat. Cost is very important. Lack of electrical and mechanical knowledge and skills are the main obstacles.

There is a small commercial heliostat called a Sunflower that has a 0.5m2mirror and I would be aiming for two axis control of a mirror of at most 0.8m dia. Experiments with a wall mirror show this would be adequate. The mirror size and weight and wind effects will determine the motor size.

@johnwassers comment

Stepper drivers typically have an Enable input to allow you to remove power from the stepper when it doesn’t need to hold position.

was really interesting as I had thought of using DC motors with a worm gear but that would require an encoder. Using a stepper with a worm gear would remove the need for an encoder and the worm gear means the power to the stepper could be turned off once in position? Servos seemed an option but they would need to be powerful enough to directly drive the mirror if I wanted 180o of movement.

Lets say I am going with DC motors or servos. I am still not sure about the wiring.
Is it correct that the power can be supplied directly to the motors and only control signals need to go via a shield ?
Attached is a drawing of how I imagine the power connections at the moment.

For fusing I was thinking of using small vehicle spade fuses but their minimum rating is 1A would this be suitable to protect the Uno? As well as controlling the motors the Uno will have 5 switches for manually driving the unit, say 4LEDs for diagnostics and 4-5 photo resistors to monitor light levels and delay tracking when light levels are not favourable.

Power.png

If you want something to track the sun why not use a pair of Light Dependent Resistors (LDR) to detect which area of the sky is brightest. Move a little towards the brighter LDR and check again. No need for complicated position calculations and a simple DC motor with a worm drive will be perfect. If you want elevation adjustment just add two more LDRs

...R

ardly:
Lets say I am going with DC motors or servos. I am still not sure about the wiring. Is it correct that the power can be supplied directly to the motors and only control signals need to go via a shield?
Attached is a drawing of how I imagine the power connections at the moment.

For a DC motor, power is connected to the H-Bridge driver. The driver then provides power to the motor.
For a hobby servo you need a voltage regulator to provide voltage between 4.5V and 6V. That power goes directly to the hobby servo through the Ground (black) and +Power (red) wires. The Control (white or yellow) wire goes to an Arduino pin. Arduino Ground is also connected to the Ground (black) wire to provide signal ground.
For a stepper motor, power goes to the stepper driver.

@Robin2 I want heat and light and I don't think reflecting the brightest part of the sky will be worth it (could be wrong). It is direct sunlight I want so calculating the sun's position seems best though I will need a real time clock. I may use LDRs not to find the sun but to save battery life by deciding it is cloudy and not worth tracking.

@johnwasser I probably need to read up on drivers. I am a bit concerned by the reference to "hobby" motors. I may buy small hobby motors to learn with but won't driving a 0.8m dia mirror outdoors need something bigger ?

What shield would people recommend to drive two 12V DC stepper motors from an Arduino Uno?
How big a motor can shield on an Arduino drive e.g. current and power?

ardly:
@Robin2 I want heat and light and I don't think reflecting the brightest part of the sky will be worth it (could be wrong). It is direct sunlight I want so calculating the sun's position seems best though I will need a real time clock. I may use LDRs not to find the sun but to save battery life by deciding it is cloudy and not worth tracking.

This all seems a little confused.

If you are only interested in cloud-free sunshine then the sun will certainly be the brightest part of the sky.

...R

When fully charged, "12V" car (lead acid) batteries actually have terminal voltages around 14 V, which is too high for direct input to an Arduino. Use a buck regulator like one of these.one of these

Robin2:
This all seems a little confused.

If you are only interested in cloud-free sunshine then the sun will certainly be the brightest part of the sky.

...R

I want direct sunlight but the sky may not be cloudless. The commercial Sunflower does not calculate the sun's position and there are videos showing that it "hunts" as clouds drift across the sun. If I calculate the sun's position then I am guaranteed to get any direct sunlight that is available. Bells and whistles would be to to use LDRs in a strategy to minimise movement in cloudy conditions.

jremington:
When fully charged, "12V" car (lead acid) batteries actually have terminal voltages around 14 V, which is too high for direct input to an Arduino. Use a buck regulator like one of these.one of these

I thought in a car the battery voltage would exceed 12V only while it was charged and the engine was running?
In any case the Arduino can run on voltages upto 20V can't it so would running at 14V for a while be damaging?

In any case the Arduino can run on voltages upto 20V

The Uno is rated for 7-12V.

Where are you getting your misinformation?

ardly:
showing that it “hunts” as clouds drift across the sun.

I suspect it would not be too difficult to write code to avoid that. If clouds cross the sun the light intensity will fall sharply.

…R

jremington:
The Uno is rated for 7-12V.
Where are you getting your misinformation?

The regulator technically allows up to 20V input but at that voltage you can't draw more than 177 mA total through the regulator without additional cooling. At 12V you can draw about 380 mA before the regulator overheats. I think that is why they say:

Input Voltage (recommended) 7-12V
Input Voltage (limit) 6-20V

Running at the "technically allowed" or absolute maximum rating is NEVER advisable.

In practice, many people have had trouble with the Uno overheating even when run at 12V. It is best to use a switching regulator to reduce that to 9V or so.

ardly:
I want direct sunlight but the sky may not be cloudless. The commercial Sunflower does not calculate the sun's position and there are videos showing that it "hunts" as clouds drift across the sun. If I calculate the sun's position then I am guaranteed to get any direct sunlight that is available. Bells and whistles would be to to use LDRs in a strategy to minimise movement in cloudy conditions.

If you calculate the sun's position, you need the date and time, probably UTC time to avoid changing tie twice a year.

Paul

jremington:
In practice, many people have had trouble with the Uno overheating even when run at 12V. It is best to use a switching regulator to reduce that to 9V or so.

If you feed the built-in linear regulator through the power jack from a a switching regulator you should probably use 7V. The minimum is 6.8V because of the 0.6V drop in the protection diode and minimum of 1.2V drop in the regulator. The maximum you can use and still draw the rated current of 1000 mA without overheating is about 7.66V. A choice of 7V gives you good leeway in either direction.

Alternatively you could use a 5V switching regulator and provide 5V directly to the +5V pin. That will eliminate the losses in the built-in linear regulator. WARNING: Some linear regulators overheat when the output side is higher than the input side. If the regulator gets very hot when powered from USB or the +5V pin you might want to desolder the built-in regulator.