Go Down

Topic: can i digitalWrite 9 volt output (Read 1 time) previous topic - next topic

owenn30

If i plug in a 9 volt battery as my power supply for my arduino, when i digitalWrite(HIGH), does it still output 5 volts or does it output 9 volts because of my 9 volt battery supply?

JChristensen

#1
Nov 20, 2013, 02:21 am Last Edit: Nov 20, 2013, 02:29 am by Jack Christensen Reason: 1
Assuming the 9V is connected to the power jack or to the Vin pin (as it should be), a voltage regulator on the board reduces the voltage to 5V, so the output voltage is also 5V. If the microcontroller were connected directly to 9V, it would most likely be destroyed, as that is in excess of its absolute maximum rating.

However, it is possible to switch 9V or some higher voltage using an external transistor connected to the output pin. 5V is plenty to drive the transistor, and it can control a higher voltage which is never connected to the Arduino.

See http://www.pighixxx.com/abc-arduino-basic-connections/, Set 1, Card 2 for schematics, either the "Connect a Lamp" or "LED clusters", the idea is the same. Connect the 9V to the Arduino input jack and also to the high side of the load, i.e. the + sign in the schematics. The transistor should be sized appropriate for the load its driving. How much current does your load require? Finally, the notes on those circuits are incorrect, they should say that the lamp/LEDs go ON when the pin is set to HIGH.

Go Up