We've broken up the topics of cooling, stress testing, and overclocking your Raspberry Pi into individual tutorials to make it easier to digest. This is the third tutorial of the three: overclocking.
How to Overclock your Raspberry Pi 3 Model B
Hey guys, how are you going, it’s Sam here from Core Electronics and before we get started don’t mind some of the noise, it is raining today, unfortunately. But, nevertheless we’re going to take a look at overclocking your Raspberry Pi today. So what you’re going to need, you’ll need a Raspberry Pi and it helps if you’ve read through the other two tutorials or videos in this mini series. So this is Overclocking Your Raspberry Pi and it’s the final instalment in this 3 part series on how to increase th performance of your Raspberry Pi. First of all we looked at Cooling Your Raspberry Pi with heat sinks and fans and different options. Then we looked at Stress Testing Your Raspberry Pi, how you can really put it through its paces and see if your cooling system is up to scratch and whether we can use those stress testing once we’ve overclocked it to determine if the system is stable.
Let’s take a look at what we are actually overclocking, what is overclocking if you don’t know. Well, traditionally overclocking referred to increasing the clock frequency of a chip. So, for example a microcontroller or a microprocessor, a CPU, will perform instructions on a clock cycle so a clock cycle is just a square wave and every clock cycle the CPU can do something. So on an edge the faster the clock cycle is then the more instructions per second the CPU can perform and hence the faster it is, we’re overclocking it.Now that’s all well and good but nowadays overclocking isn’t just limited to increasing the CPU clock frequency, indeed there’s heaps of other stuff we can overclock. We can increase the clock frequency of the GPU modules so increasing the graphics performance. We can overclock the SD RAM to get faster memory, we can overclock the CPU/GPU memory allocation to decide how our RAM is being split out between the GPU and the CPU, all different things like that give us increased performance depending on what you want to do. Now it’s important to note that there is no one configuration setting that is going to be best, it depends on your application so if you’re running a RetroPie set up for example it’s really graphic intensive then you’re going to want to give the GPU more memory compared to the CPU than if you were doing other stuff like lots of document editing and web browsing, so it really does just depend on your application. We’re going to go through some of the different settings you can overclock and some recommended example settings which will work on all Raspberry Pi boards to give you a good general performance boost and then you can take those and have a play around and really tweak your Raspberry Pi for your specific project. Now it’s also important to take note that not every Raspberry Pi board is created equal, sure they all have the same specs but when silicone manufacturers are creating the chips, so for example the BCM2837 system-on-chip (SOC) that is at the heart of the Raspberry Pi, not all of them are created equally - there’s variations in the silicone due to the manufacturing processes. So what the manufacturer does is they find a clock frequency that they can guarantee every chip will clock at and for the Raspberry Pi 3, the BCM2837 they set that at 1200 MHz or 1.2 GHz so every chip is guaranteed to work at that frequency, straight out of the box they’ll work. But of course, some chips will overclock better than others because of better silicone yield , so some chips might overclock 250/300 MHz where as others might only yield 100/150 MHz gain, so just because you hear of someone who can overclock his Raspberry Pi to this limit or that, it doesn’t mean you can. It’s important to test out your Pi and find out whats going to be stable because if you clock it past the silicones capability you’ll find that you’ll get system crashes when it’s under load or it might not even boot at all so today we’re going to look at taking our Pi right to the limit of instability, testing it and putting it under stress and making sure that its stable and then dropping it back to that next really stable system configuration so that it will run smoothly but still get that increased performance.
So let’s take a look, so thats Overclocking Your Pi and why and how, now what settings can we actually change. Well, first of all the main one is we have the ‘arm’ frequency. Now that is the frequency of the CPU cores by default it is set to 1.2GHz or when idling it throttles the cores back to 600MHz to save power. You’ve got GPU frequency which is the frequency of the graphics processor as well. SDram frequency, the speed of the memory, over voltage which controls how much voltage is being supplied to the CPU when you overclock it, it needs more power to perform those clock cycles so to get that stable system its going to be important to increase that voltage as well. Next up we have forced turbo, now it’s important to note that when you’re overclocking, overclocking you do it at your own risk but it’s generally safe. There are some overclock settings which will void your warranty on your Raspberry Pi if set, there’s a hardware bit that cannot be changed once it has been set. Forced turbo is one of these settings, what forced turbo does is it ensures that your Raspberry Pi will always run at the maximum clock speed rather than throttling and scaling that and it’s going to run at 100% all the time at that max frequency which can reduce the lifespan of your Pi if you run that all the time which is why it voids your warranty. Now with over voltage it ranges between 0 - 8 however if you want to use the settings between 7 and 8, 6 is fine, pretty much everything but if you want to use 7 and 8 you can’t do that unless you set forced turbo. So setting it to 7 and 8 will also void your warranty. Now we have temperature limit and this is another one of those things that voids your warranty, getting to the pointy end of the stick now! Now by default this is set to 85 degrees which whmeans if you overclock your Raspberry Pi or if you’re running something and it starts to get too hot, gets to 85 degrees it will scale back the CPU clock frequency and this is to prevent any damage from coming to your Pi board incase it overheats. If you can set this to a much higher limit to disable that, if you want, if you really know what you are doing but again, it will void your warranty. Lastly we’ve got GPU_mem it sets that memory allocation between the CPU and the GPU that we were talking about. This is fine to use and you can control how that’s set depending on whether you’re using a CPU intensive application or a GPU intensive application. Now there’s plenty more of these, you can look up the Raspberry Pi documentation for more info but that’s the general settings which will yield the most noticeable performance gain.
Alrighty, now we’ve taken a look at some of those setting how do we actually implement them? Well, when the Pi boots up it takes it’s system settings from the SD Card in a file called config.txt which is in the top boot level of the SD card directory so we need to alter that. So plug your Raspberry Pi in and go into the terminal now to access this file we use the command sudo nano/boot/config.txt and it takes us to this. This is where you can set all kinds of different settings but today we’re going to be looking at overclocking specifically. So i’ll take you guys to that screen now so you can see what I’m doing here, now scroll down to the very bottom, you can put it where ever you want but it’s easier if you keep all your overclock settings in the one place. So let’s try increasing the core frequency a little bit, first of all we’re going to set it to, let’s try a slight increase to 100MHz which is pretty much every Raspberry Pi board should be capable of. So we’re going to go (07:17) arm_freq=1300, i’ll double check I’ve got that correct, yep, arm_freq, there we go, yep 1300. Now it’s going to run that as soon as the load starts getting really intensive so we need to try and step that load up so thats next, save and exit, press control-X Y and hit enter. Now we need to reboot for these settings to take into effect because it reads the config file as its booting up - sudo reboot. Now while that’s going on the systems can become unstable as we were talking about so if you set your clock frequency higher than the silicone can run at and it just doesn’t cope it will either crash when you put it under an intensive load such as stress testing or it may not even boot at all. If it can’t boot at all, don’t worry, all is not lost, you simply take the SD Card out, plug it into a card reader on your computer and then you can find the config.txt file, change the settings pop it back into your Pi and away you go. No harm done to the Pi. So, now it’s booting up let’s take a look back in terminal and we’re going to run one of the stress test applications we looked at in our last video called Stress Testing Your Raspberry Pi. You use the up arrow to cycle through previously entered terminal commands, so there we go, so because I haven’t used force terminal it’ll start off with 600MHz round about till it’s stabilised then when it starts to come under load it should shift to that higher clock frequency, there we go! 1300, instead of 1200 we have 1300 for our clock frequency which is really really cool.
Now as we increase that clock frequency the CPU is going to draw more and more power which is going to cause the chip to overheat which is why it’s really important that you have a big cooling system there, its actually once you start getting to the highest settings. So, that’s all well and good, easy overclock, not a problem, it seems to be pretty stable. Oh, its just cracked 50 degrees and I wouldn’t imagine it will get much past that. It increased 9 degrees in the first 10 seconds but now its only climbing a degree or so at a time, its probably going to get to around 55/56 degrees and then stop. So when you’re stress testing you should run these tests for at least 10 minutes and if it reaches that temperature threshold it has to scale the CPU back or if it crashes then the test has failed and you need to go back and tweak some of your settings or adjust your cooling method. But if it doesn’t, if it’s all good, then not a problem we can go onto the next setting. So you should stress test your Raspberry Pi at least for a minute or two to gauge whether its going to be stable. So the mouse moves, everything is nice and responsive still, there’s no crashes so we might try increasing our overclock settings now. So exit that terminal and lets go back to our config.txt file (09:56) Now we’ll scroll down and I’m going to implement some more settings now and look at a collection of example settings which are going to give you a really good performance boost across the board. Where are we, so arm_req =1300 so we’ll try this at 1350. I know this particular Pi can overclock to 1450 MHz and still be stable which is really cool, another Pi I had only got to 1350 before it would become unstable but that’s sort of a bottom of the barrel one. Alright, so let’s increase the core voltage just to make sure that the CPU is going to run stable, try and bump up the RAM a little bit get a little bit more performance gain in there and we’ll adjust the GPU memory allocation to 128. Now you can force turbo here if you like, however it’s not really necessary because we’re going to see the clock frequency jump up to the maximum level when we stress test it under load anyway, it’s only if it wasn’t under load where it wouldn’t revert back to that to save power, plus it voids the warranty and we don’t really need to set it now. Alright so let’s save that,so the use pace will still be really snappy so you won’t notice any performance gain there but if you try running any RetroPie Emulators or a lot of flash plug ins on your web browsing you’ll see that performance increase. So let’s reboot and see how we go. Alrighty so our Pi is booting back up and this should be a pretty nice build. Let’s go to Terminal and we’ll run stress and we’ll see how it copes and then we’ll try running CPU burn and see what kind of temperatures it gets up to. So its already clocked in at 1350 MHz and everything is nice and stable which is good. We’re sitting at 52 degrees, so we’ll let that run for another minute or so and we’ll try CPU burn. So, we’ll go to stress testing to find the correct command CPU burn. So how’re we’re going here, right we’re only up to 55.8 so normally we’d let it run for the full course but to demonstrate we’ll go and try CPU burn out and see whether we maxed the temperature out or not! It will be interesting. So i’m just going to modify that to (12:44) double check that’s right, fantastic, alright, let’s give that a run. Alright, so it’s dropped back down to 44 degrees and idling at 600 MHz and how will it fare now? Alright, we’ve jumped already to 66 degrees WOW this thing is taking its toll, now I’ve only got a small 30mm fan in here and quite a large heat sink which is good and I haven’t even used any thermal paste on it which would make it much more efficient than the built in thermal tape which came with the heat sink so it would have been made alot more efficient if it had perhaps 50mm fan in there and used proper thermal paste on there. It’s already jumping up to 72 degrees and I wonder if it will crack the 80 degree mark which is where you get a temperature warning notification. Alright, not too bad, it’s starting to plateau out now and it might just survive CPU burn.
So just remember that there is no one size fits all solutions for overclocking and we’ve looked through some of the different options for overclocking. Now find what you want to use your Raspberry Pi for, whether its a media player or a web server, or a RetroPie system you know, whatever it is and play around with it and find what settings are giving you the best performance gain. You don’t have to increase the config.txt file in terminal, you can change it in your computer and put it straight into say, media centre operating system and that’s going to give you a really really good indication of performance gain when you’re streaming high definition stuff. Alright, so we’ve had a slight drop in temperature there it got up to 77 and now it’s dropped back to 74 which seems to be pretty consistent, back to 76, alright so it looks like it might just be averaging out around the 76 77 mark which is pretty awesome running CPU burn with nothing but a 30mm fan and a medium sized heat sink is awesome especially overclocked as we are. So that’s all there is to it guys, overclocking is really easy and there’s nothing to be afraid of when you are overclocking unless you’re going to set those warranty void settings in which case just be careful and make sure you know what you are doing. And again, you overclock at your own risk and it’s important to note that this is overclocking with the Pi3 which doesn’t have overclock enabled through the config.txt in the file in the menu, you actually have to go into the physical file itself and change the options. There were other overclock options with the original Pi and the Pi 2 however they’re not available in the Pi3 so presumably they’ve really got that System-on-chip to a what they consider to be the highest guaranteed clock setting but of course we can see that 9 times out of 10 we’re easily going to be able to get stacks more performance out of that. So yeah, thanks for watching guys and hopefully this mini series on Cooling, Stress Testing and Overclocking your Raspberry Pi has helped you understand a bit more under the hood of the Raspberry Pi and how you can really get the most out of it for only a few extra dollars and a couple of lines of code. That’s all for now guys, seeya :-)