Controlling/Powering Two Servos with Arduino from Car

Hi everyone!

I am new to Arduino/coding and I am currently working on a project (just for fun).

Project Overview:

The project involves using an Arduino Uno to power two servo motors that rotate diffuser fins (Figure 1-temporary cardboard mockup) on a car with a single push button powered by the cars battery. When the user pushes the button, the servo motors rotate from their initial position to their final position and stop. When the user pushes the button again, the servo motors rotate back to their initial position and stop and the cycle continues at each press of the button. The two servo motors are to rotate in different directions and they don’t have to be perfectly in sync with one another. Likewise, the two servo motors operate a mechanism to turn all six diffuser fins (3 turn clockwise, 3 turn counter clockwise) so they all fold nicely into the underside of the car. The mechanism is not necessary to describe as it all boils down to the two servo motors being able to rotate in different directions. Lastly, the holding power of the servo motors to hold the fins in position is not necessary as a locking device is used to hold the fins when they are in the up position.

Project Specific Information:

I have researched this topic on different Arduino forum threads for a while and found some code by the user “Zoomkat” to which I altered slightly for my project. (Code shown below). I don’t claim to fully understand all the code listed, but a majority I do know. I have not bought any servos/buttons/converters/wires etc… as of yet because I wanted to gather some insight and opinions from experts. That being said, I did have some random parts laying around to which I was able to mock up a simple prototype. I connected two JR Racing Z270 Servo Motors to an Arduino Uno. Both servos are connected to the 5V pin and GND on the Arduino and their signals connected to pins (4) and (7) as demonstrated in the wiring diagram (Figure 2). A button is connected to the GND and pin (5) on the Arduino as well. Everything seems to work fine and operates as expected from my limited knowledge.

I want to power this setup from a car using its battery when the car is running. I currently only have one Cigarette Lighter Socket and it is in use already so that’s out of the picture. What I gathered from other forum posts about this topic (many differing opinions btw) is that I would need to get an “Add a Fuse” and tap into the fuse box (a switched fuse so only when the car is turned on does the Arduino/servo motors power on) and connect it to a DC Buck Converter to step down the voltage to the Arduino. People also stated I could just use the Arduino itself as it has an on board regulator good for an input voltage of 7 to 20V. Likewise, people also suggested powering the Arduino by itself (such as with a 9v battery to the barrel jack connector) and powering the servo motors with the car battery. I am also aware that a cars battery can fluctuate and possibly provide voltage/current spikes on startup and other times.

I plan on purchasing two waterproof high torque servo motors with an operating voltage of 5 to 7V ( I haven’t bought anything yet so no current/other specs on servo motors). A possible servo motor that some people suggested is this:

The diffuser fins are made out of ABS plastic and don’t weigh a lot. The two servo motors I’m experimenting with (JR Racing Z270) can operate/move the fins with no problem.

Questions/Desired opinions I have for you guys includes the following:

  1. What would be the best way to power the Arduino and servo motors from the cars battery? Power them both from the cars battery or use an additional power supply for the Arduino alone? Do I need a DC buck converter or other components to safely power the system without draining the cars battery or damaging the Arduino/servo motors?

  2. Is the code/wiring satisfactory? I mean does it provide a safe/reliable operation of the servo motors when powered by the cars battery? Will the servo motors draw too much current?

These topics might have already been addressed in other forums, but I either could not understand all the technical jargon people were discussing or people had different opinions with no concrete answer. I would appreciate any advice or opinions you guys have whether this is a stupid project and should not be done, things I need to reconsider/adjust in my wiring or coding, ideas on servo motor selection, or any additional comments/concerns you guys have. Sorry for the long post, thanks.

#include <Servo.h>
int button = 5; //pin for button
int press = 0;
Servo servo1; //define Servo
Servo servo2;
boolean toggle = true;
int pos1 = 180; //initial position of Servo 1
int pos2 = 10; //initial position of Servo 2

void setup()
{
  servo1.write(pos1);
  servo2.write(pos2);
  pinMode(button, INPUT); //monitor pin state
  servo1.attach(4); //pin for servo 1
  servo2.attach(7); //pin for servo 2
  digitalWrite(5, HIGH); //enable pullups to make pin high
}

void loop()
{
  press = digitalRead(button);
  if (press == LOW)
  {
    if(toggle)
    {
      servo1.write(5); 
      servo2.write(185);
      toggle = !toggle;
    }
    else
    {
      servo1.write(180);
      servo2.write(10);
      toggle = !toggle;
    }
  }
  delay(300);  //delay for debounce
}

Servos will not operate on 12v battery (way too high) neither will they operate from the Arduino 5v output.(not enough current capability)

Arduino may get angry and at best, hot under the collar, at worst cook the guts out of the Arduino, running on a car battery when the voltage on the battery goes above 12V as is the case when it mostly goes to 13.8V while engine is running.

Those LD-25MG servos are best run at around 6-7V directly from a DC-DC converter and will need about 3A each. A high current converter may be hard to find so you could run separate 3A versions for each servo.

It would be best to run another small DC-DC converter to provide a separate 5V supply for the Arduino. Less chance of interference from the high-power servos.

But whatever you do don't try running those servos from the Arduino 5V pin.

Steve

Thanks for the replies slipstick and bluejets. I was not aware each servo would require around 3A for each one to operate sufficiently and that the Arduino 5V pin could not support enough current to supply them both, so I appreciate the information.

Going off of slipstick’s suggestion, is it reasonable/advised to run three DC-DC converters from the same power source/fuse tap (2 for the servos and 1 for the Arduino)? If so, would a 10A-15A fuse be sufficient for the Add-a-Fuse?

Since I’m new to Arduino, I do not know if there is an easier way to power/wire this system on a car’s battery, I just want to ensure nothing catches on fire or gets damaged. Thanks for your help, I really appreciate it.