Book Image

ESP8266 Internet of Things Cookbook

By : Marco Schwartz
Book Image

ESP8266 Internet of Things Cookbook

By: Marco Schwartz

Overview of this book

The ESP8266 Wi-Fi Module is a self contained System on Chip (SOC) with an integrated TCP/IP protocol stack and can give any microcontroller access to your Wi-Fi network. It is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor. This book contains practical recipes that will help you master all ESP8266 functionalities. You will start by configuring and customizing the chip in line with your requirements. Then you will focus on core topics such as on-board processing, sensors, GPIOs, programming, networking, integration with external components, and so on. We will also teach you how to leverage Arduino using the ESP8266 and you'll learn about its libraries, file system, OTA updates, and so on. The book also provide recipes on web servers, testing, connecting with the cloud, and troubleshooting techniques. Programming aspects include MicroPython and how to leverage it to get started with the ESP8266. Towards the end, we will use these concepts and create an interesting project (IOT). By the end of the book, readers will be proficient enough to use the ESP8266 board efficiently.
Table of Contents (15 chapters)
ESP8266 Internet of Things Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Sending data to the cloud using MicroPython


This recipe is going to introduce us to the IoT using MicroPython. We will use MicroPython to send measurement data to dweet.io from the ESP8266. Through that, you will learn some IoT basics and how to implement them using MicroPython.

Getting ready

The hardware setup will be the same as the one you used in the previous recipe. The only difference is that we will be connecting and sending data to dweet.io. dweet.io is a cloud server that you can use to easily publish and subscribe to data. It does not require you to sign up or set it up. All you need to do is publish and you are good to go.

A simple HAPI web API is used to send data from your thing to the cloud. Sending data is accomplished by calling a URL such as https://dweet.io/dweet/for/my-thing-name?hello=world.

Replace my-thing-name in the URL with the name of your choice and then proceed to log data online. The query parameters you add to the URL will be added as key value pairs to the dweet...