Guidance please

Could someone please explain to me in the simplest of terms when I would need to use a transistor and when I would need to use a relay. Also is there a situation where I would need to use both? My understanding is that if I am using a servo of any size, I can connect the control wire to the Arduino but the positive and negative leads go to an external power source. I also have to make sure to connect the ground of the power supply and the ground of the Arduino together. When I am using a dc motor/stepper motor, etc. (without a control wire) I need to either use an h-bridge (does that come integrated with a motor controller (for control) that I can connect my external power to?) or a transistor to just make it run without any control. I'm not sure which transistor to use. I'm also not sure when to use a relay instead of a transistor... I'm so frustrated! Please try to remember when you first got into this world and didn't really know anything :) I'm trying. Thanks!

Could someone please explain to me in the simplest of terms when I would need to use a transistor and when I would need to use a relay.

A transistor is smaller & cheaper. A transistor can switch very fast (so you can dim a light or speed-control a motor with PWM, etc.). This is rare in digital applications, but a transistor can linearly control a voltage or current (so it can be half-on, etc.)

A relay can switch AC or DC. High power relays are easier to find than high-power transistors. (If you are going to switch on & off a heater, a relay is a better choice.) A relay provides isolation. If you are switching AC power with a relay there is no electrical connection between the AC and the Arduino.

Relays and transistors (and FETs and MOSFETs, and even vacuum tubes) ALL allow you to control a large voltage-current with a smaller voltage & current... It's sort of like pushing on the gas pedal in a car... You don't have to push hard enough to push the car, just hard enough to control the gas, and the actual energy to do the work comes from somewhere else.

Also is there a situation where I would need to use both?

Most relays won't operate directly from 5V, and they often require more than the 40mA that the Arduino can supply. In that case you can use a transistor to drive the relay.

My understanding is that if I am using a servo of any size, I can connect the control wire to the Arduino but the positive and negative leads go to an external V for it'spower source.

That is correct. Servos require a power supply and a pulse-train from the Arduino to set the angle. The transistors and other circuitry are built-into the servo assembly.

I also have to make sure to connect the ground of the power supply and the ground of the Arduino together.

That's correct. As a general rule, in electronics you need a complete circuit and a "reference". That's what the ground is for.... You can have a +5V supply and a +12V supply sharing a ground. If you connect your voltmeter's "ground" to the 5V supply, that becomes your reference and the +12V terminal will read +7V "referenced" to the +5V supply. Or, with the meter's "ground' lead still connected to +5V, the circuit's actual ground will read -5V.

When I am using a dc motor/stepper motor, etc. (without a control wire) I need to either use an h-bridge (does that come integrated with a motor controller (for control) that I can connect my external power to?) or a transistor to just make it run without any control.

Stepper motors take a step when you properly pulse the power, unlike a servo which just needs a low-power signal-pulse. Also unlike a servo, the driver is not built into the motor assembly, Usually that's done with an H-bridge.

An H-Bridge is also required if you want to reverse a DC motor, otherwise a single transistor can be used. A DPDT relay can also be used to reverse a DC motor, but you need an additional relay (or transistor to turn the motor off.

I'm not sure which transistor to use.

I'm not sure either... The transistor needs to be rated for at least the current (amps) rating for the motor. For low voltage applications, most transistors can handle 12V or so, so in most low-voltage applications you don't need to worry about the transistor's voltage rating.

Relays are more electrically rugged than transistors, so if you are a beginner you are less likely to fry a relay than you are to fry a transistor. ;)

I'm so frustrated! Please try to remember when you first got into this world and didn't really know anything :) I'm trying.

If you were taking electronics in college you probably wouldn't learn about transistors or MOSFETs 'till the 2nd or 3rd year, and you probably wouldn't learn about microcontrollers 'till the 4th year.

Thank you very much!

welchsc: Please try to remember when you first got into this world and didn't really know anything

That's an ask!

I think I must have been five or so and that wasn't recently! ::)

Please try to remember when you first got into this world and didn't really know anything

Sorry, can't remember that far back....