Hi, I'm ecstatic that I'm the first to post a topic here!! Go Arduino!
Anyhow, I am trying to design a little circuit to properly allow using a digitalwrite command to restart the arduino. However, whenever I write the circuit the 555 trigger to low, the LED stops working as it should, but the arduino never restarts. I can't seem to figure this out. Can anyone help out? Below is my schematic, sorry if its messy.
no but from what i could find after scouring google is that using a 555 timer was probably one of the best and sure ways to deliver a clear and stable restart. i just want to be able to issue a restart(); type of command in the sketch
No for three reasons: 1) You didn't label the pins on the 555. 2) I don't understand your Transistor Symbol. 3) I'm not familiar enough with 555 circuits to tell what a valid setup is.
Your hand-drawn attempt is better than most! However, #1 and #2 need to be fixed...
sorry i wasnt clear...the 555 pins on left from top to bottom, 1,2,3,4...and on right from top to bottom 5,6,7,8...the transistor is just a normal common pnp. i wonder why there isn't too much traffic going on in this forum yet
Just a thought, could it be that you are dropping 0.7V +/- over the transistor and another 0.7V +/- over the LED thus your reset is hovering around 1.5 volts and not 0V?
This in conjunction wit the fact that your 5.0V is in fact 4.5V then maybe it is not just enough to trigger the reset?
Harko.
If I have lost the plot - please let me know where I have gone wrong with my thoughts
A 555 monostable circuit will drive pin 3 HIGH when triggered. The circuit is ideal for an NPN transistor but not for a PNP transistor as you specified. If you drive the base of an NPN, according to your circuit, it will supply ground potential to the cathode of the LED. So I'd use a 2N4400 instead. (or what ever small signal NPN you have)
NOTE: Collector to Cathode, Emitter to Ground, Base to Arduino using at least a 1K resistor.
I can only assume you have drawn a monostable... showing us which pins you are referring to would help in the future.
From looking around online, I had seen that using the watchdog aspect of the arduino is not the best idea because with the arduino bootloader it can sometimes get stuck in an infinite reboot sequence which would not be good, as this device will be far far away from any other humans.
The reason I am using an PNP is because I am inverting the signal from pin 3 of the 555 so that pin 3 is always high unless pulsed low by the arduino which then pin 3 is low for a given time, giving the arduino a nice clean restart. From what I have found, you can use an npn in theory to invert the signal. However, with a couple different types of NPNs i have, such as the P2222A, I do not get an inverted signal.
My guess as to why RESET is not being driven low is that unless specifically tied to GND directly it is still being held high by internal circuitry (onboard the arduino). Only problem is, I can't figure out a way around that. While sitting here in class I will draw up a better circuit diagram to post.
I don't think you should be looking at an NPN as an inverter. That's going to mess you up in this case.
Yes, you can invert a signal with it... but you need to see what you are working with here.
The 555 will hold pin 3 LOW until triggered, then it will briefly go HIGH. So what does this do with an NPN. The NPN will not conduct (at all) until the BASE is more positive (IE 3 is high). When it conducts, it complete the path to GROUND, supplying a complete circuit for the LED and pulling the RESET PIN low on the Arduino causing it to reset. The resistor to V+ on the reset pin HOLDS it high until PULLED DOWN but the conducting transistor. When PIN3 goes LOW, then the path to GROUND goes away when the transistor stops conducting, LED goes out and Arduino no longer has a /RESET condition on the pin.
The resistor to V+ is critical to getting the right voltage levels on the pin, since when the transistor stops conducting, it is effectively removing itself from the circuit.
With a PNP, you get NONE of that nice behavior in this circuit as you have drawn. Since the PNP would want to conduct when when the base is LOW relative to the Collector. (a condition you cannot meet with this circuit) and you are always "driving" the transistor when the 555 is IDLE and you STOP satisfying the BASE when the PIN goes high.
EGAD... I'll stop here... sorry for my ranting in advance.
phinsil6:
sorry i wasnt clear...the 555 pins on left from top to bottom, 1,2,3,4...and on right from top to bottom 5,6,7,8...the transistor is just a normal common pnp. i wonder why there isn't too much traffic going on in this forum yet
The 555 would have pins 1..4 from top to bottom on the left side, and 5...8 from bottom to top on the right side. I don't know if that's part of the problem here.
We just switched to a new forum system. Look at the bottom for the archives...there are hundreds of thousands of posts.
Thank you pwillard. A diagram is always much much clearer than words The whole inversion thing makes more sense now too. When I get home I will try and build this circuit and post how it all goes.
Also, for verification purposes or anyone else looking at this thread trying to figure out a way to restart the arduino, attached below is my schematic that i will test later on today....OR not cuz the arduino forum is not allowing that yet, look below:
(edit...sorry for all the white space)
phinsil6:
From looking around online, I had seen that using the watchdog aspect of the arduino is not the best idea because with the arduino bootloader it can sometimes get stuck in an infinite reboot sequence which would not be good, as this device will be far far away from any other humans.
That depends on the bootloader. The advice in the Atmel datasheets say the first thing the bootloader should do is disable the watchdog timer to avoid this...
All of the bootloaders that I have looked at in the current source tree CAN clear the configuration and check to see if the reset was due to a WDT, and if so immediately start the sketch.
For example from the source "Arduino / hardware / arduino / bootloaders / atmega / ATmegaBOOT_168.c"
int main(void)
{
uint8_t ch,ch2;
uint16_t w;
#ifdef WATCHDOG_MODS
ch = MCUSR;
MCUSR = 0;
WDTCSR |= _BV(WDCE) | _BV(WDE);
WDTCSR = 0;
// Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
if (! (ch & _BV(EXTRF))) // if its a not an external reset...
app_start(); // skip bootloader
#else
asm volatile("nop\n\t");
#endif
So if you have this bootloader built with WATCHDOG_MODS defined, then you get deterministic watch-dog behaviour... and the restart-time is faster because the boot loader skips all the hanging around for a sketch download to start.
It does seem like a simple software configuration problem to me:).
UPDATE: when the arduino drives the the 555 trigger low, the RESET pin of the arduino pin is driven low as it should, however the arduino RESET pin is staying low as the pin from the arduino is in some kind of high z state and so the trigger of the 555 is doing something strange. Is there some way to fix this or get around the 555 problem? maybe use a transistor on the trigger and connect the base to the arduino output pin?
I hope this thread isn't dead yet
(FYI, the schematic is as shown in the previous post)
You can set up the 555 as a one-shot (monostable), howeverpin 3 toggles from low to high forthe one-shot time duration, then goes back low. So you'd have to put an inverter on the output,which could be a simple NPN transistor; 555 pin output 3 thru say a 1K resistor to the transistor base, collector to the arduino reset pin, and emitter to ground.
pwillard, i wish i could give you more than 1 karma point...the circuit now works wonderfully
for anyone else trying who reads this post and wants a good clean restart without having to modify bootloader or any other "tricks" to reboot their arduino, below is your circuit!
Note: The pin from the arduino must be set as an output and pulsed low to trigger a reset