Quick help for wire connection

Hi Guys,

Can I ask you to help me have a look at the wire connection please. Basically I want to synchronize a solenoid (12V DC) with 2 servos (standard small servos), and they are controlled by a momentarily contact push button. For example, when I press the button, solenoid is turned on whilst the 2 servos start to move simultaneously. I have written the code (hopefully it works), but I am not sure some wire connections:

Q1). I have watched many videos and they all connect servos to Arduino directly without resistors, one even added a capacitor on the voltage supply. So first question, do I have to use a resistor ? If yes, how should I connect the resistor and how to work out the value of resistor required ? And someone said never use Arduino to power servo directly, always using external batteries (6V) ?

Q2). I know how to connect Arduino to servo (without resistor) like the picture attached shown (multiple servos). However now in my circuit I have a push button (like the picture attached: push button) which requires my +5V power supply (on Arduino) to be connected to the push button. So if I want Arduino to power both the servo and push button together, can I link the +5V (on Arduino) to a common positive ground on breadboard, GND (next to +5V on Arduino) to a common negative ground on breadboard, then connect positive side of the servo and one pin from the button to the common positive ground respectively, whilst ground of servo and GND (on the digital Pin side on Arduino) connected to the common negative ground on breadboard ? Is this OK ?

Q3). If I did the connection above, how can I then connect my 12V DC power supply to the breadboard ? Because I assume neither the servo nor Arduino can take 12V DC ? For example, can I just connect the 12V DC power supply to the common grounds on breadboard where Arduino and servos are also connected to ?

Thank you very much !

Regards, Jeff

Hi Jeff

And someone said never use Arduino to power servo directly, always using external batteries (6V) ?

Especially when using multiple servos, I think you will be putting too much load on the Arduino onboard voltage regulator. But I'm sure a servo expert will comment on this.

So if I want Arduino to power both the servo and push button together, can I link the +5V (on Arduino) to a common positive ground on breadboard, GND (next to +5V on Arduino) to a common negative ground on breadboard, then connect positive side of the servo and one pin from the button to the common positive ground respectively, whilst ground of servo and GND (on the digital Pin side on Arduino) connected to the common negative ground on breadboard ?

The common things are called "busses" rather than "grounds". The latter term risks confusion with GND. Apart from the major (!) question of whether to power the servos from the Arduino, using the busses to connect multiple things is indeed what they are designed for. You don't need the second Arduino GND connection, "GND (on the digital Pin side on Arduino) ". The first one you mention is enough.

It will save you an external pullup resistor, though, if you connect the switch between digital pin and GND. Enable the internal pullup resistor in the Arduino, like this:

pinMode(9, INPUT_PULLUP); // substitute your pin number

And your code will need to look for LOW as the result of digitalRead that indicates switch pressed.

Regards

Ray

Hackscribble:
Hi Jeff

And someone said never use Arduino to power servo directly, always using external batteries (6V) ?

Especially when using multiple servos, I think you will be putting too much load on the Arduino onboard voltage regulator. But I'm sure a servo expert will comment on this.

So if I want Arduino to power both the servo and push button together, can I link the +5V (on Arduino) to a common positive ground on breadboard, GND (next to +5V on Arduino) to a common negative ground on breadboard, then connect positive side of the servo and one pin from the button to the common positive ground respectively, whilst ground of servo and GND (on the digital Pin side on Arduino) connected to the common negative ground on breadboard ?

The common things are called "busses" rather than "grounds". The latter term risks confusion with GND. Apart from the major (!) question of whether to power the servos from the Arduino, using the busses to connect multiple things is indeed what they are designed for. You don't need the second Arduino GND connection, "GND (on the digital Pin side on Arduino) ". The first one you mention is enough.

It will save you an external pullup resistor, though, if you connect the switch between digital pin and GND. Enable the internal pullup resistor in the Arduino, like this:

pinMode(9, INPUT_PULLUP); // substitute your pin number

And your code will need to look for LOW as the result of digitalRead that indicates switch pressed.

Regards

Ray

Hi Ray, thank you very much for quick reply. How about my third question ? About connection 12V DC to the buses ? As servos and Arduino can not take 12V DC from the common positive and negative rails/buses on the breadboard. Or as long as I don't connect +12V to the common positive buses on breadboard (only connect negative to the common buses), i will be safe ?

Or as long as I don't connect +12V to the common positive buses on breadboard (only connect negative to the common buses), i will be safe ?

Do you have a diagram of the connections to the solenoid? I assume the 12V is the power supply to the coil and there is a 5V digital control input that you want to connect to the Arduino?

EDIT or maybe not. Is your device like what's described here? In which case, you will need other components to drive it.

http://playground.arduino.cc/Learning/SolenoidTutorial

So no, do NOT connect +12V to the +5V bus, and probably yes, you will need to connect the solenoid ground to the common ground. But please post a diagram or sketch if you can.