We may earn an affiliate commission when you visit our partners.
Course image
Dr Jon Durrant

The Internet of Things (IoT) allows us to put small devices around our environment to measure and control. The Raspberry PI Pico-W is an excellent platform for developing such IoT devices, connecting over WIFI and MQTT protocol.

Read more

The Internet of Things (IoT) allows us to put small devices around our environment to measure and control. The Raspberry PI Pico-W is an excellent platform for developing such IoT devices, connecting over WIFI and MQTT protocol.

In this course, we explore how to code C++ for a Pico-W  IoT device using the FreeRTOS coreMQTT-Agent library version v1.1.0. We take the approach of building an IoT framework for all the devices we want to build. With the ability to connect, publish and subscribe to messages. To operate we also need an MQTT broker and the course talks through the use of Eclipse Mosquitto as a locally installed broker on a Raspberry PI, or using Flespi as a cloud-hosted broker.

The course covers:

  1. Establishing WIFI connectivity in station mode to an access point or router

  2. Building TCPIP socket transport for MQTT protocol

  3. Publishing messages

  4. Subscribing and taking action on messages

  5. Securing MQTT over a TLS Socket, using WoldSSL

Simple circuits to turn on and off an external LED using a local switch connected to the Pico-W are used to test the concepts.

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 for managing the MQTT protocol and 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 using the Raspberry PI Pico SDK. My other course “Introduction to C Development Environment for Raspberry PICO” teaches these skills.

Test scrips to interact with the device are written in Python. Some basic Python knowledge would be helpful.

Full captions are provided for the course and are not auto-generated.

Enroll now

What's inside

Learning objectives

  • Build an iot stack on pico w in c++
  • Connect pico-w to wifi service
  • Connect pico-w to an mqtt broker (port 1883)
  • Publish messages in mqtt on a topic
  • Subscribe to a mqtt topic and handle incoming messages

Syllabus

Introduction

Introduction to the course and the goal to build out an IoT stack for our application in C++ on the Pico-W

Introduction to the Tutor, Dr Jon Durrant.

Read more

The course approach, structure and resources to help you learn.

Section summary and resources.

The goals for this section:

  • Raspberry PI Pico Setup

  • SDK and Code Deployment

  • MQTT Broker Service

  • First Pico-W Thing

Setting up the Pico-W with header pins and the SDK.

A reminder of the two approaches available to copy binary code onto the Pico-W.

The course code repository is on GitHub. Its structure and how to download it.

We will require an MQTT Broker to get IoT devices to connect. Introducing the concept of a broker.

How to install a local MQTT Broker on a Raspberry PI 4.

How to use the Flespi as a cloud-hosted MQTT BRoker.

A first example IoT Thing built out to run against the broker and control an LED.

Section Summary and Resources.

Goals of this section are to explain the features of MQTT and the Software Stack this course will build.

MQTT originated in 1999 and is now a common IoT device protocol. This lecture looks at the features of MQTT.

To operate MQTT on the Pico-W we require a software stack that will handle the messaging. Ontop of this stack can sit our application. This lecture outlines the stack we will spend the rest of the course building.

Quiz on MQTT and the Software Stack for the Pico-W

This section is all about establishing a connection:

  • Wifi Connection

  • Socket Transport

  • MQTT Connection or Session

Connecting Raspberry PI Pico to a WIFI SSID.

Establishing an MQTT session using coreMQTT-Agent

The goals of this section are to be able to publish.

  • MQTT Topic Space that we will publish into

  • Listen in Python to the Pico-W publish a message

  • Publish using coreMQTT-Agent:

  • Lifecycle Message when Pico-W connects

  • LED Status

MQTT publishes messages to topics. Topics form a hierarchical space.

To show we have published we need a listener. For this section, we will listen from a Python test script.

MQTT does not produce any message on a device first connecting to the broker.  In this lecture we add to the framework to publish a message each time we connect.

We attach a switch and LED to the Pico-W so that pushing the switch changes the state of the LED (on to off). Then publish the state of the LED over MQTT.

Section Summary and Resources.

This section is all about subscribing and receiving messages on the Pico-W.

  • Publish and control from Python

  • Look at coreMQTT-Agent Subscribe Feature

  • Explore group of Pico-W devices communicating

We need to be able to send messages to our Pico-W IoT device. We will once again use Python to provide these test scripts.

To enable subscription we will need to extend our framework by:

  • Wrapping the  Subscribe Function

  • Handle Subscription Call-back

  • Handle Incoming Data Call-back

This lecture explores the design for extending our framework before we get into an example in the next lecture.

