Gadget Book: Connecting to the Internet with Raspberry Pi Pico W

Author: EIS Release Date: Jun 26, 2023


Yesterday I was writing about Bluetooth coming to the Raspberry Pi Pico W and – in the original Raspberry Pi post – I also saw a link to this e-book: Connecting to the Internet with Raspberry Pi Pico W. Very interesting it looks, too.

Gadget Book: Connecting to the Internet with Raspberry Pi Pico W

Okay, it’s not a traditional book available on the shelves on your local Waterstones, but it’s a hefty (more than) application note that is worth flagging, with lots of example code and configuration steps. The word from Raspberry Pi themselves…

Pico W
It begins with a look at the Raspberry Pi Pico W microcontroller board, which is based on the Raspberry Pi silicon – the RP2040 microcontroller chip.


Next, in Chapter 2, it considers getting on the internet with the the use of the C SDK, building an example binary, which will scan for nearby wireless networks. Then comes building another project to connect online and then to self-discover the type of hardware you are using:

 

“There is no direct method in the C SDK that can be called to allow software to discover whether it is running on a Raspberry Pi Pico or a Pico W. However, it is possible to indirectly discover the type of underlying hardware. If the board is powered via USB or VSYS, so 3v3_EN is not pulled low externally, with GPIO25 low, ADC3 will be around 0V for Raspberry Pi Pico W and approximately 1/3 of VSYS for Raspberry Pi Pico.”

Chapter 3 looks at getting on the internet with MicroPython, using a pre-built binary that can be downloaded, and using Thonny as the recommended editor. It also looks at test flashing of the LED on the Pico W (including implementing a RESTful web server to allow you to control the LED), and making HTTP requests…

Bluetooth
With Chapter 4 your are Bluetooth bound – it begins by looking at the protocol in general terms (pairing, broadcast mode, the Generic Access Profile (GAP), the Generic Attribute Profile (GATT), and UUIDs, etc).

Chapter 5 covers working with Bluetooth and the C SDK, creating an example Bluetooth service (pictured below). Note that more example code is also available from the pico-examples GitHub repository.

 

Finally, in Chapter 6, there is working with Bluetooth in MicroPython.

“Wireless support for Raspberry Pi Pico W has been added to MicroPython. A pre-built binary, which can be downloaded from the MicroPython section of the documentation website, should serve most use cases and comes with micropythonlib pre-integrated into the binary.”

This section includes advertising a Bluetooth service (full code example) and creating another Bluetooth service (a temperature service peripheral) using the generic peripheral advertising code.

For completeness, Appendix A is ‘Building MicroPython from source’ and Appendix B is simply ‘Documentation release history’.