(*7*)Overclocking any fashion of Raspberry Pi is actually easy. However overclocking the (*8*)Raspberry Pi Pico is even more effective. All it takes is two strains of MicroPython and your Pico can simply run at double its commonplace pace, and with out the will for the (*5*)absolute best CPU coolers.
On this how you can we will be able to overclock a Raspberry Pi Pico to 270 MHz, double the bottom pace of 133 MHz. Then we will be able to write a script to check how a ways we will overclock, after which how low we will underclock the CPU.
(*4*)
You could be pondering “Why overclock a Raspberry Pi Pico?”The use of a low stage language, similar to C, the Pico is able to getting used to play video games similar to Doom (the total sport) the usage of an HDMI output board. It may possibly emulate unfashionable computer systems such because the ZX Spectrum and Commodore 64. With MicroPython, overclocking will give us a noticeable pace spice up, and underclocking would possibly supply us with longer battery existence if we’re the usage of it in a battery-powered undertaking.
This how you can will paintings with the Raspberry Pi Pico, (*11*)Pico W and plenty of different of the (*10*)absolute best RP2040 primarily based forums when the usage of MicroPython. There are different strategies for converting the frequency when programming the forums in different languages.
For This Undertaking You Will Want
A Raspberry Pi Pico or Pico W or some other RP2040 primarily based board that’s working MicroPython.
(*12*)Overclocking the Raspberry Pi Pico With MicroPython
1. Set up the newest model of MicroPython in your Pico. In the event you haven’t already finished this, apply as much as (*9*)step three of this information to be informed how.
2. Within the REPL, import the device module and test the present pace of the Raspberry Pi Pico. The returned worth it is going to be 125000000 Hertz (125 MHz). Some forums or variations of MicroPython could have it set a little bit upper by means of default.
import device
device.freq()
(*6*)
(*1*)
3. The use of the similar command, set the CPU pace to 270 MHz.
device.freq(270000000)
4. Take a look at the CPU pace to make certain that the overclock has labored. The returned worth will have to be 270000000 Hertz (270 MHz).
device.freq()
(*6*)
(*3*)
At this time this pace spice up is brief. When the Pico is rebooted, it’ll go back to its default pace (in most cases 125 MHz). With the intention to retain the overclock, it should be set every time the Pico boots. Including those two strains to the beginning of any MicroPython code will overclock the RP2040 to the specified pace when the code is administered.
import device
device.freq(SPEED IN HERTZ)
How A ways Can The RP2040 Be Driven?
are all the time having a look to move simply that little bit quicker however how are we able to decide our good fortune within the silicon lottery? For that we computerized the method with a little bit Python code.
1. In Thonny get started a brand new report by means of first uploading two modules. System is used to modify the CPU pace, and time is used to tempo the code.
import device
import time
2. Create a variable, freq and retailer 270 MHz as Hertz. We all know that 270 MHz works neatly, so we commence from a identified running pace. In case your function is to underclock the RP2040, cut back the price accordingly.
freq = 270000000
3. Create an object, pace, and in there retailer the present pace of the RP2040. The use of a little bit math, the returned worth in Hertz is transformed to megahertz, then rounded to one decimal position, ahead of after all being transformed to a string.
pace = str(spherical(device.freq()/1000000,1))
4. Print the present CPU pace as a part of a message. We had to convert the rate to a string as a way to position it within the message.
print("The beginning pace is",pace,"MHz")
5. Print a message to the consumer, informing them that the take a look at begins in five seconds, then look ahead to five seconds.
print("Beginning the take a look at in five seconds")
time.sleep(5)
6. Create a loop to repeatedly run the code. Shall we use a for loop, however some time True loop will crash when it hits a foul frequency, so we achieve not anything from a for loop.
whilst True:
7. Set the CPU pace the usage of the freq variable.
device.freq(freq)
8. Create an object, pace, and in there retailer the present pace of the RP2040. The use of a little bit math the returned worth in Hertz is transformed to MegaHertz, then rounded to one decimal position, ahead of after all being transformed to a string.
pace = str(spherical(device.freq()/1000000,1))
9. Print the present CPU pace as a part of a message. We had to convert the rate to a string as a way to position it within the message.
print("The beginning pace is",pace,"MHz")
10. Increment the rate by means of 10 MHz and save the price to freq. The += operator interprets to freq = freq + 10000000. It’s shorter and neater within the code. Each paintings similarly as neatly, and can also be interchanged for readability. The += can also be swapped for -= in order that the values rely down to seek out the bottom CPU pace.
freq += 10000000
11. Pause the code for two seconds. This may occasionally give us time to learn the values ahead of the loop repeats.
time.sleep(2)
12. Save the code to the Raspberry Pi Pico as speedtest.py and click on run. Our absolute best pace was once 280 MHz, however you can get fortunate.
(*6*)
(*2*)
We additionally examined an underclock (lowering the rate by means of 10 MHz every loop) and controlled to get it right down to 10 MHz, which will have to considerably cut back the quantity of energy draw for initiatives that require an extended battery existence. We have been not able to seize any information because of the extent of precision apparatus required.
Whole Code Record
import device
import time
freq = 270000000
pace = str(spherical(device.freq()/1000000,1))
print("The beginning pace is",pace,"MHz")
print("Beginning the take a look at in five seconds")
time.sleep(5)
whilst True: device.freq(freq) pace = str(spherical(device.freq()/1000000,1)) print("The present pace is",pace,"MHz") freq += 10000000
time.sleep(2)
Allow 48h for review and removal.