This example extends are latched LED device to be remotely controllable over MQTT.

In this example, we will use two Pico-W both operating as latched LED lights. We will make the switch on either device to control both devices at once.

This section will look at the concepts of security for MQTT.

  • Transport

  • Authentication

  • MQTT Topic Space Authorization

  • Audit Logging

Securing the transport layer.

Building a TLS transport layer using WolfSSL and testing with HTTP GET.

Updating the IoT framework to secure the MQTT session over a TLS socket.

Importance of authentication to identify the client device.

Authorising access to the topic space for the clients.

Audit log to identify unusual behaviour for debugging and security assessment.

A quick quiz on security concepts.

Section Summary

This section explores how the state of our device is actually a generalised problem and can have a general interface.

  • State Problem

  • Digital Twin Concept

  • State for Pico-W

This lecture generalises the concept of state for our sensor or controller devices. How a digital twin service might help us manage these devices.

This section explores one way of extending our framework to manage the state in a general way. You could do this in lots of other ways.

Congratulations on completing the course. Please leave a positive review on Udemy and get in touch to tell me how you are putting the knowledge to use.

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Uses FreeRTOS Kernel, which is a popular real-time operating system for embedded systems, indicating relevance to industry practices
Employs Eclipse Mosquitto and Flespi, which are widely used MQTT brokers, providing practical experience with industry-standard tools
Requires prior knowledge of C++, which may be a barrier for beginners without programming experience
Assumes familiarity with FreeRTOS Kernel, suggesting that learners should ideally have prior experience with real-time operating systems
Utilizes coreMQTT-Agent library version v1.1.0, so learners should verify compatibility with newer versions and project requirements
Involves building a TLS transport layer using WolfSSL, which is valuable for securing IoT communications and protecting sensitive data

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Iot with pico w and c++

According to students interested in embedded systems and IoT, this course provides a deep dive into building an IoT framework on the Raspberry PI Pico W using C++. Learners appreciate the focus on practical application with the Pico W and covering essential protocols like MQTT and securing connections with TLS. However, some mention that the course requires strong prior knowledge of C++, FreeRTOS Kernel, and the Pico SDK, which might make it challenging for those without these prerequisites. Overall, it is seen as a valuable resource for those with the necessary technical background looking to implement IoT solutions on this specific platform.
Appreciated the step-by-step framework development.
"Building the IoT framework incrementally was a great teaching method."
"The modular approach to creating the stack made it easier to follow."
"Helped me understand how to structure my own IoT applications."
Detailed coverage of MQTT and TLS security.
"The MQTT sections were very thorough and well explained."
"Learning how to secure the connection with TLS was particularly useful."
"Gained a solid understanding of publishing and subscribing with MQTT."
Excellent hands-on use of the Raspberry PI Pico W.
"Loved working directly with the Pico W and seeing the concepts come alive."
"Focus on the Pico W hardware made it very relevant for my projects."
"Implementing code directly on the hardware is the best part."
Initial setup environment can be challenging.
"Getting the C++ development environment set up correctly took some effort."
"Compiling and deploying to the Pico had a few hurdles initially."
"Wish there was more guidance on troubleshooting environment issues."
Assumes significant C++, FreeRTOS, and Pico SDK knowledge.
"It definitely assumes you know your way around C++ and FreeRTOS pretty well."
"You really need to have the Pico SDK environment set up and understand it before starting."
"Was a bit challenging because I underestimated the required background in FreeRTOS."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in IoT with Raspberry PI Pico W (C++) with these activities:
Review C++ Fundamentals
Strengthen your C++ foundation to better understand the code examples and build your own IoT applications on the Pico W.
Show steps
  • Review basic C++ syntax and data types.
  • Practice writing simple C++ programs.
  • Study object-oriented programming concepts in C++.
Brush up on FreeRTOS Kernel Concepts
Revisit FreeRTOS concepts to better understand how concurrent tasks are managed in the IoT framework.
Show steps
  • Review FreeRTOS task creation and scheduling.
  • Study inter-task communication mechanisms.
  • Practice using FreeRTOS primitives in simple examples.
Review 'Internet of Things with ESP32'
Explore a book on IoT development with a similar microcontroller to broaden your understanding of the field.
Show steps
  • Read the chapters on Wi-Fi connectivity and MQTT communication.
  • Compare the ESP32's architecture and capabilities to the Pico W.
  • Identify transferable concepts and techniques for your Pico W projects.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Follow MQTT Tutorials
