Coder Social home page Coder Social logo

u-masao / esp32-https-post-basicauth Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 17 KB

This code is an example of HTTPS communication with ESP32. Send the ESP32 chip temperature to the URL you specify.

License: Apache License 2.0

Makefile 3.42% CMake 2.00% C 84.18% Shell 10.40%
esp32 esp-idf https-client iot-device

esp32-https-post-basicauth's Introduction

HTTPS POST Request Example

Overview

  • ESP32(ESP-IDF) example
  • Connect HTTPS and POST JSON data
  • Using HTTP Basic Authentication
  • Validate certificate with x509 root certificate
  • Measure ESP32 chip temperature
  • Blink onboard LED
  • Use WiFi

Description

This code is an example of HTTPS communication with ESP32. Send the ESP32 chip temperature to the URL you specify.

This code was created by editing the ESP-IDF sample code. https_request

Demo

Running this sample, ESP32 will output the following serially. HTTP Response is different from the following because it depends on the API of connection destination.

I (309381) HTTPS: Connected to AP
I (310381) HTTPS: Connection established...
I (310391) HTTPS: request_body={"esp32":{"temperature":56.666667}}
I (310391) HTTPS: 241 bytes written
I (310391) HTTPS: Reading HTTP response...
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 25 May 2019 14:56:51 GMT
Content-Type: text/html; charset=UTF-8
Connection: close

{"esp32": {"temperature": 56.666667}}
I (310581) HTTPS: connection closed

Requirement

To build this code, you need an ESP-IDF development environment. See ESPRESSIF web site.Get Started

The author has been tested with Linux Mint 19.1.

Usage

Around available WiFi, turn on your ESP32 board.

Install

  1. Type make menuconfig command
  2. Enter "Connection Configuration" menu
  3. Configurate
  4. Select "Save" and "Exit"
  5. Download x509 root certificate with PEM format of api web site (Use a certificate one level higher)
  6. Save certificate to file ./main/server_root_cert.pem with PEM format (Base64 encoded text)
  7. Type make -j4 flash command and write to your ESP32 device
  8. Type make monitor command

Licence

Apache

Author

u-masao

esp32-https-post-basicauth's People

Contributors

u-masao avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.