This is only a preview of the November 2022 issue of Silicon Chip. You can view 43 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Christmas LED Icicle Decoration":
Items relevant to "LC Meter Mk3":
Items relevant to "DC Supply Transient Filter":
Items relevant to "Active Monitor Speakers, Part 1":
Items relevant to "WiFi-Synchronised Analog Clock":
Items relevant to "Particulate Matter (PM) Sensors":
Items relevant to "30V 2A Bench Supply, Part 2":
Purchase a printed copy of this issue for $11.50. |
Raspberry Pi
Pic W
Review by Tim Blythman
The Raspberry Pi Foundation has a habit of making surprise
announcements of new hardware. Although created with education in
mind, their low pricing has made the various single-board computers and
microcontroller boards extremely popular in all sorts of applications. Adding
WiFi support can only increase that popularity!
A
fter nearly ten years of their range
of single-board computers, the
Raspberry Pi Foundation surprised
everyone last year with the release of
its first microcontroller, the RP2040,
and its own microcontroller board,
the Pico. Now the Pico W is available,
building on the already very handy
Pico board, adding all-important WiFi
capability.
Background
The RP2040 is a dual-core ARM
Cortex M0+ processor with 264kiB
of RAM, a 16kiB boot ROM that provides a USB bootloader, plus some
other handy functions. Like many
such 32-bit devices, it runs from 3.3V.
The Pico is a fairly minimal board
implementation that adds a 4MB flash
memory chip and a 3.3V voltage regulator. It breaks out 26 of the RP2040’s
I/O pins into a compact board suitable
for breadboarding or even surface-
mounting on another PCB.
Its target launch price was $6, and
incredibly it is still in stock from multiple vendors at about that price.
While the board is minimal, it is
very capable (especially considering
the price) and could be programmed in
C or MicroPython from launch. Arduino support appeared very quickly
after its debut.
Raspberry Pi is a trademark of the
Raspberry Pi Foundation
It’s the same size as the Pico and
costs only a few dollars more. We can
see the Pico W challenging other WiFi boards
like those based on the ESP32 and ESP8266 due to its
low price and excellent support.
56
Silicon Chip
Australia's electronics magazine
The RP2040 microcontroller was
also available in good numbers and
at a good price (under $2 in single
quantities). It was quickly taken up
by other companies who created their
own spin on the Pico, including variants such as the Arduino Nano RP2040
Connect, one of the many boards that
includes WiFi.
We reviewed the Pico in December
2021 (siliconchip.au/Article/15125)
and found that it is a well-designed
board with a nimble microcontroller
that has a very useful set of features.
With the work of Geoff Graham and
Peter Mather, it was soon possible to
program the Pico in BASIC. This is
the so-called PicoMite (January 2022;
siliconchip.au/Article/15177). The
PicoMite has much in common with
the Micromite, including the ability to
drive an LCD touchscreen.
That led us to create the Pico BackPack in March 2022 (siliconchip.
au/Article/15236). The BackPack is
designed to connect to an LCD touchscreen and includes an RTC (realtime clock) chip, IR receiver, stereo
line-level audio output and a micro
SD card slot. We also showed how to
program the Pico BackPack in four different languages.
The very popular VGA PicoMite followed that in July 2022 (siliconchip.
au/Article/15382). The addition of
a VGA output and a keyboard input
means that the VGA PicoMite is more
siliconchip.com.au
Table 1: GPIO differences between Pico and Pico W
Function
Pico
Pico W
Notes
PSU PS pin
GPIO23
WL_GPIO1
Has 100kΩ pulldown, low is PFM mode, high is PWM mode
USB Vbus sense
GPIO24
WL_GPIO2
Digital input with pulldown
LED
GPIO25
WL_GPIO0
Also broken out to TP5 downstream of resistor
Vsys/3
GPIO29
GPIO29
For Pico W, only when enabled by GPIO25 being high
WiFi CLK
–
GPIO29
WiFi CS
–
GPIO25
Also connected to Mosfet on Pico W to enable ADC readings on GPIO29
WiFi MISO/MOSI
–
GPIO24
Connects to four SDIO pins of CYW43439
WiFi EN
–
GPIO23
Connects to both WL_REG_ON and BT_REG_ON of CYW43439
like a Maximite than a Micromite and
is reminiscent of the computers of
yore, like the Commodore 64.
Enter the Pico W
The Pico W, as you might guess,
is an RP2040-based microcontroller
board to which a WiFi module has
been added. Its target price is $9.
It’s the same size and has much the
same pinout as a Pico, but with a small
metal can at the end opposite the micro
USB socket. That can contains the
WiFi chip. The three-pin SWD (serial
wire debug) header has been moved to
make way for the WiFi antenna.
The Pico W is not the first RP2040
board with WiFi, but given the Raspberry Pi Foundation’s aggressive pricing, it is among the cheapest. It’s similar in price to ‘off-brand’ boards with
ESP8266 or ESP32 microcontrollers,
which also have a similar set of features.
The WiFi module is based on an
Infineon CYW43439 chip, which
boasts 802.11n (2.4GHz) WiFi support and Bluetooth 5.2. However, there
doesn’t appear to be any software support for Bluetooth on the Pico W at
this stage.
The CYW43439 chip has separate
WiFi and Bluetooth subsystems which
each have their own ARM microcontroller core. There are several ways
to communicate with the WiFi Chip
but, importantly, the common SPI
interface has been used on the Pico W.
That means that Bluetooth could be
supported on the Pico W in the future.
Design evolution
Having another chip interfaced to
the RP2040 inevitably leads to the
question of what has been sacrificed,
since some resources will at least need
to be shared if not given up entirely.
The first clue is that all the exposed
siliconchip.com.au
pins are marked the same as the original Pico. The WiFi interface happens
through four GPIO pins that are not
broken out on either board.
These are GPIO23, GPIO24, GPIO25
and GPIO29. On the original Pico,
these all had various internal functions. The Pico W now uses these
to communicate with the WiFi chip.
Some of the original functions are kept,
while others are delegated to GPIO
pins on the WiFi chip. Table 1 summarises these differences.
There are other subtle differences.
The original Pico uses an RT6150
buck/boost regulator to provide the
3.3V rail. This is rated to 800mA and
can work with an input between 1.8V
and 5.5V.
The Pico W uses an RT6154, which
has a similar input voltage range but
can deliver over 2A. Some extra current will be necessary to drive the WiFi
chip; this extra capacity will surely
come in handy elsewhere.
Apart from the pin changes noted
in Table 1, the interfaces to the power
supply are much the same despite the
pin changes. One I/O pin monitors
Vbus to detect the presence of USB
power. At the same time, another is
used to select between the more efficient PFM (pulse frequency modulation) and lower ripple PWM (pulse
width modulation) modes.
In practice, the biggest difference is
how the onboard LED is driven, since
the Pico W uses one of the CYW43439’s
I/O pins to drive it.
On paper, the Pico W appears to
be a mostly compatible and painless
upgrade to the Pico. Some functions
have changed locations, but that is to
be expected.
Hands-on testing
The Pico W was unavailable in Australia until August this year due to
Australia's electronics magazine
delays in the Raspberry Pi Foundation
getting RCM (Regulatory Compliance
Mark) approval. As soon as we could
get one, we tried it out.
We built a Pico BackPack and fitted
it with female headers, allowing us to
change out the two different boards
(fitted with male headers) quickly for
testing. This arrangement also helps
keep the Pico W’s WiFi antenna clear
of the solid copper pours on the BackPack PCB and LCD module. We used
stacked spacers for testing the WiFi
capabilities of the Pico W.
We loaded each of the four UF2 test
files provided for the original Pico
BackPack article onto both the Pico
and Pico W in turn and checked their
operation.
The only difference we noted was
that the Pico W does not flash its LED
when using the PicoMite example
firmware, which was expected due to
pin 25 being used for the WiFi module instead of the LED. Otherwise, all
the test programs worked identically
between the two boards.
So if you can afford the premium
of an upgrade from the Pico to a Pico
W, there aren’t really any downsides.
Next, we decided to see what could
be done with the Pico W’s WiFi.
Using WiFi
The Raspberry Pi Foundation does
a great job of making it easy to get
started; perhaps that is not surprising,
given their educational focus. They
have published online numerous data
sheets, user guides and other resources
such as the full circuit diagrams for
both boards.
Among these documents is a guide
on connecting to the internet with the
Pico W. You can find it at siliconchip.
au/link/abgv
We made good use of that information during our testing. Although the
November 2022 57
WiFi chip on the Pico W uses SPI, it is
in half-duplex mode, using the same
data pin for communication in both
directions.
According to the official C SDK (software development kit) for the Pico and
Pico W, the SPI peripheral is actually
implemented in one of the PIO blocks.
As we mentioned in our original
article on the Pico, PIO blocks are
I/O-orientated state machines that can
run a small program and thus emulate
communication peripherals like SPI or
UART. There are even DVI implementations that can generate signals that
work on HDMI displays.
This means that existing designs
that use the PIO state machines may
need to be modified to work with the
Pico W but presumably, only if the
WiFi features are actually used.
Unfortunately, it looks like the
PicoMite (MMBasic) firmware will
not be updated to include support for
the WiFi chip, as explained at www.
thebackshed.com/forum/ViewTopic.
php?TID=14977
That’s because the WiFi chip on the
Pico W needs a firmware image to be
loaded at runtime, and that alone consumes around 300kB of flash memory, plus RAM at runtime. It would
also require a framework and commands to provide a way to control
the WiFi module through the BASIC
language.
We can see that this would be a lot
of work and perhaps isn’t justified,
especially as it is so easy to interface
to an ESP8266 loaded with an AT command firmware.
Regardless of the language used,
any project that is updated to use the
WiFi feature will undergo considerable changes anyway.
MicroPython support
There are two ways of programming
the Pico W (and the Pico) provided by
the Raspberry Pi Foundation: the C
SDK and MicroPython, a port of the
Python language optimised for microcontrollers.
The Pico W’s MicroPython port
supports WiFi out of the box. It is not
the first microcontroller with WiFi to
work with MicroPython; MicroPython
has long had support for WiFi on the
ESP8266 and ESP32.
There is a prebuilt UF2 image of
MicroPython for the Pico W available. Once uploaded, the following
commands initialise the WiFi chip
and print out a scan of nearby WiFi
networks:
import network
wlan = network.
WLAN(network.STA_IF)
wlan.active(True)
print(wlan.scan())
The Connecting to the Internet guide
mentioned earlier has chapters on
using MicroPython to connect to networks, make HTTP requests and build
HTTP servers, including controlling
Besides the added WiFi
(the metal can), the PCB
trace WiFi antenna has
necessitated the SWD
(serial wire debug)
header being moved
to a different location.
Otherwise, the pins
are in much the same
locations as the original
Pico.
The back of the Pico W
has pin markings that
are identical to those
on the Pico. The six test
points all remain in the
same locations. Like the
Pico, the Pico W comes
without headers; the H
and WH variants cost
more but have presoldered headers.
the onboard LED from a web page.
The guide includes source code for
performing those tasks.
C SDK
Similarly, the Connecting to the
Internet guide has a chapter on using
the WiFi features under the C SDK,
although these depend heavily on
downloadable example projects.
We had previously installed the C
SDK, so we simply had to perform
an update at the command prompt
to get access to the new libraries and
examples. New installs of the C SDK
should already include the most up-todate files.
There are a few command line
switches that need to be used in the
“cmake” command for WiFi support:
-DPICO_BOARD=pico_w
-DWIFI_SSID=“Network Name”
-DWIFI_PASSWORD=“Password”
The first of these sets the board to be
a Pico W; we had not needed to use a
switch previously as the Pico was the
default. If you wish to eliminate confusion, the switch argument for a Pico
is simply “pico”.
The other switches set the SSID and
password parameters for a WiFi network. Doing it this way is much easier
than manually updating many source
files. It also avoids having to store these
credentials in a source file that might
need to be distributed to others.
The release notes for version 1.4.0
of the C SDK describe the updates that
coincided with the release of the Pico
W. You can find them at https://github.
com/raspberrypi/pico-sdk/releases
As for the Pico, the Raspberry Pi
Foundation’s guides assume that you
are using a Raspberry Pi computer to
compile for the Pico W. While not the
quickest way to compile code, the
instructions are clear and work well
in that case.
There is also Pico Setup for Windows, which installs all the programs
needed to compile for the Pico and
Pico W using the C SDK. It can be
downloaded from https://github.com/
ndabas/pico-setup-windows/releases
Although the most recent version of
that software predates the Pico W, the
installer can download more recent
SDK files.
Using the Arduino IDE
We tried two different board profiles
for the Pico in our review from last
58
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
year. There is an ‘official’ board profile
that uses Mbed OS and another profile
(Arduino-Pico) that uses the C SDK.
The first is included as one of the
default options that can be installed
by the Arduino Boards Manager, while
the other needs a link to be added to
the Additional Board Manager URL
field under Preferences.
We found that the latter was actually the first to support the Pico W,
although this is perhaps not surprising as it uses the C SDK from the Raspberry Pi Foundation itself. At the time
of writing, we have not seen an official
Arduino core for the Pico W.
So all our tests with the Arduino
IDE for the Pico W have been with the
Arduino-Pico core: https://github.com/
earlephilhower/arduino-pico
That link includes instructions on
how to install this core into the IDE.
Using the Arduino IDE for the Pico
W was as simple as it gets. After updating or downloading the Board Profile,
we set the board to “Raspberry Pi Pico
W” and uploaded the “ScanNetworks”
example sketch. It then produced a list
of nearby WiFi networks on the Serial
Monitor (see Screen 1).
As a test, we tried the Pico W sandwiched between the BackPack and
LCD PCBs, as well as sitting loose
on our workbench. Most networks
showed a decrease of around 10dB
in the indicated RSSI level compared
to when the Pico W was loose and
unshielded by other boards.
That’s probably not critical for most
applications. Still, it’s worth noting
that using the BackPack and accompanying LCD with the Pico W attached
directly will likely reduce the range or
performance of the WiFi chip.
Comparing WiFi boards
The release of the WiFi-capable
ESP8266 almost a decade ago and support for it being added to the Arduino
IDE suddenly made hobbyist WiFi
projects both cheap and straightforward. At that time, many boards under
$10 appeared on the market.
The Pico W is in the same league
as the ESP8266. The newer ESP32 is
better-equipped and offers the promise of more I/O pins. We made a comparison with these in our original
Pico review.
The Arduino IDE does a great job
of using consistent language across
different hardware, making it easy to
try other devices if you are already
siliconchip.com.au
Screen 1: With excellent support for the Pico W in the Arduino IDE via the
Arduino-Pico core, the example sketch to scan for nearby WiFi networks was
easy to compile and run, producing the expected results.
familiar with the ESP8266 or ESP32.
Those using MicroPython should have
little trouble moving across, too.
In the short term, we expect the Pico
W’s documentation to be its strength
compared to other WiFi-equipped
boards, perhaps drawing in a greater
share of novices.
The continuing parts shortages may
give the upper hand to any board
which is simply available (as long as
pricing remains reasonable), and the
Raspberry Pi Foundation appears to
have ample supplies of the RP2040
chips; however, the early supply of
the Pico W is patchy.
In the long term, we think the different boards will find their own niches.
For example, the RP2040’s PIO appears
to have a lot of untapped potential. The
RP2040 also has two cores, although
some devices in the ESP32 family also
do. We will also keep a close eye on
when Bluetooth becomes usable on
the Pico W.
Conclusion
It’s still relatively early days, and we
expect that there will be some refinement to the various libraries and other
software for the Pico W. There are hints
on some forums that the Bluetooth
Australia's electronics magazine
capabilities of the CYW43439 chip
will be put to use.
Devices like the ESP32 (which is
similarly supported by MicroPython
and the Arduino IDE) already offer
various Bluetooth capabilities, such
as serial and audio over Bluetooth
and also Bluetooth Low Energy (BLE).
Hopefully, the Pico W will gain similar features.
We didn’t run into any problems
using the Pico W on our BackPack
with an LCD touch panel, although
the other PCBs in proximity did seem
to attenuate the WiFi signals slightly.
With MicroPython and the Arduino
IDE long having had support for WiFi
and Bluetooth, it won’t be long before
we see projects using the Pico W in
place of other boards using ESP8266
and ESP32 chips, especially at current
prices. At the time of writing, the Pico
W was available from:
∎ Digi-Key Electronics (SC0918)
siliconchip.au/link/abgw
∎ Core Electronics (CSE08703)
siliconchip.au/link/abgx
Other retailers we expect might
stock the Pico W when it becomes
available in volume include Altronics, element14, Mouser and Little Bird
Electronics.
SC
November 2022 59
|