Deepen your understanding of MQTT by following online tutorials and experimenting with different MQTT brokers and clients.
Show steps
  • Find tutorials on setting up and configuring MQTT brokers.
  • Experiment with different MQTT client libraries in Python.
  • Build a simple MQTT-based application to control a virtual device.
Build a Simple Temperature Monitoring System
Apply your knowledge by building a practical IoT project that measures temperature and publishes data to an MQTT broker.
Show steps
  • Connect a temperature sensor to the Pico W.
  • Write C++ code to read temperature data from the sensor.
  • Publish the temperature data to an MQTT topic.
  • Subscribe to the MQTT topic and display the temperature data on a dashboard.
Contribute to a relevant open-source project
Contribute to an open-source project related to MQTT, embedded systems, or IoT to gain practical experience and collaborate with other developers.
Show steps
  • Find an open-source project that aligns with your interests and skills.
  • Study the project's codebase and contribution guidelines.
  • Identify a bug or feature to work on.
  • Submit a pull request with your changes.
Write a Blog Post on Securing MQTT
Solidify your understanding of MQTT security by writing a blog post that explains the different security mechanisms and best practices.
Show steps
  • Research different MQTT security mechanisms, such as TLS and authentication.
  • Write a clear and concise blog post that explains these mechanisms.
  • Provide practical examples of how to implement these mechanisms in your Pico W projects.

Career center

