
One of the changes on the Rev 2 Raspberry Pi board, which I haven’t seen anybody write about yet, (apart from Eben in his original announcement) is the addition of two holes for a header at P6. These were added to enable a reset facility. Shorting those two pins together resets the processor.
This was too good an opportunity for my curious mind to pass up, so I decided to add a 2 pin header there and try it out.
As luck would have it
It just so happened that last week I was given an old PC, which I took apart for fun (and parts). One of the salvaged parts was a reset switch connected to exactly the right kind of (2.54mm) 2 pin female socket.
I had a stack of pin headers in stock already. So I just cut off 2 pins’ worth and soldered it into the P6 holes (with leaded solder, to minimise heat to the Pi).
Then I pushed on the connectors for the switch, booted up the Pi, logged in and let it settle.
And then I pressed the reset switch. And it worked. The Pi reset and rebooted without a hitch. :)
Will it bring the Pi back from a halt?
So having logged in again and tried it again, I shut the Pi down with sudo halt. Then I thought mischievously to myself…
“I wonder what happens if you press it while the Pi is connected but powered down?”
So I tried it. And…
The Pi booted back up again :) So you can also use this header to bring your Pi out of a shutdown state, provided the power is still connected.
You don’t strictly need a switch
Of course, you don’t need to install a “proper” reset switch. A jumper would do, or even a paperclip. You don’t really even need to put a header on. You could short across the holes with your paperclip (it’s only a momentary connection). I’m not saying you should, but you could. It’s obviously the “preferred way” to use a header. I did consider putting a 2 pin socket there instead – to avoid accidental reboots – but the decision was made for me when I found the ready made reset switch. :)





