Go Down

Topic: Why is the reset button required on my 'breadboard arduino'? (Read 4531 times) previous topic - next topic

domiflichi

Hello,

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?

Aside from the Breakout Board for FT232RL USB to Serial  - http://www.sparkfun.com/products/718, here's my circuit:



Thanks,
Jamie

Jack Christensen

A 100nF capacitor can be used as shown in the schematic below to create an auto-reset circuit.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Nick Gammon

See this page:

http://www.gammon.com.au/forum/?id=11637

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).
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics


majenko

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.

domiflichi

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?

Thanks,
Jamie

majenko

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.

Nick Gammon


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?


Could have a different bootloader on it.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

domiflichi

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.

Nick Gammon

Put a pull-up resistor on Rx (D0 or pin 2 on the chip).
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

domiflichi

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?

Thanks,
jamie

Nick Gammon

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.

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

majenko

Quote
I = E/R


E?  Do you use different units down under?

E is energy, isn't it?  V is volts.

I = V/R

Nick Gammon

http://www.the12volt.com/ohm/ohmslaw.asp

You may as well say it is:

A = V / ?

I is current (measured in amps (A))
E is voltage (measured in volts (V))
R is resistance (measured in ohms (?))
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

Also see:

http://www.onlineconversion.com/ohms_law.htm

I admit there are other sites that use V for voltage (and hey, I wish it had been that way from the start!).
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up