Learners who complete IoT with Raspberry PI Pico W (C++) will develop knowledge and skills that may be useful to these careers:
Embedded Systems Engineer
An Embedded Systems Engineer designs, develops, and tests software for devices that are not traditional computers, like the Raspberry Pi Pico W. This course is a perfect fit, as it dives directly into coding embedded systems for IoT using C++, a crucial programming language. The course specifically covers building an IoT stack, including establishing WiFi connectivity, creating TCP/IP socket transport for MQTT protocol, publishing messages, subscribing to topics, and securing communication over TLS sockets. This experience is directly transferable to the real-world development of embedded IoT devices. Someone looking for a career as an Embedded Systems engineer should take this course to build the necessary skills.
IoT Developer
An IoT Developer is responsible for designing, implementing, and maintaining software and hardware for Internet of Things devices. This course provides a hands-on approach to building an IoT application using C++ on the Raspberry Pi Pico W, covering essential skills such as establishing WiFi connectivity, using MQTT protocol, publishing messages, subscribing to topics, and securing communication. The course's emphasis on building a complete IoT framework using FreeRTOS and coreMQTT-Agent libraries makes it invaluable for anyone aiming to become an IoT developer. This course will build practical skills in a real world setting utilizing real world hardware and network protocols. This is why anyone striving to be an IoT developer needs to seriously consider this course.
Firmware Engineer
A Firmware Engineer works on the low-level software that controls hardware, often for embedded devices. This course directly addresses the core skills needed for this role. It teaches you to develop firmware using C++ for the Raspberry Pi Pico W, focusing on IoT functionality like establishing WiFi, building a TCP/IP socket transport for MQTT, as well as publishing and subscribing to messages. Additionally, it covers securing MQTT over TLS sockets. The hands on building and testing of these systems in this course are directly applicable in the field. For a budding Firmware Engineer, this is a highly valuable course.
Robotics Software Engineer
A Robotics Software Engineer develops software to control and coordinate the actions of robots. This course may be useful because robots often utilize embedded systems and IoT technologies for communication and control. The course covers the use of C++ with FreeRTOS to create a functioning IoT device, including WiFi connectivity, MQTT, and secure communication, skills that are valuable in this field. This course may help build a foundation for those looking to enter the robotics field, especially in the area of connected robotics. One who is interested in robotics software engineering would be well served to take a deeper look at this course.
Automation Engineer
An Automation Engineer designs, programs, and implements automated systems that often involve sensors and controllers, similar to IoT devices. This course may be useful for an Automation Engineer who needs to understand the software and communication protocols used in the industrial automation field. The course provides hands-on experience with C++ on the Raspberry Pi Pico W to establish WiFi, publish and subscribe to MQTT messages and secure communications. While not directly targeting industrial automation, the core concepts taught here are highly relevant to the field. This course may give a student an edge in their understanding of IoT technologies in process automation.
Hardware Engineer
A Hardware Engineer designs and develops physical devices, often interacting with embedded systems. While this role focuses primarily on hardware, understanding the software and networking aspects of IoT devices, as in this course, is essential for effective collaboration and system design. This course covers the fundamentals of IoT device software, including WiFi connectivity, MQTT protocol, and secure communication. This course will likely prove helpful as an introduction to software systems and concepts. Someone aiming to be a Hardware Engineer would do well to consider taking this course.
Network Engineer
A Network Engineer is responsible for the design, implementation, and management of computer networks. While not directly focused on the networking aspects of an IoT system, this course provides knowledge of network protocols such as TCP/IP, MQTT and TLS/SSL security, all of which are used to build the IoT network stack. This course might be useful to a network engineer in understanding how protocols are applied to embedded systems. This course may be of use to a network engineer looking for a hands-on way to understand the use of these protocols on IoT devices.
Systems Analyst
A Systems Analyst designs and implements computer systems, and often deals with the interoperation of hardware and software. For one who deals with networks, embedded systems, and the Internet of Things, this course is a great way to explore and understand the underlying technologies. This course provides a practical understanding of how IoT devices are built and how they operate on the network. While a Systems Analyst doesn't typically program embedded devices, understanding their architecture and network communications helps them better design and assess these systems. This course will likely prove useful as an introduction to embedded software systems for a Systems Analyst.
Technical Consultant
A Technical Consultant advises clients on complex systems and technologies. This course can be helpful if the consultant specializes in areas that intersect with the Internet of Things. This course teaches the fundamentals of building IoT systems, including C++ coding for the Raspberry Pi Pico W, the implementation of network protocols such as MQTT and TCP/IP, and security considerations using TLS. Gaining this practical knowledge will enable a Technical Consultant to better understand, assess, and advise clients on IoT projects. This course may prove helpful to build the needed technical knowledge to work in this space.
Research Scientist
A Research Scientist designs and conducts research in various fields. If their work involves the Internet of Things or embedded systems, this course may be useful for building their understanding. This course gives a hands-on approach to building an IoT device using C++ on the Raspberry Pi Pico W, as well as covers data communications using MQTT, TLS, and TCP/IP. They may find the practical programming approaches used in this course very useful in planning experiments. This is especially true who may be building their own sensor based research equipment. This course may be helpful to those pursuing research careers.
Data Scientist
A Data Scientist analyzes large sets of data to develop insights. While this role primarily focuses on data analysis, understanding how the data is collected and communicated by devices, as with IoT devices, can be useful. This course provides basic knowledge on the operation of an IoT device, how it communicates over WiFi and MQTT, and how data is published and subscribed to. This gives data scientists a more comprehensive view of the technological context in which data is generated and collected. This course may be helpful as a foundational step into understanding IoT data systems.
Computer Science Professor
A Computer Science Professor teaches and conducts research in computer science. If you research or teach in areas like embedded systems or the Internet of Things, this course may be a very practical way to explore the latest technologies at the device level. This course provides hands-on experience in building an IoT system with C++ on a Raspberry Pi Pico W, complete with networking protocols and security. This practical experience, which is typically not taught in academia, gives more insight into the current tech and may be valuable in both the classroom and in a research lab. This course may prove useful for one looking to instruct on the use of such technologies.
Quality Assurance Engineer
A Quality Assurance Engineer tests the integrity and function of hardware and software. This course may provide helpful background for engineers who will test IoT devices and associated systems. In this course you will examine the operation of an IoT device, including network connectivity, message passing, and security. In doing so this will assist Quality Assurance Engineers in understanding complex systems. This course may prove useful for one who wants to test the operational integrity of IoT devices.
Technical Writer
A Technical Writer creates documentation for complex technical products and systems. This course provides real-world examples of system development, the implementation of networking protocols, and the development of software. This course may be useful as background in the development process, giving contextual understanding of how the software and hardware work together, and why particular design choices were made. Technical writers who need to document the development process will find this course useful. Taking this course may be helpful in assisting with documentation.
Applications Engineer
An Applications Engineer applies their technical skills to design and support products, frequently in the form of embedded systems. This course provides practical, hands-on experience in building an IoT system using C++ on the Raspberry Pi Pico W. It covers essential skills like establishing WiFi connectivity, MQTT protocol, and security. This course may be helpful as an introduction into the systems and protocols often used in application development for an Applications Engineer. Someone working as an Applications Engineer would do well to take a deeper look at this course.

Reading list

We've selected one books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in IoT with Raspberry PI Pico W (C++).
Provides a comprehensive guide to building IoT projects using the ESP32, which shares similarities with the Pico W in terms of microcontroller architecture and IoT capabilities. It covers topics such as Wi-Fi connectivity, MQTT communication, and sensor integration. While the specific microcontroller differs, the underlying principles and techniques are highly transferable. This book is useful for gaining a broader understanding of IoT development and exploring alternative approaches.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser