9V pin is only 5V

Hi everybody!

I need a little help. I'm trying to use the Arduino to turn on and off a relay (12v). The blogs/forums posts I've read so far indicate if I plug in an external PS at 12V I should be able to get 12V off the 9V pin. However I can't get anything other than 5V no matter what I plug in.

Also how is controlling the 9V pin done? Is it the same as with the i.e. pin 12 (with digitalWrite(12, HIGH))?

Thanks for all help!

//Jenny

The 9V pin isn't labelled very well - it should just be whatever you're supplying via the power jack. You might need to switch the power jumper to external from USB for it to work. You can't control the 9V from your sketch. To control a relay, you'll need some extra circuitry (like a transistor) on one of the digital pins.

I was looking the schematics of serial, usb, ng and diecimila models (BT seems to have power source directly connected to "9v. pin".), and all of them has only a diode from power source to "9v. pin".
So, it was supposed that you got power source tension - 0.7 volts (diode) on "9v. pin" always. I don't understand why he must change power selector to usb to have power source to "9v. pin".

Your PS support how many mA?

You need a pin that you can control, right?
None of the power pins will work for you. You need to use one of the I/O pins.
In a way, this is simpler. You can power the relay with a 12V source (battery, adapter, whatever) and not need to worry about drawing too much current through the Arduino.
But in a way, it's more complex. You can't just hook the relay up to the board directly, you have to turn it on with a transistor or FET. Like in this example from the playground: Arduino Playground - HomePage

This is the circuit I would try. But a different NPN transistor might be okay for your relay (solenoid in the schematic). But I'm not the guy to pick your transistor. I tend to pick randomly and blow them up.

The TIP120 darlington transistor usually works great for these types of control. They are very common and can frequently be scavenged from old electronics equipment.

There are a number of other transistors in the TIPXXX series that could be used, just check the datasheet to make sure the transistor you use can sustain the current you need.

Usually any NPN transistor with the curent rating needed will do the job

Cheers, thanks for the help everyone! I tried a bit of all your recommendations and now I have a working circuit with a relay and an NPN transistor (though I only found a bag of mixed transistors and blew a few before finding the right one, hehe).

//Jenny