Tumgik
#esp32 flash download tool command line
elcereza · 2 years
Text
Flash Download Tool como Gravar Binários no ESP32
Este post é um tutorial de como gravar binários no ESP32 usando a Flash Download Tool disponibilizado pela Espressif.
Flash Download Tool é uma ferramenta disponibilizado pela Espressif para exportar arquivos binários para o ESP32. Baixar e instalar Flash Download Tool Antes de tudo é necessário baixar o programa Flash Download Tool no site de Espressif, após baixar, abra e defina chipType como ESP32. Além disso, haverá outras configurações mas não serão necessárias, por ultimo click ‘ok‘. Entendendo o Flash…
Tumblr media
Ver no WordPress
0 notes
droneseco · 4 years
Text
A Peek at the Pico, Raspberry Pi's Newest Petite Powerhouse
Raspberry Pi Pico
8.80 / 10
Read Reviews
Read More Reviews
Read More Reviews
Read More Reviews
Read More Reviews
Read More Reviews
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Shop Now
Meet the new Raspberry Pi Pico; a tiny microcontroller filled with big possibilities.
Specifications
Brand: Raspberry Pi
CPU: Dual-core 133Mhz ARM
Memory: 264Kb
Ports: microUSB
Pros
Powerful ARM Processor
Micro-USB Connectivity
Breadboard Mountable
Easy-To-Use Interface
Absolutely Adorable
Inexpensive
Cons
No Wi-Fi or Bluetooth connectivity
No Header Pins
I/O Port Labelling on One Side Only
No USB-C Connectivity
Buy This Product
Tumblr media
Raspberry Pi Pico other
Shop
// Bottom var galleryThumbs1 = new Swiper('.gallery-thumbs-1', { spaceBetween: 10, slidesPerView: 10, freeMode: true, watchSlidesVisibility: true, watchSlidesProgress: true, centerInsufficientSlides: true, allowTouchMove: false, preventClicks: false, breakpoints: { 1024: { slidesPerView: 6, } }, }); // Top var galleryTop1 = new Swiper('.gallery-top-1', { spaceBetween: 10, allowTouchMove: false, loop: true, preventClicks: false, breakpoints: { 1024: { allowTouchMove: true, } }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, thumbs: { swiper: galleryThumbs1 } });
We’ve managed to get our hands on the coveted Raspberry Pi Pico. Today, we’re going to be looking at some of the most important features and putting it toe-to-toe with some of the biggest names in small electronics.
We’ll be showing you what the Pico can do, and we’ll get you started with MicroPython, one of Pico’s supported programming languages. We’ll even offer up some code to try in case you decide to buy a Pico of your own.
What Is a Raspberry Pi Pico?
Raspberry Pi Pico is a new budget microcontroller designed by Raspberry Pi. It’s a tiny computer built around a single chip, with onboard memory, and programmable in/out ports. Historically, microcontrollers are used in a variety of devices from medical implants to power tools. If you have an electronic device sitting in your vicinity, there’s a good chance that there’s a microcontroller inside of it.
Key Features of the Pico
Tumblr media
The Pico is built around the RP2040 microcontroller chip, which was designed by Raspberry Pi UK. It’s a Dual-Core ARM processor with a flexible clock that can run up to 133 MHz. The Pico also supports 1.8-5.5 DC input voltage, has a micro-USB input port, and an onboard temperature sensor.
Flanking the chip on all sides are a series of castellations that allow easy soldering to a Veroboard or breadboard. This dual in-line package (DIP) style form factor is stackable, and can also be used in carrier board applications.
Technical Specifications
21 mm x 51 mm
264kb on-chip RAM
2 MB on-board QSPI flash
2 UART
26 GPIO
2 SPI controllers
2 ISC controllers
16 PWM channels
Accelerated integer and floating-point libraries
3-pin ARM Serial Wire Debug (SWD) port
What’s So Special About the Pi Pico?
The Pi Pico is a different kind of microcontroller. It’s Raspberry Pi’s first, and it features ARM technology in its RP2040 silicon chip. Many technology companies are embracing silicon ARM chips, with major manufacturers like Apple leading the charge.
The punchy little Pico packs a staggering 26 multifunction general purpose input/output (GPIO) ports, including 3 that are analog. Alongside these ports are 8 programmable input/output (PIO) ports. Compare this to other microcontrollers like the Arduino Nano, and the Pico packs roughly 18% more GPIO capability.
The most considerable difference between the Pico and its competitors, however, is the $4 price tag. Low cost is the main selling point of this unique offering.
At launch, many online retailers sold out of the device due to the interest and Raspberry Pi’s favorable reputation. By setting the price so low, the Pico opens the door for a new class of high-powered, budget microcontrollers.
There are many potential applications for the new Pico. With its onboard temperature sensor, the device is an obvious choice for IoT projects.
One talented retro gaming enthusiast even used a Pico to build a gaming console with full VGA video support.
youtube
This means that makers who have been curious about Raspberry Pi, or microcontrollers in general, now have the ability to experiment for less than the price of a fancy cup of coffee.
Related: The Raspberry Pi Comes of Age With the Pi 400 Desktop
The Raspberry Pi Pico Processor
Tumblr media
The RP2040 ARM chip is an interesting choice for the Pico. At 133MHz, the chip is capable of leaving more expensive boards, like the Arduino Uno, in the dust.
Using ARM processors seems to be an emerging trend in the world of microcontrollers. In addition to Raspberry Pi, both Sparkfun and Adafruit also offer boards with similar ARM technology.
The industry-wide switch was made for a single reason—speed. ARM processors give a considerable boost over standard Atmel chips. In a board this size, using an ARM processor is like dropping a fully kitted Porsche engine into a Volkswagen. On the other hand, many microcontrollers don’t require that much processing speed. Yet.
Ramping up performance means that makers who want to push the limits of the Pico will have an abundance of power to do so.
The I/O Ports
Tumblr media
The GPIO ports on the Pi Pico feature several interesting functions for common uses such as operating a screen, running lighting, or incorporating servos/relays. Some functions of the GPIO are available on all ports, and some only work for specific uses. GPIO 25, for example, controls the Pico’s onboard LED, and GPIO 23 controls the onboard SMPS Power Save feature.
The Pico also has both VSYS (1.8V — 5.5V) and VBUS (5V when connected to USB) ports, which are designed to deliver current to the RP2040 and its GPIO. This means that powering the Pico can be done with or without the use of the onboard micro-USB.
A full list of the I/O ports is available on Raspberry Pi’s website in its complete Pico documentation.
Pico vs. Arduino vs. Others
Tumblr media
One question on the minds of many makers is whether or not the Raspberry Pi Pico is better than Arduino?
That depends. Pound-for-pound, higher-end Arduino boards like the Portenta H7 make the Pico look like a toy. However, the steep cost for a board of that caliber might be a tough pill for the microcontroller hobbyist to swallow. That's why the smaller price tag on the Pico makes it a win for makers who enjoy low-risk experimentation.
Along with minimal cost, the Raspberry Pi jams an extensive feature set into the Pico, comparable to boards like the Teensy LC, and the ESP32. But neither of these competitors manage to challenge the budget-friendly Pico on price.
That's what makes the Pico such a fantastic value, and a great choice for hobbyists and power users alike.
The Pi Pico: What’s Not To Love?
Tumblr media
Unfortunately, to drive the price of the Pico down, Raspberry Pi had to make a few compromises. The most notable of which is the lack of an onboard radio module. Neither Bluetooth nor Wi-Fi is supported without add-ons.
The Wi-Fi limitation can be eliminated by adding a module like the ESP-01. Bluetooth support may prove a bit more challenging. If you need an all-in-one solution for your products, you’re better off skipping the Pico, and spending a little extra for something like the Pi Zero W, or ESP32.
Additionally, many early adopters are complaining about the lack of GPIO labeling on the top of the board. Raspberry Pi provides an extensive amount of documentation on its website to address this, but pointing-and-clicking, or thumbing through paperwork when you have a hot soldering iron in your hands isn’t often desirable.
Lastly, the lack of I/O pin headers is something of an issue for some, as it means less convenience when swapping I/O components. This minor annoyance can be solved via the use of leads, soldering the component wiring directly to the Pico, or using a breadboard.
If you’ve been using microcontrollers or small electronics for any period of time, then an unpopulated board is most likely a non-issue. Of course, you could also add your own pin headers if you plan on regular experimentation with different external components.
The final rub with the Pico is the micro-USB port. With many other microcontrollers like the Portenta H7 moving toward USB-C, Raspberry Pi's micro-USB port seems dated.
Logically however, the decision to use micro-USB makes sense. It was done by Raspberry Pi to keep costs as low as possible, and to keep interface capability almost universal. Everyone we know has at least a few micro-USB cables tucked away somewhere in their homes.
However, with future versions, a USB-C interface would be a nice addition to an already spectacular package.
Related: A Beginners Guide To Breadboarding With Raspberry Pi
Programming the Raspberry Pi Pico
Interfacing with the Pi Pico can be done via C/C++, or via MicroPython in the Read-Eval-Print-Loop or REPL (pronounced “Reh-pul”). The REPL is essentially a command line interface that runs line-by-line code in a loop.
In order to access the REPL, you’ll need to install MicroPython onto the Pico. This process is simple and only involves four steps.
Installing MicroPython
Download MicroPython for Raspberry Pi Pico from the Raspberry Pi Website
Connect the Pico to your computer via micro-USB while holding the BOOTSEL button
Wait for the Pico to appear as an external drive
Copy the MicroPython file to the Pi Pico, and it will automatically reboot
You can access the REPL in a number of ways. We used the screen command in a macOS terminal window to access the serial bus connected to the Pico. To accomplish this with Terminal, you’ll first open a new terminal window, then type ls /dev/tty*
Tumblr media
From there, find the port where the Pico is connected. It should be labeled something like /dev/tty.usbmodem0000000000001. Then run the command:
screen /dev/tty.usbmodem0000000000001
Your cursor should change. Hit Return and the cursor will change again to >>>.
In the image below we've included the classic Hello World (Hello, Pico) command-line program in the REPL, along with a few lines of code that will turn the Pico's LED on and off. Feel free to try them yourself.
Tumblr media
For more information, we recommend you invest in the official starter guide to MicroPython that Raspberry Pi has published on their website.
Download: MicroPython for Raspberry Pi Pico (free)
Using the Raspberry Pi Pico With Thonny
Tumblr media
If you’re looking for a more proper coding environment, the Raspberry Pi Pico will also allow access to the REPL with Thonny. To enable this feature, first download and install Thonny. Once installed, connect your Pi Pico. Open Thonny and you'll see information indicating your Pico is connected in the Shell.
At the bottom right of the screen, you should see a version of Python. Click this version and select MicroPython (Raspberry Pi Pico) from the drop-down menu.
Now you can type commands into the Shell, or you can use Thonny’s editor to write or import multiple lines of code.
The abundance of interface possibilities make the Raspberry Pi Pico easy to program. For those who are familiar with MicroPython, this should be nothing new. For beginners, however, Thonny provides a powerful interface and debugger to get started with programming.
Download: Thonny (Free) Windows | Mac
Should I Buy the Raspberry Pi Pico?
The Raspberry Pi Pico is a powerful budget board that is perfect for hobbyists, or makers just starting out with microcontrollers. The documentation, low cost, and wide range of possibilities for the Pico also make it a great choice for seasoned small electronics wizards. If you’re a DIYer who loves to tinker, or you just want to challenge yourself to a weekend project, then you’ll love playing with the Pico.
On the other hand, if you don't have one or more projects in mind that need a microcontroller, then this board is probably not for you. Also, if your project needs Wi-Fi connectivity or Bluetooth, then the Pico won’t scratch that itch. And finally, for users who aren’t comfortable learning MicroPython, or exploring C/C++, the Pico isn't ideal. And remember: this Raspberry Pi is not like the others. It will not run a full Linux operating system.
But, if you dream in Python, or if you love the smell of solder, then you won't regret grabbing this tiny powerhouse. Most of all, if the sight of the sports-car-sleek RP2040 gets your creative gears turning, then we think you’ll really benefit from picking up the Pico.
Serving up Several Sweet Possibilities
While it isn’t perfect, the Raspberry Pi Pico is a strong entry into the world of microcontrollers. The reputation that Raspberry Pi has built for quality electronic components at a relatively low price extends to the Pico.
It’s everything a Raspberry Pi should be: small, sweet, and superb. It’s beautifully designed, and extremely inexpensive. But the best part isn’t the looks or the low cost.
The best part about this small wonder is picking it up, and holding it in your hands. It's feeling the tug of electronic inspiration. It's realizing just how powerful the Pico is, and what it means for microcontrollers going forward.
And truthfully, we think it's amazing that something as small as the Pico can offer so many unique possibilities.
A Peek at the Pico, Raspberry Pi's Newest Petite Powerhouse published first on http://droneseco.tumblr.com/
0 notes
dfrobots-blog · 6 years
Text
ESP32 Bluetooth Tutorial: Using the BTstack library
The objective of this ESP32 tutorial is to explain how to get started with the Bluetooth functionalities that are supported by the ESP32 hardware. The Bluetooth tests of this tutorial were performed using a DFRobot’s ESP32 module, integrated in a ESP32 development board. Introduction
The objective of this ESP32 tutorial is to explain how to get started with the Bluetooth functionalities that are supported by the ESP32 hardware.
We are going to use the BlueKitchen’s BTstack library, which can be obtained from GitHub here. You can also read more about this library on its website. BTstack supports both Bluetooth Classic and Bluetooth Low Energy, making it a versatile choice to use.
This library has ports for many platforms, as can be seen here. Fortunately, the ESP32 is one of the supported microcontrollers. You can check at the GitHub page the setup guide for the ESP32, although we are also going to cover it on this tutorial.
We will be using the ESP32 IDF in order to use the BTstack library. If you don’t have IDF configured, please follow Espressif’s guide here. Setting up IDF is relatively straightforward since the guide is very comprehensive and most of the tools are already compiled for us. Nonetheless, using it is not so easy as the Arduino core.
Note that the BTstack exposes a very low level API. Although it gives us much more control over the functionalities, it is also more complex to use and it needs some knowledge about the Bluetooth stack. So, we are going to start with a very simple example that will start the Bluetooth on our ESP32 and make it discoverable for other Bluetooth devices.
The Bluetooth tests of this tutorial were performed using a DFRobot’s ESP32 module, integrated in a ESP32 development board.
Setting up the BTStack
As said in the introductory section, using the BTstack library requires a previous installation of the ESP32 IDF tool. If you have followed Espressif’s guide, then you should have installed msys32 somewhere on your computer.
In my case, I have my IDF folder under C:/msys32/home/myUser/esp/esp-idf. So, what we need to do next is getting the BTstack library from GitHub. You can either clone it using Git or manually download it from the GitHub page.
Note the download button in figure 1, which allows to get a copy of the libraries. In my case, I’ve manually downloaded it.
Tumblr media
Figure 1– Downloading BTstack library from GitHub.
Then you need to save it on your msys32 working environment. In my case, I have it on the same folder of the IDF project, in C:/msys32/home/myUser/esp/.Once you have it on your working folder, open the msys32 terminal and navigate to the BTstack project folder. Then, still using the command line, navigate to the /port/esp32 folder. You can use the cd (change directory) command to navigate on the folders of the project.In that directory, you need to run the following command for the project example folders to be created [1]:
./create_examples.py
On that same directory, you should now have a lot folders with different examples from BTstack. In order to create our new program easily, we are going to copy one of these example folders and use most of the configurations already defined. So, make a copy the spp_counter folder in the same directory and rename it hello_world.Then, enter on the new hello_world folder and after that on the main folder. There, you should have a file called spp_counter.c. Rename it to hello_world.c.Finally, you can open the file and clear its contents, since we are going to write the code on the next section.
The code
On the top of our file, we will need to have the include for the btstack.h file, which contain some configurations and initialization. We will not change that file for this simple tutorial.
#include "btstack.h"
Now we are going to move on to the main function, which is called btstack_main. There we will put our Bluetooth code. In this simple tutorial, it will mainly consist on some initialization.
int btstack_main(int argc, const char * argv[]){ // ... }
Next, we need to call the l2cap_init function, which makes the setup of L2CAP and registers it with the HCI layer [2].On the Bluetooth stack, L2CAP (Logical Link Control and Adaptation Protocol) provides connection oriented and connectionless data services to the protocols built on upper layers [3]. One of the responsibilities of this layer is to provide multiplexing between the higher layer protocols, enabling multiple applications to utilize the same lower layer links [3].The mentioned HCI (Host Controller Interface) layer provides a uniform interface for accessing the Bluetooth hardware capabilities [4].
l2cap_init();
Next we need to call the sdp_init function, which sets up SDP (Service Discovery Protocol). This layer allows advertising services and discovering services provided by other Bluetooth devices.
sdp_init();
In the next steps,  we will configure some settings of GAP (Generic Access Profile). GAP is a profile from the Bluetooth stack that defines how devices find each other and how they establish a connection [5].Keeping this in mind, we will first make the device discoverable by calling the gap_discoverable_control function, passing as input the value 1. This way, we will be able to discover the ESP32 from other Bluetooth devices.
gap_discoverable_control(1);
We will also set the name of the device, by calling the gap_set_local_name
function and passing as input the name that we want to set. We will call it “Hello world”. Note that this needs to be defined before the Bluetooth stack starts [2].
gap_set_local_name("Hello world");
Finally, we call the hci_power_control function to turn on the the power of the hardware Bluetooth controller. It receives as input a variable of HCI_POWER_MODE enum. In this case, since we want to turn it on, we should pass HCI_POWER_ON.The final code is shown bellow.
#include "btstack.h" int btstack_main(int argc, const char * argv[]){    l2cap_init();    sdp_init();    gap_discoverable_control(1);    gap_set_local_name("Hello world");    hci_power_control(HCI_POWER_ON);    return 0; }
Testing the code
First of all, we need to set the correct configurations to upload the code for our FireBeetle ESP32 board. To access the configurations menu, go the the msys32 command line and on the hello_world directory hit the following command:
make menuconfig
Note that this is a IDF specific command and not a BTstack particularity. A menu like the one shown in figure 2 should pop.
Tumblr media
Figure 2 – ESP32 IDF menu config.
Navigate to serial flasher config entry and hit enter. There you should put the board’s specific configurations needed to upload the program. For the FireBeetle board / ESP-WROOM-32 module, you should put the ones shown in figure 3.
Tumblr media
Figure 3– ESP32 FireBeetle board flash configurations.
Note that on the default serial port entry you should put you device’s serial port, which may differ from mine. If you are coming from a Arduino background, then using the Arduino IDE to find the port of your device is a simple way to do it.
Note that you can also find at the Arduino IDE the flashing configurations for your board if it is already supported in the Arduino environment. It can be found under the tools menu. You can also find a lot of board’s configurations here
.After configuring, go to the save button and hit enter to save the content and then go to exit. Back on the msys32 command line, with your board connected to the PC, hit the following command do compile and flash the code:
make flash
The code should now start to compile. Note that the first time it compiles it may take  a while. After being compiled, the flashing to the ESP32 should start automatically. After the procedure is finished, it should end up like shown in figure 4.
Tumblr media
Figure 4– Upload of the code finished.
To make sure the code is executing, you can send the following command on the terminal to open a serial monitor tool.
make monitor
Other alternative is using the Arduino IDE serial monitor. In my case I was having some problems with the msys32 monitor, so I used the Arduino IDE to confirm that the board was indeed running the Bluetooth program. A message like the one shown in figure 5 should be printed on the console.
Tumblr media
Figure 5 – Output of the BTstack hello world program on Arduino IDE.
Note that you may need to reset the board with the onboard reset button or unplug and replug the power because after uploading a program the board sometimes stays in download mode.
It’s important to take in consideration that the output we see on the command line printed to the serial port was not defined in our code. It is defined on a file on hello_world/components/btstack/main.c. You can confirm in that file that there are indeed the prints defined, in the app_main function.
Finally, you can try to find the ESP32 from some Bluetooth device. In my case, I’m finding it from my computer, as shown in figure 6. Note that I’m on a laptop with Bluetooth classic, so we don’t need a BLE device to find the ESP32.
Tumblr media
Figure 6 – Finding the ESP32 as a Bluetooth device.
DFRobot supply lots of esp32 arduino tutorials and esp32 projects for makers to learn.
0 notes
droneseco · 4 years
Text
A Peek at the Pico, Raspberry Pi's Newest Petite Powerhouse
Raspberry Pi Pico
8.80 / 10
Read Reviews
Read More Reviews
Read More Reviews
Read More Reviews
Read More Reviews
Read More Reviews
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Shop Now
Meet the new Raspberry Pi Pico; a tiny microcontroller filled with big possibilities.
Specifications
Brand: Raspberry Pi
CPU: Dual-core 133Mhz ARM
Memory: 264Kb
Ports: microUSB
Pros
Powerful ARM Processor
Micro-USB Connectivity
Breadboard Mountable
Easy-To-Use Interface
Absolutely Adorable
Inexpensive
Cons
No Wi-Fi or Bluetooth connectivity
No Header Pins
I/O Port Labelling on One Side Only
No USB-C Connectivity
Buy This Product
Tumblr media
Raspberry Pi Pico other
Shop
// Bottom var galleryThumbs1 = new Swiper('.gallery-thumbs-1', { spaceBetween: 10, slidesPerView: 10, freeMode: true, watchSlidesVisibility: true, watchSlidesProgress: true, centerInsufficientSlides: true, allowTouchMove: false, preventClicks: false, breakpoints: { 1024: { slidesPerView: 6, } }, }); // Top var galleryTop1 = new Swiper('.gallery-top-1', { spaceBetween: 10, allowTouchMove: false, loop: true, preventClicks: false, breakpoints: { 1024: { allowTouchMove: true, } }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, thumbs: { swiper: galleryThumbs1 } });
We’ve managed to get our hands on the coveted Raspberry Pi Pico. Today, we’re going to be looking at some of the most important features and putting it toe-to-toe with some of the biggest names in small electronics.
We’ll be showing you what the Pico can do, and we’ll get you started with MicroPython, one of Pico’s supported programming languages. We’ll even offer up some code to try in case you decide to buy a Pico of your own.
What Is a Raspberry Pi Pico?
Raspberry Pi Pico is a new budget microcontroller designed by Raspberry Pi. It’s a tiny computer built around a single chip, with onboard memory, and programmable in/out ports. Historically, microcontrollers are used in a variety of devices from medical implants to power tools. If you have an electronic device sitting in your vicinity, there’s a good chance that there’s a microcontroller inside of it.
Key Features of the Pico
Tumblr media
The Pico is built around the RP2040 microcontroller chip, which was designed by Raspberry Pi UK. It’s a Dual-Core ARM processor with a flexible clock that can run up to 133 MHz. The Pico also supports 1.8-5.5 DC input voltage, has a micro-USB input port, and an onboard temperature sensor.
Flanking the chip on all sides are a series of castellations that allow easy soldering to a Veroboard or breadboard. This dual in-line package (DIP) style form factor is stackable, and can also be used in carrier board applications.
Technical Specifications
21 mm x 51 mm
264kb on-chip RAM
2 MB on-board QSPI flash
2 UART
26 GPIO
2 SPI controllers
2 ISC controllers
16 PWM channels
Accelerated integer and floating-point libraries
3-pin ARM Serial Wire Debug (SWD) port
What’s So Special About the Pi Pico?
The Pi Pico is a different kind of microcontroller. It’s Raspberry Pi’s first, and it features ARM technology in its RP2040 silicon chip. Many technology companies are embracing silicon ARM chips, with major manufacturers like Apple leading the charge.
The punchy little Pico packs a staggering 26 multifunction general purpose input/output (GPIO) ports, including 3 that are analog. Alongside these ports are 8 programmable input/output (PIO) ports. Compare this to other microcontrollers like the Arduino Nano, and the Pico packs roughly 18% more GPIO capability.
The most considerable difference between the Pico and its competitors, however, is the $4 price tag. Low cost is the main selling point of this unique offering.
At launch, many online retailers sold out of the device due to the interest and Raspberry Pi’s favorable reputation. By setting the price so low, the Pico opens the door for a new class of high-powered, budget microcontrollers.
There are many potential applications for the new Pico. With its onboard temperature sensor, the device is an obvious choice for IoT projects.
One talented retro gaming enthusiast even used a Pico to build a gaming console with full VGA video support.
youtube
This means that makers who have been curious about Raspberry Pi, or microcontrollers in general, now have the ability to experiment for less than the price of a fancy cup of coffee.
Related: The Raspberry Pi Comes of Age With the Pi 400 Desktop
The Raspberry Pi Pico Processor
Tumblr media
The RP2040 ARM chip is an interesting choice for the Pico. At 133MHz, the chip is capable of leaving more expensive boards, like the Arduino Uno, in the dust.
Using ARM processors seems to be an emerging trend in the world of microcontrollers. In addition to Raspberry Pi, both Sparkfun and Adafruit also offer boards with similar ARM technology.
The industry-wide switch was made for a single reason—speed. ARM processors give a considerable boost over standard Atmel chips. In a board this size, using an ARM processor is like dropping a fully kitted Porsche engine into a Volkswagen. On the other hand, many microcontrollers don’t require that much processing speed. Yet.
Ramping up performance means that makers who want to push the limits of the Pico will have an abundance of power to do so.
The I/O Ports
Tumblr media
The GPIO ports on the Pi Pico feature several interesting functions for common uses such as operating a screen, running lighting, or incorporating servos/relays. Some functions of the GPIO are available on all ports, and some only work for specific uses. GPIO 25, for example, controls the Pico’s onboard LED, and GPIO 23 controls the onboard SMPS Power Save feature.
The Pico also has both VSYS (1.8V — 5.5V) and VBUS (5V when connected to USB) ports, which are designed to deliver current to the RP2040 and its GPIO. This means that powering the Pico can be done with or without the use of the onboard micro-USB.
A full list of the I/O ports is available on Raspberry Pi’s website in its complete Pico documentation.
Pico vs. Arduino vs. Others
Tumblr media
One question on the minds of many makers is whether or not the Raspberry Pi Pico is better than Arduino?
That depends. Pound-for-pound, higher-end Arduino boards like the Portenta H7 make the Pico look like a toy. However, the steep cost for a board of that caliber might be a tough pill for the microcontroller hobbyist to swallow. That's why the smaller price tag on the Pico makes it a win for makers who enjoy low-risk experimentation.
Along with minimal cost, the Raspberry Pi jams an extensive feature set into the Pico, comparable to boards like the Teensy LC, and the ESP32. But neither of these competitors manage to challenge the budget-friendly Pico on price.
That's what makes the Pico such a fantastic value, and a great choice for hobbyists and power users alike.
The Pi Pico: What’s Not To Love?
Tumblr media
Unfortunately, to drive the price of the Pico down, Raspberry Pi had to make a few compromises. The most notable of which is the lack of an onboard radio module. Neither Bluetooth nor Wi-Fi is supported without add-ons.
The Wi-Fi limitation can be eliminated by adding a module like the ESP-01. Bluetooth support may prove a bit more challenging. If you need an all-in-one solution for your products, you’re better off skipping the Pico, and spending a little extra for something like the Pi Zero W, or ESP32.
Additionally, many early adopters are complaining about the lack of GPIO labeling on the top of the board. Raspberry Pi provides an extensive amount of documentation on its website to address this, but pointing-and-clicking, or thumbing through paperwork when you have a hot soldering iron in your hands isn’t often desirable.
Lastly, the lack of I/O pin headers is something of an issue for some, as it means less convenience when swapping I/O components. This minor annoyance can be solved via the use of leads, soldering the component wiring directly to the Pico, or using a breadboard.
If you’ve been using microcontrollers or small electronics for any period of time, then an unpopulated board is most likely a non-issue. Of course, you could also add your own pin headers if you plan on regular experimentation with different external components.
The final rub with the Pico is the micro-USB port. With many other microcontrollers like the Portenta H7 moving toward USB-C, Raspberry Pi's micro-USB port seems dated.
Logically however, the decision to use micro-USB makes sense. It was done by Raspberry Pi to keep costs as low as possible, and to keep interface capability almost universal. Everyone we know has at least a few micro-USB cables tucked away somewhere in their homes.
However, with future versions, a USB-C interface would be a nice addition to an already spectacular package.
Related: A Beginners Guide To Breadboarding With Raspberry Pi
Programming the Raspberry Pi Pico
Interfacing with the Pi Pico can be done via C/C++, or via MicroPython in the Read-Eval-Print-Loop or REPL (pronounced “Reh-pul”). The REPL is essentially a command line interface that runs line-by-line code in a loop.
In order to access the REPL, you’ll need to install MicroPython onto the Pico. This process is simple and only involves four steps.
Installing MicroPython
Download MicroPython for Raspberry Pi Pico from the Raspberry Pi Website
Connect the Pico to your computer via micro-USB while holding the BOOTSEL button
Wait for the Pico to appear as an external drive
Copy the MicroPython file to the Pi Pico, and it will automatically reboot
You can access the REPL in a number of ways. We used the screen command in a macOS terminal window to access the serial bus connected to the Pico. To accomplish this with Terminal, you’ll first open a new terminal window, then type ls /dev/tty*
Tumblr media
From there, find the port where the Pico is connected. It should be labeled something like /dev/tty.usbmodem0000000000001. Then run the command:
screen /dev/tty.usbmodem0000000000001
Your cursor should change. Hit Return and the cursor will change again to >>>.
In the image below we've included the classic Hello World (Hello, Pico) command-line program in the REPL, along with a few lines of code that will turn the Pico's LED on and off. Feel free to try them yourself.
Tumblr media
For more information, we recommend you invest in the official starter guide to MicroPython that Raspberry Pi has published on their website.
Download: MicroPython for Raspberry Pi Pico (free)
Using the Raspberry Pi Pico With Thonny
Tumblr media
If you’re looking for a more proper coding environment, the Raspberry Pi Pico will also allow access to the REPL with Thonny. To enable this feature, first download and install Thonny. Once installed, connect your Pi Pico. Open Thonny and you'll see information indicating your Pico is connected in the Shell.
At the bottom right of the screen, you should see a version of Python. Click this version and select MicroPython (Raspberry Pi Pico) from the drop-down menu.
Now you can type commands into the Shell, or you can use Thonny’s editor to write or import multiple lines of code.
The abundance of interface possibilities make the Raspberry Pi Pico easy to program. For those who are familiar with MicroPython, this should be nothing new. For beginners, however, Thonny provides a powerful interface and debugger to get started with programming.
Download: Thonny (Free) Windows | Mac
Should I Buy the Raspberry Pi Pico?
The Raspberry Pi Pico is a powerful budget board that is perfect for hobbyists, or makers just starting out with microcontrollers. The documentation, low cost, and wide range of possibilities for the Pico also make it a great choice for seasoned small electronics wizards. If you’re a DIYer who loves to tinker, or you just want to challenge yourself to a weekend project, then you’ll love playing with the Pico.
On the other hand, if you don't have one or more projects in mind that need a microcontroller, then this board is probably not for you. Also, if your project needs Wi-Fi connectivity or Bluetooth, then the Pico won’t scratch that itch. And finally, for users who aren’t comfortable learning MicroPython, or exploring C/C++, the Pico isn't ideal. And remember: this Raspberry Pi is not like the others. It will not run a full Linux operating system.
But, if you dream in Python, or if you love the smell of solder, then you won't regret grabbing this tiny powerhouse. Most of all, if the sight of the sports-car-sleek RP2040 gets your creative gears turning, then we think you’ll really benefit from picking up the Pico.
Serving up Several Sweet Possibilities
While it isn’t perfect, the Raspberry Pi Pico is a strong entry into the world of microcontrollers. The reputation that Raspberry Pi has built for quality electronic components at a relatively low price extends to the Pico.
It’s everything a Raspberry Pi should be: small, sweet, and superb. It’s beautifully designed, and extremely inexpensive. But the best part isn’t the looks or the low cost.
The best part about this small wonder is picking it up, and holding it in your hands. It's feeling the tug of electronic inspiration. It's realizing just how powerful the Pico is, and what it means for microcontrollers going forward.
And truthfully, we think it's amazing that something as small as the Pico can offer so many unique possibilities.
A Peek at the Pico, Raspberry Pi's Newest Petite Powerhouse published first on http://droneseco.tumblr.com/
0 notes