Controlling 24v relays

Here's an easy one;

What's the best way to control a 24v relay with arduino?

Spark

Use a MOSFET, as in this circuit (ignore the stuff about PWM):

http://ruggedcircuits.com/html/circuit__7.html

Replace 12V with 24V in the circuit. The MOSFET is any general-purpose LOGIC-LEVEL MOSFET (that's important!) that can handle 24V and whatever current your relay needs. Similarly, the diode is any general purpose diode.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

Thanks for replying. I really should have just Googled first.

A MOSFET was what i was planning on using but i was looking for a cheaper answer because I plan on connecting a lot of relays (dozens) using a few shift registers.

I guess the question I really wanted to ask was, can I use a transistor? I wasn't clear on if a transistor can have a collector voltage that is different than the base voltage.

It is now my understanding that they can. I found my answer here.

Would you agree?

  • Spark

Sure, you can use a transistor. It's a little cheaper and a little less efficient. That circuit you found should work.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

I wasn't clear on if a transistor can have a collector voltage that is different than the base voltage.

One talks of a controlled current value into a base, not it's maximum safe base/emitter voltage. A series resistor is selected to set the base current to the value required, any value voltage can be driving that base resistor as long as the resistor is valued to limit the current to correct operating value. Collector current also is current controlled by the load resistance (lamp/motor/solenoid/etc) or load resistor (voltage amplifier), as max collector voltage is a safety rating not an circuit operating value.

Bipolar (NPN/PNP) ransistors are current operated devices and voltage is a byproduct specification. Mosfets are voltage operated devices with corresponding max current specifications.

Lefty