A common way to expand the set of available output pins on the Arduino is to use shift registers like the 74HC595 IC (link to datasheet).
You need 3 pins to control these chips:
In a program, you pass on the data one bit at a time to the shift register using the shiftOut() command, like so:
shiftOut(dataPin, clockPin, data);
With that ...
This is the voltage reference analog-to-digital converter (ADC). It can be used instead of the standard 5V reference for the top end of the analog spectrum – for example, if you wanted to use the ADC to monitor a signal that had a 0-1.5 volt range you could get the full scale of the ADC by connect AREF to a 1.5V signal. DO NOT CONNECT A SIGNAL OUTSIDE ...
There are two ways you can get more pins out of an arduino.
The first way is by using the Analog pins as digital output pins, which is really easy to do. All you need to do is refer to A0-A5 as pins 14,15,16,17,18,19. For example to write high to pin A0 just use digitalWrite(14, HIGH).
The other way to get more pins out of the Arduino is by using a Shift ...
You can do this using external interrupts. Most Arduinos only support this on a limited number of pins though. For full details, see the documentation on attachInterrupt().
Assuming you're using an Uno, you could do it like this:
attachInterrupt(0, pinChanged, CHANGE);
The problem is specifically pins 0 and 1. Although they can be used as regular digital IO pins, they also serve as the RX and TX pins for the Uno's serial port. The USB connection (for uploading sketches etc.) is routed to the same pins internally. Unfortunately that means anything connected on pins 0 and 1 can interfere with the serial connection, ...
If you want to drive LEDs, then you can also use a MAX7219 that can drive 64 LEDs, without extra circuitry (no need for transistor to amplify signal).
Driving a MAX7219 requires only 3 output pins on Arduino.
Also, you can find a few Arduino libraries for it.
You can also chain several of them if you need to power more than 64 LEDs.
I have used it ...
From page 411 of the ATmega328P data sheet, we have a graph of the output current vs voltage.
We can see over the the 20mA range of output currents, we drop ~0.5V, giving an approximate internal resistance of 25Ω.
A typical LED has a forward voltage of about 2V. Therefore, we end up in the situation where we will drop 3V over the 25Ω internal resistance ...
You can use Charlieplexing. With this technique you can directly drive n*(n-1) LED's from n pins. So with 3 pins you can drive 6 LED's, 4 pins - 12 LED's, 5 pins - 20 LED's and so on.
Six LED's on 3 Pins
0 1 2 1 2 3 4 5 6
0 0 0 0 0 0 0 0 0
0 1 Z 1 0 0 0 0 0
1 0 Z 0 1 0 0 0 0
Z 0 1 0 0 1 0 0 0
Z 1 0 0 0 0 1 0 0
0 Z 1 ...
The VIN pin is directly connected to the USB's 5V supply. Which means that when the board is powered by USB you can take 5V out of that pin.
You cannot control that voltage. It is always on, and always 5V (or whatever your USB port happens to provide - 4.75v - 5.25v).
You must never ever connect VIN to a power source and connect the USB socket. That can ...
To drive such high currents, you may have to cascade several transistors (you can also use a Darlington transistor). There are arrays of Darlingtons mounted in a chip (e.g. the ULN2803A has 8 darlington transistors, but is limited to 500mA).
You probably will have to deal with higher power transistors; as an example I have found STMicroelectronics TIP110 ...
You can use the I2C protocol (Wire library) to connect to other devices such as port-expanders. For example, the MCP23017.
I used one of those chips to connect to an LCD board. The MCP23017 has 16 ports, which can be configured as inputs or outputs. As inputs they can raise interrupts if desired.
Example of connecting 13 of those 16 to the LCD:...
Concerning the AREF pin, you have to remember that the Arduino comes with a 10bit ADC (Analog-Digital-Converter), which converts incoming voltages between 0V and 5V to integer values between 0 and 1023. This results in a resolution of roughly 4.8 mV.
If a sensor only delivers a lower maximum voltage, it is resonable to apply this voltage to the AREF pin, ...
Shift registers have been mentioned in other answers, and they are definitely an excellent choice for many projects. They are cheap, simple, moderately fast, and can typically be chained together to add more outputs. However, they have the downside that they usually need exclusive use of several pins (between 2 and 4, depending on how you set them up).
am I going to fry my board?
Pretty likely outcome. Here's why:
The Arduino Uno uses the atMEGA328 microcontroller, which has an absolute maximum rating of 40 mA source or sink per GPIO. Also, the total current through the supply or ground rails (i.e. the total of all current OP wants the GPIO pins to sink, or source) is rated to a maximum of 150 200 mA.
Any floating pin will act as an antenna, and may interfere with values around it, this is one of the major disadvantages of using analog.
To get the most accurate readings with minimal amount of interference, you can pull all unused inputs to ground.
The accuracy will not change, as the accuracy is determined by the sensor itself. However it will reduce ...
Leaving series resistors out will definitely greatly (exponentially) shorten lifetime of both the controller and the LED. Absolute maximum ratings for most AVRs are (a.o.):
max. 40mA per GPIO pin
max. 200mA per package.
A new Arduino sets you back $20 or more, a fist full 220 ohm resistors sets you back 1$. When treated within spec, an Arduino (and LEDs ...
There are three things you can do:
Remove the bootloader entirely and program the board with a hardware programmer (USB-ASP, Another Arduino, etc).
Edit the bootloader source, recompile, and reinstall it to the board using a hardware programmer (as in option 1).
Just don't use pin 13 for the relay.
Of the three options the third one is by far the simplest.
You have your parameters the wrong way round:
However: pin 2 on the Uno cannot do PWM, so you will have to pick a different pin. Look for the pins marked with ~ - they are the PWM pins. On the Uno that is pins 3, 5, 6, 9, 10 and 11.
SVG = Signal, Voltage, Ground.
The Signal pin will carry the actual output, which may be high or low at any given time. It's basically just a male version of the corresponding standard GPIO pin. The Voltage pin will always be high (which can be 5v or 3.3v on this board, depending on the output level switch). The Ground pin is exactly what the name suggests -...
This is known as contact bounce and happens when the metal contacts in the button or switch bounce against each other when you push it. The microcontroller is fast enough to pick up these bounces and, as far as it's concerned, you're toggling the switch many times in as much as 10 milliseconds of time.
Different switches and buttons will ...
These are the In System Programming (ISP) pins. They are used to program the microcontroller without using the bootloader.
The bootloader is a program already loaded into the flash of the microcontroller that allows the program to be loaded into the microcontroller through the Tx & Rx serial lines and hence not requiring a programming device.
It is quite easy actually:
Serial.print("number of digital pins: ");
Serial.print("number of analog inputs: ");
Note that these are compile-time constants defined as macros in a file
named pins_arduino.h. There is one such file for every board supported
by the Arduino environment. Just to ...
ICSP stands for In Circuit Serial Programming, which represents one of the several methods available for programming Arduino boards. Ordinarily, an Arduino bootloader program is used to program an Arduino board, but if the bootloader is missing or damaged, ICSP can be used instead. ICSP can be used to restore a missing or damaged bootloader.
A typical ...
No, it's not going to work - even worse, you risk frying your Arduino -, for the following reasons:
The Arduino data pins can't source (neither sink) enough current for that to work.
The inductive kickback of the motor could fry Arduino pins.
The right way to do what you want to do is using an H-bridge controlled by your Arduino data pins. There are lots ...
Your first snippet is the correct solution.
Be careful though, you can only sink up to 6mA or 9mA per pin (as per the documentation ["Input and Output" section], I never tried more). If you need more current, use a transistor (this looks like a good example, you just need to invert the output pin to ...
The link you provide looks rather old and I don't think it applies to UNO Revision 3 as it has more pins than on the diagram you show.
I suggest you rather take a look at this Arduino UNO link which contains uptodate information about the UNO; in there you will see that for R3, the "power rail" has been extended and has the following pins, left to right:
The -AU and -PU suffixes on the part name indicate different packages. The former is used for the "32A" package (32-lead TQFP), and the latter is used for the "28P3" package (28-lead DIP). In plain English, the -AU is a surface-mount part, and the -PU is a breadboard-friendly chip.
As far as functionality, there is virtually no difference. The 32A package ...
It is possible to use the LED on pin 13 again by disabling the SPI bus that is used by the SD library to read/write data to/from the SD card. To disable the SPI bus, simply call SPI.end() after closing the file on the SD card.
I'm going to steal my answer from when I answered this question on the last arduino SE attempt.
This is a bit complex. Basically, there are a number of limiting factors:
The IO lines from the microcontroller (i.e. the analog and digital pins) have both an aggregate (e.g. total) current limit, and an per-pin limit:
From the ATmega328P datasheet.