Power for sensors,motors and accessories(external or Arduino)?

Hi,

Sorry this is a really simple beginner question but I am unable to find any resource that specifically mentions this.

But if I wanted to connect a sensor/motor/accessory to Arduino, can the sensor be in a series circuit with the power supply and use the arduino - ONLY - for the digital pins?

Or does the sensor have to be connected to the arduino in series for power with (5V +), (GND) and the digital pins?

I apologize for my incorrect technical terms. I have posted two images that - attempt to - illustrate what I am asking.

Image 1 - where in terms of the power supply - I think everything is in series with the arduino:

Image 2 - Separate power supply:

Legend for both images:

The sensor is an ultrasonic sensor. Red(+), Blue(GND/-), Yellow(trig pin) and Brown(echo pin).

Would approach 2 work?

Would approach 2 work?

Yes, but only if you also run a wire from the external voltage source negative terminal to a arduino ground pin. The two voltages used (arduino internal +5vdc and the external positive supply) must share a common ground connection for the digital signals to function with the sensor.

Lefty

Thanks to both of you.

Now that I look at a close up view of the Arduino Uno, there are 3 ground pins. Two quick questions pertaining to that: So I assume any of the three ground pins will serve the same function and three pins - instead of one - exist simply to extend the functionality of the chip? Can I connect more than one sensor to the same ground pin or is that discouraged?

Also, the purpose this chip will be to receive inputs from two ultrasonic sensors and then drive two motors at different speeds based on the input from each motor's, respective, ultrasonic sensor. I also want each of the two sensors and each of the two motors to be run by its own independent power supply.

Okay assuming that I use the same power supply for the arduino and the two sensors, would this work?

(I apologize for the crappy diagram)

Legend:

Red(+), Blue(GND), Brown(Echo for sensor 1), Pink(Echo for sensor 2), Yellow(Trig for sensor 1), and Green(Trig for sensor 2).

Both sensors are rated at 5V(DC) and less than 2 milliamps.

Oh I see - your diagram was extremely helpful.

Thanks a great deal.

One last question, I suspect that there might be an unwanted delay with two sensors.

What I mean is the code would be:

void loop() { obtain information from sensor 1 ..change speed of motor 1... obtain information from sensor 2 ..change speed of motor 2.... }

Now would the time required for motor 2 to change speed be significantly longer than time required for motor 1 to change - because of the order inside the loop ? Or will all this be so fast that such a delay would be negligible?