I recently assembled an 'Arduino on a breadboard' as outlined on one of the pages on the Arduino website. However, I kept getting errors when I tried to upload any sketch. After much searching on these forums, I found that the answer was to hit the physical reset button shortly after you hit the Upload button in the Arduino IDE.
I was just wondering why this is, because you don't have to do that when using the store-bought Arduino boards. Is there something I can do to make it so that I don't have to remember to hit the reset button each time I upload a sketch? Not that this is a huge deal, but it would be nice if I didn't have to. It must be a piece of hardware (electrical component) I'm missing?
If you have a 0.1 uF capacitor in series with the RTS line, you shouldn't need the reset button. Halfway down that page I uploaded a sketch without having to press a reset button (I didn't have one).
In order for the Arduino to be able to accept the new sketch it has to be running the bootloader.
The bootloader is the first bit of code the Arduino runs after a reboot or power-up. After a short timeout, if no sketch has been received, the bootloader exits and runs the currently loaded sketch.
Normally the Arduino performs a reset whenever the serial port is opened by the computer. This is both annoying and convenient. Convenient in that when you go to upload a sketch the Arduino reboots and enters the bootloader automatically. Annoying because when you connect your running Arduino to a computer and open the serial port it reboots it, losing any data in the RAM.
So adding the capacitor as mentioned will enable the auto-reboot - it will also enable the wipe-your-Arduino's-RAM function on opening the serial port.
Ok, the whole waiting for a timeout because of the bootloader thing makes sense...in fact, I think that would explain why my sketches take a second or so to run after powering on or resetting when I'm running off of this breadboarded hardware like this. However, what I don't understand is that why is it that the same exact sketch (and chip) runs instantaneously when powering up/rebooting on an actual, store-bought Arduino Duemilanove?
I think the timeout may be shorter on those - with the auto-reboot function you don't need as long a timeout. I'm pretty sure there is still a small delay on my UNO. There are a couple of flashes from the LED while it boots - it's not instant, but it's pretty quick.
domiflichi:
However, what I don't understand is that why is it that the same exact sketch (and chip) runs instantaneously when powering up/rebooting on an actual, store-bought Arduino Duemilanove?
Can't be different bootloader because i can take the chip off of the store-bought board and move it to the breadboard and there is a delay on the breadboard circuit when powering on, but no delay when it was on the actual store-bought board when powering it on with the same chip.
Since I'm a noob, I'm still trying to figure out the whole pull-up / pull-down resistor stuff - could you elaborate a little more please? What kind of resistor (1/4W?, how many ohms), and do I connect it to ground or +5V?
10K (the exact value doesn't matter much) between the pin and +5V. That is a "pull-up" because it weakly pulls the pin "up" to 5V. A "pull-down" would be tied between the pin and Gnd.
The reason for 10K (rather than, say 10 ohms) is the current it would draw if the pin happened to be configured as an output and set low.
Using Ohm's Law, I = E/R the current would be 5 / 10000 which is 0.5 mA. However if you used 10 ohms it would be 5/10, which is half an amp (which the pin can't handle).
So, since it is 0.5 mA the wattage will be low (5 * 0.5 mA = 2.5 mW) and thus a 1/4 W resistor (250 mW) would be plenty.
The reason for it is, without it the line (Rx) will probably have noise on it, and the bootloader will take a few seconds trying to make sense of the noise before it gives up.
We are getting a bit off topic (what else is new?) but here's how I have always dealt with 'E' and 'V'.
The symbol 'E' is an abbreviation of the term 'electromotive force' or 'emf' which is the potential energy supplied by a supply such as a battery.
The symbol 'V' is an abbreviation of the term 'voltage' which is typically a quantity that is measured with a device that is not surprisingly called a 'voltmeter' or calculated using Ohm's law or Kirchofff's voltage law.
Many people use the symbols interchangeably, but technically you probably shouldn't do this. You should use 'E' to represent voltages that are supplied by a battery or other power supply and use 'V' to represent voltages that are measured with a voltmeter or calculated by one of the various electrical 'laws'.
Since you shouldn't apply Ohm's law to a power supply (or anything other than a resistor) you probably should use 'V' when expressing that law.
This is kind of like saying that speed is the miles-per-hourage of an automobile measured in miles per hour. Your 'voltage' version is quite common and almost universally used, but technically just as wrong as my example.
That is because this Internet resource claims that P = Watts, I = Amperes, E= Volts, and R = Ohms. In all four cases the author is using the unit instead of the name. The only one that is even remotely correct is E=Volts, and that is only due to convention as mentioned above.
P = Power, I = Current, E= Potential , and R = Resistance
Well I put a 10k resistor between pin 2 and 5v, and it didn't seem to change anything - still 2-3 seconds delay between plugging in power and my LED turning on.