
In this lecture I introduce the course and it's goals.
In this lecture I introduce myself as your tutor, Dr Jon Durrant.
This lecture outlines the course approach and resources available to support you.
This is a summary lecture for this section
This section's goals are:
Have Raspberry PI Pico-W Setup
Build SDK code and Deployment to Pico-W
Understand a commercial IPGeo Web Service
Write First Pico-W Web Service Client
The lecture summarises the setup of the Pico-W and how to build a project. This is a revision for prerequisite knowledge for the course.
The Pico-W has two approaches to flashing binary code onto the device. Either to use Bootsel or SWD. Both approaches will be fine for this course.
The lecture looks at the code repository that goes along with the course. How to download or clone it from GitHub. The repository contains many projects which we will look at on the course. It therefore uses a strategy of sharing the libraries across these projects. This lecture will explain this.
The first example on the course is a little Pico-W application that will connect to your local WiFi and print out the connection details.
The first services we will use on the course is IPGeolocation.io. In this lecture, I will introduce the service and how to call it from Python so we can see what it does.
In this lecture, we will look at some Pico-W code to call the IPGeolocation.io service.
This is a summary lecture for this section of the course.
Section Goals:
What is a Web Service
What is Restful Web Service
Python Test Server
Python Test Clients
Where does the Web Service technology come from and therefore the protocols involved
There are lots of Web Service standards not all of which are relevant to MicroController development. This leads us to Restful Web Services which is the subject of this course.
Setting up a test environment in Python that we will use for our Pico Web Service Client.
Developing the first test web service as a server.
Passing data to the server over an HTTP GET request.
Passing data to the server over an HTTP POST request.
Authenticating using HTTP Basic Authentication.
Using a debug proxy to explore the web service call.
Section Summary
Introduce this section, its goals and equipment requirements.
What is URI or URL
Parse URL: uri-library
Parse URL: uriparser
This lecture looks at the terminology around the web service endpoint. That an endpoint is a URI and a URL. What are the parts that make up a URL.
The lecture looks at a C++ library for parsing the URL called URILibrary.
This lecture looks at a C library for parsing the URL called URI Parser.
This is a summary for this sections.
The goals for this section, the equipment needed and the projects that are included.
LwIP Library included with the SDK
HTTP Get
HTTP Get Query, i.e. including parameters in the request
This lecture looks at the LwIP library and the three "versions" or "modes" of this library we can link within the Pico SDK. We also introduce the pico_lwip_http app within this library that we will use through out the rest of this section of the course.
This lecture looks at the LwIP HTTP Client and the central function httpc_get_file_dns. Using this function we are able to build a simple web service client for the "Time" web service we built in Python back in section 3.
This lecture explores how to extend the web service client example to pass parameters to the web service. This is a very common use case for embedded sensors to send data over to a server.
The LwIP HTTP library is not always easy to work with and you will find yourself needing to debug your code. In this section I explain some of the debugging strategies I use and the LwIP HTTP configuration items to turn on some debug output.
LwIP is a lightweight IP package and the HTTP client is not intended to be full feature. There are therefore limitations for its use. I explore some of these in this lecture.
This is a summary of this section.
This lecture outlines the section goals, projects and equipment requirements.
Introduce JSON
Be able to use the TinyJSON Library for parsing
Be able to use the CoreJSON Library for parsing
This lecture looks at the origin of JavaScript Object Notation and it's use in modern web services.
TinyJSON is a open source library for parsing JSON by Rafa Garcia. https://github.com/rafagafe/tiny-json
CoreJSON is a library for parsing JSON from FreeRTOS. https://github.com/FreeRTOS/coreJSON
This is a summary lecture for the section.
Advantages of using FreeRTOS Kernel with LwIP
The FreeRTOS coreHTTP Library to undertake:
HTTP GET
HTTP POST
Using FreeRTOS Kernel with LwIP removes the need to call poll method and provides some additional services including POSIX Sockets.
POSIX Sockets underpin how most libraries implement HTTP. This lecture will use the library directly to "hack" an HTTP GET request.
This lecture configures coreHTTP to undertake an HTTP GET of a web service.
This lecture configures coreHTTP to undertake an HTTP POST of a web service.
This is a summary of this section.
Section goals and equipment.
HTTP Basic Authentication
Understand TLS
Use TLS as HTTPS Client
This lecture looks at adding HTTP Basic Authentication into our coreHTTP request.
Using the WolfSSL Library this section looks at how to add a TLS layer into our communication encrypting the transport.
This lecture extends the Request class to be able to make either HTTP or HTTPS GET or POST requests.
This lecture looks at further opportunities in using TLS to identify the client and server. These are largely beyond the scope of this course. This lecture recommends some of the additional study that could be done.
This is a summary lecture for this section.
This section goals:
Understand the basics of XML. Its structure
Parse a simple XML example using
MXML Library
MiniML Library
This lecture covers the basics of XML. Enough to allow the explanation of the parsing libraries.
MXML is a tiny embedded XML parser that allows the walking of the XML document. In this lecture, we use this to parse a simple XML string.
MiniML is a tiny validating XML parser that allows the XML structure to be validated and the data copied out into a C structure. In this lecture, we use this to parse a simple XML string.
This is a summary of this section.
Congratulations on completing the course. I've got additional optional goals in this section:
Recap of the course
Debugging Web Services
Web Service Examples:
YouTube Subscriptions Ticker
Weather Forecast
Currency Rates Ticker
This is a recap lecture of the course and some of the key points.
Debugging web services can be frustrating. In this lecture, I talk through some approaches to make this smoother.
This example shows the use of the YouTube Data API to pull back subscription count and display on a panel.
This example shows the use of the open weather map API to pull back the weather forecast for a location and display it on a TFT screen.
This example pulls back currency rates to display on a ticker display.
Thank you but this doesn't have to be goodbye. There are other things to learn with the Pico.
Using Web Services I can pull real-world data for my Raspberry PI Pico W to act on. Or submit sensor data from my Pico W to central services in an IoT pattern. Web Services enable us to connect the Pico W to a wider world of exciting distributed systems.
In this course, we explore how to code C/C++ for a Pico-W to become a web service client. We look at two fundamental libraries to manage the HTTP protocol; LWIP HTTP App and coreHTTP. coreHTTP requires that we also use FreeRTOS kernel and LWIP Sockets. The library gives us a great deal of flexibility and with wolfSSL allows us to connect to HTTPS web services.
The restful web services we primarily target on the course respond with JSON payloads. The course teaches how to parse these using two optional libraries coreJSON and tiny-JSON. Some web service payloads return XML and a further two libraries are explored to be able to handle these payloads.
The course uses STDIO for the output of most web services. Two examples use a pre-built Pico-W display board, the PIMORONI Galactic Unicorn. One example uses a TFT screen, this will needs to be wired to the Pico W. Optionally you could modify these examples to produce STDIO or use alternative hardware.
The course assumes knowledge of C++. Though each example walks through the functionality, the course will not talk about the syntax of C++. FreeRTOS Kernel is used to support concurrent tasks and enable POSIX Sockets. An understanding of FreeRTOS Kernel is assumed. I have another course on FreeRTOS Kernel for the Raspberry PI Pico to cover this.
The course assumes you can compile and deploy C++ code to the Pico Q using the Raspberry PI Pico SDK. My other course “Introduction to C Development Environment for Raspberry PICO” teaches these skills.
A web service test environment to support building and understanding these web services clients uses Python. Some Python knowledge would be helpful.