Quirks:
Not all Arduino nano's are created equal! Some use the FTDI chip for USB, some use CH340G chip for USB (cheap Chinese Nano clones, including the last round that I bought bulk).
The FTDI chip is a fatter chip on the back side of the Nano, mounted near the USB connector.
The CH340G is a skinnier chip, about 1/8th" wide, also mounted on the underside near the USB connector.
If installing the IDE, or using either version for the first time, you'll need to go online and install the driver for the version you have.
Not all pins can be used for Software Serial - Only use pins 8, 9, 10, 11
Avoid using pin 13, since it is tied to the onboard LED. Use it only for status, if at all.
Serial UART: Will not work if the USB cable is plugged in. If you want to use the serial pins (D0, D1), you have to program the chip, unplug the USB cable, and then separately power the chip (not using the USB port). Better to use the Software Serial solution.
Use pullups on I/O pins.
I have found a couple of the Nano parts that will not program over a long cable. Use the short blue cable provided for programming. Error with the longer cable is something about avrdude not being in sync.
Be sure to use the EXTERNAL AREF if using the analog input ports. They'll be within 20% with the default internal reference - but are pretty random and spotty. Using the external AREF with a solid reference voltage will provide a consistent result within one or two lsb's.
IMPORTANT - When using the "AREF" pin, you should drive the AREF pin through a 4.7K current limit resistor. The pin comes up at 5V by DEFAULT. Tying the AREF pin to a voltage directly will short it out!!! Also, be aware that the pin has a 32K internal pull up resistor - so the voltage at the pin (after the 4.7K resistor) will not be the voltage on the input of the 4.7K resistor.
In the SETUP routine ( "void setup(){" ) -- you MUST INCLUDE the "analogReference(EXTERNAL);" statement!!! Otherwise, the 5V default value will be used. You should also loop for a little bit throwing away the analog input read values while waiting for the read value to settle down.
void setup() {
int i;
analogReference(EXTERNAL);
Serial.begin(9600);
for(i=0;i<10;i++){
aval=analogRead(apin);
Serial.print("Throw away apin val: ");
Serial.println(aval);
}
}
From the "Maker: AVR Programming" book, the ATmega328 supposedly uses a DAC and comparator to determine the analog input voltage, possibly with a binary sort type algorithm, starting at .5*AREF, testing to see if the input is higher or lower than that, then taking half of the next value to close in.