Articles Hierarchy

Articles Home » RPI » Raspberry Pi PICO W

Raspberry Pi PICO W

from PICO

yes, today 24.10.2022 / late, the
PICO W pdf doc rp2040 ds
is nothing new... but
after play PICO (about 1 / 2021 ) the PICO W has a added WIFI chip and with that similar functionality as a ESP32

-a- on my preferred shopping channel SHOPEE not find PICO W ( or heavy over priced )
today i found out that the official source / for this region / Cytron MY /
+ + has stock &
+ + allows now normal bank transfer
+ + and even CashOnDelivery

-b- read that now for PICO W there is a beta version of Circuit Python ( driving new WIFI chip )

>> so now i ordered it
( for 280 THB / 7.5 Euro from CYTRON by DHL with Cash On Delivery )
( where the old PICO would be 180 THB )

and CNX already (wait all day for DHL delivery 27.10.2022, ok 28 morning ):

i want go the FULL WAY again,
means try
* 1 * : Raspberry Pi Pico C/C++ SDK
* 2 * : via Arduino IDE
* 3 * : Micro Python
* 4 * : Circuit Python

ADD would like to try DEBUG PICO W ( like with PICO... )

on a win 10 PC i download

-1- official IDE

DO NOT FOLLOW THIS! it did not work

i follow: youtube
but at end build not work ? version conflict?







'open 'win 10' cmd window
cd ..
cd ..
' I am on C:

mkdir Pico

cd Pico

git clone -b master

cd pico-sdk

git submodule update --init

cd ..

git clone -b master

'close cmd window

'open developer commend window (2022 v17.3.6 )

cd C:\Pico
setx PICO_SDK_PATH "..\..\pico-sdk"

'close developer commend window

'open developer commend window (2022 v17.3.6 )

cd C:\Pico
setx PICO_SDK_PATH "..\..\pico-sdk"

'close open developer commend window

cd pico-examples

mkdir build

cd build

cmake -G "NMake Makefiles" ..

nmake : ERROR

also here is a better style for the workflow
what shows that the versions are critical??

try other way:

if you use the ( similar to Raspbberry Pi ) setup tool:

ok, better, 3 uf2 files there, so the build worked, i compared with /build/ under raspberry pi linux same.

with the first test of VScode (2019) it failed...
later will try dig deeper.
( well for me that PICO SDK thing under Windows is just a mess / unusable for beginner ! like me )

side step: use a Raspberry Pi 4B
( with original 32bit RPI OS )
burn to 8GB USB3 datatraveler 111
using raspberry pi imager v1.7.3 with presetup
( name , ssh , password, wifi ,wifi-country, timezone, keyboard )

(after the installation of PICO tools and VSCODE of the 8GB only 470MB free / lucky )

+ boot in RPI4 ( with ethernet cable / hdmi cable / power cable / optional: keyboard / mouse )
+ use mobile FING to find RPI IP
+ use win PC Bitvise SSH Client to login
+ + setup VNC and fixIP update ... and install my defaults

and use the
chmod +x

good, already find examples for PICO W, like

still on RPI4 with installed PICO SDK
now try to get the basic running:
first need to check ( depending where you installed the SDK )
where is:
here mine is ? == "projects/PICO"
CMakeLists.txt need that info for include!!!

under that i make a new project
mkdir hello_usb
cd hello_usb
nano hello_usb.c
nano CMakeLists.txt
mkdir build
cd build
cmake ..

-1- the code is a combination of BLINK and print to USB examples
both are tricky!!!
* as with PICO the print goes default to a UART pin and not back to USB
* as with PICO W the LED is not on GPIO, its on a pin of the WIFI chip
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
* SPDX-License-Identifier: BSD-3-Clause
* KLL combine BLINK and HELLO_USB

#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"

