Overclocking any style of Raspberry Pi is in reality easy. However overclocking the Raspberry Pi Pico is even more effective. All it takes is 2 traces of MicroPython and your Pico can simply run at double its standard velocity, and with out the desire for the best possible CPU coolers.
On this the right way to we will be able to overclock a Raspberry Pi Pico to 270 MHz, double the bottom velocity of 133 MHz. Then we will be able to write a script to check how a long way we will overclock, after which how low we will underclock the CPU.
You could be pondering “Why overclock a Raspberry Pi Pico?”The use of a low degree language, corresponding to C, the Pico is in a position to getting used to play video games corresponding to Doom (the overall sport) the usage of an HDMI output board. It might probably emulate unfashionable computer systems such because the ZX Spectrum and Commodore 64. With MicroPython, overclocking will give us a noticeable velocity spice up, and underclocking might supply us with longer battery lifestyles if we’re the usage of it in a battery-powered mission.
This the right way to will paintings with the Raspberry Pi Pico, Pico W and plenty of different of the best possible RP2040 primarily based forums when the usage of MicroPython. There are different strategies for converting the frequency when programming the forums in different languages.
Contents
For This Challenge You Will Want
A Raspberry Pi Pico or Pico W or another RP2040 primarily based board that’s operating MicroPython.
Overclocking the Raspberry Pi Pico With MicroPython
1. Set up the newest model of MicroPython to your Pico. For those who haven’t already executed this, practice as much as step 3 of this information to be told how.
2. Within the REPL, import the system module and test the present velocity of the Raspberry Pi Pico. The returned worth it will be 125000000 Hertz (125 MHz). Some forums or variations of MicroPython could have it set just a little upper via default.
import system
system.freq()
3. The use of the similar command, set the CPU velocity to 270 MHz.
system.freq(270000000)
4. Take a look at the CPU velocity to be sure that the overclock has labored. The returned worth must be 270000000 Hertz (270 MHz).
system.freq()
Presently this velocity spice up is transient. When the Pico is rebooted, it’s going to go back to its default velocity (normally 125 MHz). So as to retain the overclock, it will have to be set each and every time the Pico boots. Including those two traces to the beginning of any MicroPython code will overclock the RP2040 to the specified velocity when the code is administered.
import system
system.freq(SPEED IN HERTZ)
How Some distance Can The RP2040 Be Driven?
Overclockers are all the time taking a look to move simply that little bit sooner however how are we able to decide our success within the silicon lottery? For that we computerized the method with just a little Python code.
1. In Thonny get started a brand new document via first uploading two modules. Gadget is used to modify the CPU velocity, and time is used to tempo the code.
import system
import time
2. Create a variable, freq and retailer 270 MHz as Hertz. We all know that 270 MHz works smartly, so we begin from a identified running velocity. In case your objective is to underclock the RP2040, cut back the worth accordingly.
freq = 270000000
3. Create an object, velocity, and in there retailer the present velocity of the RP2040. The use of just a little math, the returned worth in Hertz is transformed to megahertz, then rounded to 1 decimal position, sooner than after all being transformed to a string.
velocity = str(spherical(system.freq()/1000000,1))
4. Print the present CPU velocity as a part of a message. We had to convert the velocity to a string with the intention to position it within the message.
print("The beginning velocity is",velocity,"MHz")
5. Print a message to the person, informing them that the check begins in 5 seconds, then stay up for 5 seconds.
print("Beginning the check in 5 seconds")
time.sleep(5)
6. Create a loop to repeatedly run the code. Lets use a for loop, however some time True loop will crash when it hits a foul frequency, so we acquire not anything from a for loop.
whilst True:
7. Set the CPU velocity the usage of the freq variable.
system.freq(freq)
8. Create an object, velocity, and in there retailer the present velocity of the RP2040. The use of just a little math the returned worth in Hertz is transformed to MegaHertz, then rounded to 1 decimal position, sooner than after all being transformed to a string.
velocity = str(spherical(system.freq()/1000000,1))
9. Print the present CPU velocity as a part of a message. We had to convert the velocity to a string with the intention to position it within the message.
print("The beginning velocity is",velocity,"MHz")
10. Increment the velocity via 10 MHz and save the worth to freq. The += operator interprets to freq = freq + 10000000. It’s shorter and neater within the code. Each paintings similarly as smartly, and will also be interchanged for readability. The += will also be swapped for -= in order that the values rely down to search out the bottom CPU velocity.
freq += 10000000
11. Pause the code for 2 seconds. This will likely give us time to learn the values sooner than the loop repeats.
time.sleep(2)
12. Save the code to the Raspberry Pi Pico as speedtest.py and click on run. Our best possible velocity was once 280 MHz, however you will get fortunate.
We additionally examined an underclock (decreasing the velocity via 10 MHz each and every loop) and controlled to get it down to ten MHz, which must considerably cut back the quantity of energy draw for initiatives that require an extended battery lifestyles. We have been not able to seize any information because of the extent of precision apparatus required.
Entire Code List
import system
import time
freq = 270000000
velocity = str(spherical(system.freq()/1000000,1))
print("The beginning velocity is",velocity,"MHz")
print("Beginning the check in 5 seconds")
time.sleep(5)
whilst True:
system.freq(freq)
velocity = str(spherical(system.freq()/1000000,1))
print("The present velocity is",velocity,"MHz")
freq += 10000000
time.sleep(2)
Supply By way of https://www.tomshardware.com/how-to/overclock-raspberry-pi-pico