Excellent stuff, Alex. I’ve not seen anyone blog about that before – will have to get the old solder iron out tonight.
I do wonder, though, what Linux will put up with in terms of resets. Will it _always_ recover?
Good point. Since starting to use better quality SD cards (Sandisk Extreme) I haven’t observed any OS corruption issues – but then, when the other cards were new I didn’t either. It would definitely be a good idea to make sure the SD card R/W led is not flickering when you reset (if possible).
I don’t plan on using it very often. It probably will only be connected if and when I need it, but I knew it was possible, so thought it’d be fun to do it. (And I was right :) )
I wouldn’t think it’s a good idea to use it generally unless your machine crashes to be honest. But it might be more use as a “bring back from shutdown” switch to avoid having to unplug from the micro usb port.
Loving your work :) My wife has sequestered my Rev2 boards as Christmas presents…but I shall be routing around in my parts bin for a similar reset swicth ready for xmas day ;)
Thank you. :) Have fun with that. There’s so many obsolete PCs up for grabs these days, it’s amazing.
I’ve taught my son about soldering by removing capacitors from a dead PC motherboard.
The inductors are tricky, but I know a little trick with a blowtorch and a pair of pliers :)
Hi Alex,
I just wanted to say thank you for your videos! They help my pea brain understand things I should not be able to :-D
I would love to see some more of the Gertboard, or possibly even a couple of easy tutorials but I am sure it would bore your socks off. Either way thank you and keep up the great work!
Regards,
Thanks for your kind words. I think it’s highly likely that I will be doing some more videos of the Gertboard, but I can’t promise exactly when. :)
A suggestion for a RPi Reset Solution : https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-ash3/598344_10200292731060072_510011818_n.jpg
Have fun!
Reminds me of a James Bond film. You could have a lot of fun with a “self-destruct” button too ;)
I just found this and I’m so glad about it I’ve offered it to those who’ve purchased a RaspberryPi with my HotPi kickstarter. http://www.kickstarter.com/projects/582604098/hotpi
[...] http://raspi.tv/2012/making-a-reset-switch-for-your-rev-2-raspberry-pi ← Raspberry PI som tidsserver (NTP) med hjälp av en GPS-puck. [...]
[...] พอดีไปเจอเว็บที่แนะนำการทำปุ่ม reset มาครับ ลองดูที่รูปของ Pi rev 2 ครับ [...]
I’ve been looking for a way to wake a Pi back up after a halt!
Thanks Alex :)
For shutdown I would write a bit of code which checked for a GPIO push and executed a halt command rather than just power off or reset the Pi. Linux will normally recover like you say but its definitely not a good idea.
I agree – it’s not for routine use. In fact I would only attach the switch if the Pi hung, which it doesn’t very often. I did this for fun because nobody else had done it yet. :)
Have a look at the most recent post and vid. I take it a stage further and use a relay instead of a switch. You could use one Pi to bring back another from halt.
But on that one I do a flush first. I’m just pushing the boundaries here. I wouldn’t recommend people use this to reboot unless there’s already a problem.
You can’t use it to shutdown anyway as it forces a reboot.
The “secure restart feature” might be worth a little hardware extension:
- A simple push on the reset button will be caught and directed to a GPIO PIN (or another not-so-often-used pin). This will be detected by an installed driver, which performs a secure soft restart.
- Only a long button press (5 sec) goes directly to the CPU reset P6 pin and forces a hardware reset.
As soon the button driver is loaded, the hardware extension must be contacted to prevent a direct hardware reset. If the driver is present, the hardware extension performs the 5s buffering.
This way the button always performs a P6 reset, if there is no driver present (or the raspi is powered off).
Sounds interesting. What hardware would be involved in your idea?
Thinking further, if you have a GPIO pin to spare, you could have one button for soft reset (via GPIO) and another for hard reset (via P6). :)
Just thinking out loud with my high-school understanding of electronics, but if you just had a time delay circuit (resistor in-line with a capacitor) to delay the shorting of the P6 header, couldn’t you still detect when the button is closed via GPIO and issue a soft “shutdown – h”, and only trigger a hard reset when the button is held down long enough for the capacitor to charge up?
Yep, I reckon that would work if you got the recipe right.
Thanks for this info, it helped me with making a wireless power on button so I can turn on my Pi from across the room. The resetting is not that important but resuming from a halt was amazing.
Here is my thread where I got the wireless button working. If you’re interested.
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=29339
I agree. Since I did this, I have had to reset my Pi precisely zero times, in fact I don’t even leave the button on there. Resume is of more practical use. Did you catch the next article with the relay? A couple of other people have used momentary switches and transistors to achieve the same effect. :)
[...] Raspberry Pi Rev 2.0 guide to making a reset switch Share this:TwitterFacebookLike this:LikeBe the first to like this. Categories: How To, Raspberry pi Comments (0) Trackbacks (0) Leave a comment Trackback [...]
Very sharp and beautiful pictures! What camera and lens do you use for it???
Thank you. Macro photography is a hobby of mine. :) Circuit boards don’t move about like insects do, which makes them seem relatively easy. The camera is relatively old (6MP) Nikon D100 I picked up off ebay a couple of years ago for about £150. The lens, on the other hand is a professional quality macro lens. Sigma 105mm EX DG. I also have an old Nikon SB-21 macro flash. I always shoot RAW and process to JPEG on the computer. It’s more work, but the results are worth it. :-D
The old adage of buying the best glass you can afford certainly applies. I’d love to see what this lens could do with a higher res camera. :)
I did this on the weekend with my Pi. Also have not used it for resetting, but have for power-up. One issue that I have is making holes in my beautiful case for a switch, or a wire to come out. I just had an idea now while reading the comments. I could wire a reed switch onto P6, then do a power up by bringing a magnet close to the box. Best part it, people who don’t know how the magic works, won’t be able to make it work :)
That’s a nice idea as long as your environment won’t give you a load of false resets. :) Should be OK as long as you don’t live near any large magnets ;)
Magnets are also (usually) how laptops detect if the lid is open or closed – but in this case they use a hall effect sensor rather than a reed switch.
what is the difference between this and a swith on powering cable?
This method resets the Broadcom chip without removing the power. It’s known as a soft reset I think, like the reset button on your desktop PC. Killing the power is a hard reset and is not very advisable on the Pi as it can cause file corruption on the SD card, data loss etc.
!!
AFAIK using this reset button instantly resets the CPU and has just as much chance of causing file corruption on your SD card as pulling out the power cable.
I’m not sure where your “soft” and “hard” reset terminology has come from, but according to this this page I guess the RasPi equivalent of a “hard reset” would be writing a freshly-downloaded OS image to your SD card ;-)
does this option execute the halt command?
No. See previous answer. It executes a soft reset. :)
Thanks a lot for this awesome guide !
I followed it and it works perfectly.
Now I’ll be able to tell my parents “Press the button with the blue/white wire” instead of “disconnect the micro usb cable – wait, which one ? – the black ! – all of them are black !”: :laugh:
I was a bit afraid to solder on my brand new raspberry but fortunetly it all went fine :)
Regarding the paper clip method. The old swedish computer magazine DMZ once had an article that described how you reset the C64 via the use of a paper clip. Lets just say that this article became very popular among shops that specialized in repairing broken commodore 64:s :)
Yup tried it! The only problem is in some states it can corrupt your SD card I’ve found out through web searching. So be warned!
Oh yes, resetting is not something you should do lightly. Did you catch the followup blog about a self-resetting Pi? In that there’s a script that does it more safely. Basically, if you sync the file system first it’s a lot safer. But let’s face it, the reset switch is there to reset the Pi when it crashes, so your only other option if “ssh and shutdown remotely” doesn’t work is to yank the power – which is also risky for the card. Since my Pi’s hardly ever crash, this is much more useful to me for bringing them back up when they’re shut down. ;)
Hi,
Nice hack, but my version of the board purchased from farnell doesn’t have this unpopulated header on it :(
J
Must be a Rev. 1 board. This header was introduced in Rev. 2 in September 2012.
I guess so as I ordered mine in February 2012 and got it in June.
J
The Pi also has some hardware watchdog timer capabilities that can be used to automatically reset in some conditions – might be a good first step for those doing unstable prototyping but less comfortable with taking an iron to their Pi, or just if the Pi isn’t accessible. This page has the basics:
http://www.megaleecher.net/Watchdog_for_Raspberry_Pi
Oddly enough I think I was reading about those somewhere the other day. I think it might have been on Gadgetoid. :)
A big thanks for this perfect tuto, that’s make me happy :)