int main() {

if (cyw43_arch_init()) {
printf("WiFi init failed");
return -1;

while (true) {
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1);
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);

printf("Hello, world! i am PICO W and can BLINK too\n");
return 0;

-2- the CMakeLists.txt you can not find from the examples so easy,
as they are nested over sub-directories and need to be combined from the 2 examples too,
plus i needed the board settings, actually i not understand where that is done for the examples?

CMakeLists.txtcmake_minimum_required(VERSION 3.13)
set(PICO_BOARD pico_w)
# initialize the SDK directly

project(hello_usb C CXX ASM)

message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.3.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")


# initialize the Raspberry Pi Pico SDK

-Wno-format # int != int32_t as far as the compiler is concerned because gcc has i>
-Wno-unused-function # we have some for the docs that aren't called

if (PICO_CYW43_SUPPORTED) # set by BOARD=pico-w
message("Pico W ")

if (TARGET tinyusb_device)

# pull in common dependencies
pico_stdlib # core func
pico_cyw43_arch_none # wifi chip also drives LED

# enable usb output, disable uart output
pico_enable_stdio_usb(hello_usb 1)
pico_enable_stdio_uart(hello_usb 0)

# create map/bin/hex/uf2 file etc.

message(WARNING "not building hello_usb because TinyUSB submodule is not initialized in the SDK")

and, after above all worked you get a
file you can copy to the board after a power-up [bootsel] button pressed and find a usb drive at /media/pi/RPI-RP2/
with copy *.UF2 the drive vanishes ( got some warnings too )
and the board starts blinking.

now how about the printing to USB?
i made a .bash_aliases with
alias PICO='minicom -b 115200 -o -D /dev/ttyACM0'
so with PICO i get a minicom window what prints the
"Hello, world! i am PICO W and can BLINK too" lines

end minicom with [ctrl][a][x]

now i delete the /build/.. dir and want VSCODE to do it again:
in the dir with the *.c file type
code .

first time have to adjust the compiler to GCC for arm non-eabi [change active kit]
and then build [Build]
( buttons down in the last line )

so i run on a RPI4B / 4GB Ram /
after start code the cpu is on limit but just wait it out.
the tools works even faster as in the above manual way,
but the code editor is not usable.. ( ok i am on VNC what has also a lag )
but when i edit a file and use the key arrow up / down i not want to see that 2 sec later.

//__ end side step Raspberry Pi and back to win 10 __//

-2- arduino IDE

i did installed a nightly update, so its called 1.8.20

using the preferences ( can add with , )

select the board PICO W

find the example for the AdvancedWebServer ( save as own project / build / select port USB cable )

after RESET FLASH ( by copy flash_nuke.uf2 into [bootsel] powered board
the arduino IDE only finds a port: UF2 connection....
but a upload to that worked!
later i reconnect USB and it was back on COM20.

now there is no info ( serial monitor not show anything) , but i found its STA webserver IP and call it from browser

now that looks much like the examples for the ESP web server

-3- micro python



-3.1- setup
install THONNY
!! as i used circuit python first: power board with usb cable while press [bootsel]
copy over flash_nuke.uf2

copy over rp2-pico-w-_____.uf2

select micropython RPI PICO on COMxx
edit and save to RP2040

-3.2- 3 AIN code test

-3.3- webserver
follow tomshardware


-3.4- MQTT
micropython MQTT to RPI4 broker
well, i just did play about ESP8266 / sonoff s31 / to RPI MQTT broker / with NodeRed dashboard
so that sounds very interesting.
coming soon

-4- for circuit python:

MuEditor-win64-1.1.1.msi ( and install )

* Circuit Python 800beta ++

* lib and examples

* for cleanup PICO boards flash

-4.1- circuit python setup
start: unpack PICO W
( later solder headers / see at the end )
connect PC USB and see drive! ( if not first time need to press [bootsel] while connecting )

copy Circuit Python to drive ( board auto reboot )

start MU editor / connect
LOAD ( from board ) / run

-4.2- circuit python example project
make a 3 Ain to adafruit IO test
info from here

code without the libs and .env file
while play with a jumper cable : 36 3v3 out OR 33 AGND to 31 A0, 32 A1, 34 A2

-4.3- circuit python example webserver
thanks to

follow httpserver/en/latest/examples

-4.4- circuit python example webserver + AIN datapage

here i have trouble with the adafruit_httpserver :
return HTTPResponse(body=XXX
( serves a empty static html page with the dynamic XXX inside a < pre>XXX )
i can not send a dynamic html page string ???
return HTTPResponse(filename=
( serves a static html page )

need to test
looks good now:

-4.5- circuit python MQTT
while we have already used adafruit IO i want know if that
circuit python mini MQTT lib can be used to connect to a RPI4 MQTT Broker
mqtt api
ok, try to modify my 3Ain adafruitIO example / with the help of Lady Ada's code
to a 3Ain MQTT Raspberry Pi Mosquito Broker

so here back to the RPI4-32 and install
sudo apt update sudo apt upgrade
sudo apt install mosquitto mosquitto-clients
sudo systemctl status mosquitto

sudo nano /etc/mosquitto/mosquitto.conf add
allow_anonymous false
password_file /etc/mosquitto/pwfile
listener 1883

now set user and passworde for the PICO W board circuitpython MQTT client
sudo mosquitto_passwd -c /etc/mosquitto/pwfile u213
password p213
repeat p213

also can test it with a python simulator
pip3 install paho-mqtt
to see that from a other terminal window:
mosquitto_sub -h localhost -u "u213" -P "p213" -t "P213/#"
also use python to cache that stream and save to a CSV file

back on the win PC
and restart the PICO W board
PC MU editor CircuiotPython PICO | 8.0.0-beta.4\
___ analogio lib loaded / A0 GP26 pin 31 / A1 GP27 pin 32 / A2 GP28 pin 34
___ PICO W MQTT data point
___ Listening on
___ mqtt_topic: P213/PS01
___ Attempting to connect to
___ Connected to MQTT Broker!
___ Flags: 0
RC: 0
___ Subscribing to P213/PS01
___ Subscribed to P213/PS01 with QOS level 0
___ Publishing to P213/PS01
___ Published to P213/PS01 with PID 1

___+ A0: 0.553 [V]
___+ A1: 0.543 [V]
___+ A2: 0.648 [V]
___+ T0: 36.03 [degC]

on RPI4-32 test subscrib
mosquitto_sub -h localhost -u "u213" -P "p213" -t "P213/#"pi@RPI4-32:~/projects/PICO $ mqttsub
Hello Broker!
{ 'dev':'PS01', 'DCpower': { 'Volt': 0.64,'Amp': 0.62,'Watt': 0.40 } }
{ 'dev':'PS01', 'DCpower': { 'Volt': 0.60,'Amp': 0.61,'Watt': 0.37 } }
{ 'dev':'PS01', 'DCpower': { 'Volt': 0.54,'Amp': 0.54,'Watt': 0.29 } }

until now i used the 3 analog in from pico w ( online read have quality problems?? but still better as ESP analog in )
but have idea to use my ADS1115 adafruit 16bit ADC / I2C connected / 4 channel / 800s/sec / as a 2 differential input
(like for volt and current measurement of a DC power supply )
find in bundle lib dir adafruit_ads1x15 and copy into pico w /lib/
find also examles adafruit-circuitpython-bundle-8.x-mpy-20221031\examples\ and other
make a switch to use normal analogs or busio analog break out ( ADS1115 on x48 )

on RPI4 broker use
'mosquitto_sub -h localhost -u "u213" -P "p213" -t "P213/#"
with ADS1115{ 'id': 0 ,'dev':'P01','Volt': 0.66,'Amp': 0.68,'Watt': 0.45,'Temp': 35.56 ,'ch01': 0.00 ,'ch23': 0.00 }
{ 'id': 1 ,'dev':'P01','Volt': 0.55,'Amp': 0.57,'Watt': 0.32,'Temp': 35.56 ,'ch01': 0.00 ,'ch23': 0.00 }
{ 'id': 6 ,'dev':'P01','Volt': 0.69,'Amp': 0.70,'Watt': 0.48,'Temp': 35.10 ,'ch01': 1.24 ,'ch23': 0.00 }
{ 'id': 7 ,'dev':'P01','Volt': 0.72,'Amp': 0.74,'Watt': 0.53,'Temp': 35.56 ,'ch01': 0.00 ,'ch23': 0.00 }
{ 'id': 8 ,'dev':'P01','Volt': 0.72,'Amp': 0.74,'Watt': 0.54,'Temp': 35.10 ,'ch01': 1.26 ,'ch23': 0.00 }
{ 'id': 9 ,'dev':'P01','Volt': 0.75,'Amp': 0.77,'Watt': 0.58,'Temp': 35.10 ,'ch01': -0.02 ,'ch23': -0.00 }
{ 'id': 10 ,'dev':'P01','Volt': 0.73,'Amp': 0.74,'Watt': 0.54,'Temp': 35.10 ,'ch01': 2.50 ,'ch23': -0.00 }
{ 'id': 11 ,'dev':'P01','Volt': 0.69,'Amp': 0.69,'Watt': 0.48,'Temp': 35.56 ,'ch01': 0.29 ,'ch23': -0.00 }

measuring delta over 1 or 2 batteries

here i need to check more on the
feature for use together with 2 differential channels
as i want use
chan01 Volt from a voltage divider 48VDC / 3.3V
chan23 mVolt from Hall current sensor ( isolated )
++ but that is only for the original hall sensors,
there are also breakout board what have already a decouple amplifier
let's see what i have here? ACS758 range 50A ( AC DC / 2.5V +- 0.040V*A )

instead of good ( isolated ) HALL sensors can also use SHUNT current sensors,
for a small PS use a INA219
( read 26V DC, 3.2A, I2C link 0x40 (A0 soldered 0x41, A1 soldered 0x44, A0&A1 soldered 0x45 )

adafruit INA219

i run into a few problems, about libs and I2C
copy from bundle:

i disable / and disconnect ADS1115 and connect INA219
at start show the detailed info:
PICO_W boot___ PICO W MQTT data point
___++ INA219
Config register:
bus_voltage_range: 0x1
gain: 0x3
bus_adc_resolution: 0x3
shunt_adc_resolution: 0x3
mode: 0x7

Voltage (VIN+) : 0.888 V
Voltage (VIN-) : 0.888 V
Shunt Voltage : -0.00003 V
Shunt Current : -0.0002 A
Power Calc. : -0.00018 W
Power Register : 0.000 W

when i connect INA219 Vin+ to 5V (USB) see MQTT
{ 'id': 35, 'dev':'P01', 'Volt': 1.52, 'Amp': 0.09, 'Watt': 0.13, 'Temp': 35.56, 'Vbus': 5.01, 'ShuntAmp': -0.00 }
!! that high side measurement ( by a 3v3 mcu and INA219 ) works !!

to test it is a other question:
i have a XH-M411 ( DC 3V-35V to DC 5V-45V Boost Converter Board 5A ) ( Vout > V in // only volt indication )

still where the input volt comes from? and what LOAD i have to burn it?
later more

now i setup RPI3B+ as broker ( mosquitto autostart ) and
NODE-RED dashboard ( manual start )

now while the PICO code can start without boker
it will just measure and print
but to connect to broker LATER need a reboot!!
i had to setup mosquitto and change .env in PICO_W to broker

there i did earlier some tricky install ( like admin and user setup and selectable projects! )
i have to dig into again

also new broker setup and new data structure ( topic and data JSON like )
but the main idea is similar to a prior project ( where i saved the /home/pi/.node-red/projects/MYPROJECT/flow.json file )
NO, the copy of the old flow.json over/in a new created /projects/PICOW/ fails and i see a empty flow??? thats bad...
BUT a import ( of file: flow.json from that browser computer ) worked besides i had the 2 "Flow1" ? i did hide the original / empty one.
slowly work on the changes..

now in the MQTT world a ONLINE broker is more useful, if remote dataview or action is required
still the local RPI can be a local dashhboard provider,
unless the node-red is also ONLINE, where just a browser worldwide is needed.
but that is not all the options, how about to see the above local system as local / adhok / fast trend / panel
and from there via the mosquito a bridge is build
to a ONLINE MQTT broker ( but first try to find a free / entry account )
* * when a more moderate datarate is required ( as ONLINE that costs money )
possible more easy to make a python bridge code service

but slowly: test the PICO_W & INA219 with a
12VDC "S25-12" ( 2.1A ) measured with DMM 12.1VDC without load ( but there is a adjustment poti )
and some RGB LED STRIP driver.
and what i see from INA219 ( in mqttsub ) NOTHING
- - i forget to connect the MINUS of the PICO ( or INA ) with the MINUS of the PS - - LOAD
+ + i think there should be a GND screw connector on the "powerside" of the INA

yes the driver give a flickering RGB LED show, you never know what current you just measure...
i will rearrange the code to measure every second ? and filter volt and current ?
but first from adafruit
there might be a config about avg-ing inside the
INA219# optional : change configuration to use 32 samples averaging for both bus voltage and shunt voltage
ina219.bus_adc_resolution = ADCResolution.ADCRES_12BIT_32S
ina219.shunt_adc_resolution = ADCResolution.ADCRES_12BIT_32S
# optional : change voltage range to 16V
ina219.bus_voltage_range = BusVoltageRange.RANGE_16V

besides the INA chip internal averaging i build a
node-red tune app for signal s
and a signal filtered sf = sf *sa + s*sb for Volt Amp Watt with sa + sb = 1.0 and sa send by mqtt for each
for the INA ( now can read 1 sec and filter )
the filter for Volt Amp Watt start with a moderate 0.8 setting, but can be tuned by mqtt / node-red ui/TUNE
actually target 0.9..
with 1.0 no change come through ( indication freezes )
with 0.0 no filter at all.

add allow remote tuning of the sample time

now that remote mqtt tuning will be lost at reset/boot
and i ask at forum how to do: NVM
example code:

note: so
* node-red functions are JS,
* pico_w circuit-python
can get easy confused while working on both.
bad esp. JSON lib differences:
JS: print( MYJSON.variable )
PY: print( MYJSON['variable'] )

is a online editor ( and works here from google chrome via USB ( with some file saving problems )
but from here:
i got the idea that the pico w is just online by wifi local LAN ( like when powered ( usb ) but not by computer )
if circuitpython version is newer and a .env file is there with wifi credentials, but not find that...
800b3 revision info states that works for ESP boards now only, wait and see!

-4.7- Circuit Python update
update to 8.0.0 beta 4
webserver now can do fixIP
core can nowfrom ipaddress import ip_address # _______________________ fixIP

-4.8- issue1: ( with 8.0.0b4 ? )
i use any win PC USB port to PICO W
can load UF2 ( if [bootsel] pressed at cabel connetcion ( power up ) )
can develop via Mu
can close Mu and still runs
can plug in USB get win USB connect music and code starts
i follow up on MQTT broker see msg ( now with counter and every 3 sec )
changed code so led ON at boot ( OFF 1 sec for read analogs and send mqtt )

but: when i power up by charger pico w not boot/start
so useless as stand alone tool??
ok, seems some left over prints ( not disabled ) disabled PICO W booting on charger

but need to check more, test code of my diag print ( related to the boot without usb?? )

code.pyimport time
import board
import digitalio

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
led.value = True # ____________________________________ to see its powered

DIAG = False # False # True # _______________________ diagnostic print enable
def dp(line=" "):
if DIAG : print(line)

dp(" ") # _________________________________________ new line REPL
count = 0
while True :
led.value = True
dp("#: %d" % count )
count += 1
led.value = False

this seems also only rare booting from charger??

now i use a RESET pb ( over pin 28 pin 30 )
that will try again ( and not need to unplug USB connector ( PC side or PICO board side )

-4.8- issue2: ( with 8.0.0b4 ? )
OS incompatibility
the pico w setup with circuit python 8.0.0 beta4
-a- when setup ( and use Mu 1.1.1) from win 10 : can not use in RPI4 ( no drive opens )
-b- when flash it from RPI and use it with Mu 1.0.3 there and then:
when move to win PC
it detects a bad drive ( and automatically repairs it )

-4.8- issue3: ( with 8.0.0b4 ? )
i2c = busio.I2C(board.GP5, board.GP4) # must use pin
# as SDA1 pin 6 SCL1 pin7 ( SDA SCL SDA1 SCL1 not in dir(board) ?? )
but it works

well, with Circuit Python i feel as a beginner, writing my first arduino sketches 10 years ago ( ARDUINO DUEMILANOVE board )
it is that bad..
besides using python, still do that blocking delay things
time.sleep(10) # ___ wait 10 sec for next job
what is a absolut NO GO for a Programmable Logic Controller thinking,
- - disables the REPL [CTRL][c],
- - delays main jobs like listen to webserver/mqtt incoming...
so, now i do again what i did with my first arduino code
replace all while True : delay() JOB1 with a main loop
+ + what runs as fast as possible
+ + check milli seconds for elapsed time to trigger a timed JOB1() .. or a semi multi tasking JOBx() structure
+ + check x loops counter for fast background checks to catch events
+ + check by big loop counter ( and optional report every 1 million loops the delta time )
for the milli sec i use the
# _____________________________________________________ expect /lib/adafruit_ticks.mpy from
from adafruit_ticks import ticks_ms # _________________ also we count the ( not delayed ) loops and report on 1 million loops ( about > 22 sec ???)

pack some of that learned features into a bigger project
and use a own web-page / article / for it here

end Circuit Python

got it soldered at a mobile repair shop with professional equipment for 1.06$
my eyes already have new plastic lenses, still not good enough for that little things.

i use the RPI4 remote VNC desktop
and there it could make sense not only to use the MINICOM terminal ( to PICPW... )
( and that works remotely also in SSH client terminal )
try for desktop add CUTECOM

in MU python window i see that serial terminal too,
but actually i have problems to stop it [ctrl][c] not work
can not copy strings from there as the ..... refresh too fast and any selection get lost
but with CUTECOM i can start the LOG file.