ESP32 Localhost Two-Way Communication - Tutorial for Absolute Beginners Step by Step

Ahmad Logs July 11, 2023
Video Thumbnail
Ahmad Logs Logo

Ahmad Logs

View Channel

About

Purpose of Ahmad Logs channel is to share videos on Arduino Programming, Micro-Python Programming and Micro controller Programming and Projects Other Contents on Ahmad Logs channel: ESP32, ESP8266 NodeMCU, Raspberry Pi Pico, SMT32, Arduino and much more. -------------------------------------------------------------------------------------------------------------------- Where else you can find me: See my social media links below. Clickable links are available at channel art. -------------------------------------------------------------------------------------------------------------------- GitHub: https://github.com/ahmadlogs

Video Description

In this video, we explore the exciting world of ESP32 and localhost two-way communication. Starting with an introduction to websockets, we dive into the working principles behind websockets and the PHP Ratchet library. We guide you through the setup process, from installing Composer to creating the project folder and installing the necessary Ratchet library. Next, we demonstrate how to create a websocket server and define its address, followed by starting the server and testing it using a websocket client extension. We also write additional code for the server and conduct tests from a mobile phone to ensure seamless communication. With the foundation in place, we switch gears and build a custom websocket client using JavaScript. Additionally, we design a home page for our project, complete with a toggle button and temperature data handling. You'll learn how to display button states and temperature information on the home page. The video then delves into creating a websocket client on the ESP32, showcasing how to test its functionality and send fake data from the ESP32 to localhost. We demonstrate sending real-time DHT11 sensor data to the localhost server and explore controlling an ESP32 LED from the localhost server. Finally, we demonstrate how to control the ESP32 LED using a push button. -------------------------------------------------------------------------------------------------------------------- Useful Video Links -------------------------------------------------------------------------------------------------------------------- ESP32 Send Temperature and Humidity Data to localhost XAMPP https://youtu.be/VEN5kgjEuh8 -------------------------------------------------------------------------------------------------------------------- Download Code -------------------------------------------------------------------------------------------------------------------- https://github.com/ahmadlogs/esp-localhost-websocket/tree/master For Paid Projects Hire Me On Upwork: https://www.upwork.com/freelancers/~017720a686aa38f530 -------------------------------------------------------------------------------------------------------------------- Disclaimer -------------------------------------------------------------------------------------------------------------------- Disclaimer: All videos are for educational purposes and use them wisely. Any video may have a slight mistake, please take decisions based on your research. This video is not forcing anything on you. #ESP32 #Localhost #esp32project 00:00 - Introduction 00:17 - Previous Knowledge 00:37 - Contents Overview 01:51 - WebSocket Introduction 02:40 - How WebSocket Works 03:17 - PHP Ratchet Library 03:53 - Installing Composer 05:13 - Setting up the Project Folder 06:52 - Installing Ratchet Library 07:45 - Creating WebSocket Server 11:12 - Defining WebSocket Address 13:16 - Starting WebSocket Server 13:43 - Installing WebSocket Client Extension 14:18 - Testing WebSocket Server using Client 15:32 - Writing Additional Code for WebSocket Server 17:07 - Testing WebSocket Server From Phone 17:55 - Updating WebSocket Server IP Address 18:27 - Final WebSocket Test 19:08 - Implementing Message Sending on Server 21:58 - Building Custom WebSocket Client Using JavaScript 25:11 - Creating Home Page for the Project 26:52 - Implementing Toggle Button on Home Page 31:35 - Handling Temperature Data on Home Page 34:04 - Displaying Button and Temperature Info on Home Page 35:18 - Creating WebSocket Client on ESP32 40:13 - Testing ESP32 WebSocket Client 40:57 - Sending Fake Data from ESP32 to Localhost 42:20 - Sending DHT11 Data to Localhost 44:40 - Controlling ESP32 LED from Localhost 46:28 - Controlling ESP32 LED Using Push Button 47:25 - Final Demo 47:57 - End Screen

You May Also Like

Essential Slime Making Kits

AI-recommended products based on this video

Loading...
ESR for iPhone 16 Case, Military-Grade Protection, Shockproof Air Guard Corners, Yellowing-Resistant Acrylic Back, Phone Case for iPhone 16, Air Armor Series, New Clear Blue

ESR for iPhone 16 Case, Military-Grade Protection, Shockproof Air Guard Corners, Yellowing-Resistant Acrylic Back, Phone Case for iPhone 16, Air Armor Series, New Clear Blue

(657)
$12.99
FREE delivery Sat, Jun 14 on your first order
Loading...
Yarxiawin Phone Case for Samsung S25 Case with Ring Stand Magnetic Compatible with Magsafe Wireless Charger, Pink Bumper Cover Samsung Galaxy S25 Case Clear Shockproof (Blue)

Yarxiawin Phone Case for Samsung S25 Case with Ring Stand Magnetic Compatible with Magsafe Wireless Charger, Pink Bumper Cover Samsung Galaxy S25 Case Clear Shockproof (Blue)

(0)
$20.23
FREE delivery Sat, Jun 14 on your first order
Loading...
GuaGua for Galaxy S25 Case Samsung S25 Case Glow in The Dark Noctilucent Luminous Cover Space Nebula Slim Thin Shockproof Protective Phone Cases for Samsung S25, Purple/Blue

GuaGua for Galaxy S25 Case Samsung S25 Case Glow in The Dark Noctilucent Luminous Cover Space Nebula Slim Thin Shockproof Protective Phone Cases for Samsung S25, Purple/Blue

(18)
$13.86
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
Ksipze led Lights Strip for Bedroom 100FT,Smart Music Sync RGB Color Changing with App and Remote Control, Power Supply Led Strip Lights Lumiere LED for Room Home Party Decoration
Best Seller

Ksipze led Lights Strip for Bedroom 100FT,Smart Music Sync RGB Color Changing with App and Remote Control, Power Supply Led Strip Lights Lumiere LED for Room Home Party Decoration

(4,149)
$17.99
FREE delivery Sun, Oct 19 on your first order
3K+ bought in past month
Loading...
9V Battery Powered Led Kayak Strip Lights, 2 Pcs 6.56 FT RGB Color Changing Paddleboard SUP Canoes Lights, IP68 Waterproof Marine Submersible Boat Light Strip with Remote, Marine Boat Interior Light.

9V Battery Powered Led Kayak Strip Lights, 2 Pcs 6.56 FT RGB Color Changing Paddleboard SUP Canoes Lights, IP68 Waterproof Marine Submersible Boat Light Strip with Remote, Marine Boat Interior Light.

(0)
$45.99
FREE delivery Mon, Jul 7
Loading...
Transferproof Color Changing Lipstick,Gold Crystal Ph Lipstick Color Changing,Long Lasting 24 Hours Moisturizing Glossy Shine Lip Gloss for Women

Transferproof Color Changing Lipstick,Gold Crystal Ph Lipstick Color Changing,Long Lasting 24 Hours Moisturizing Glossy Shine Lip Gloss for Women

(2)
$12.99
$2.99 delivery Jun 19 - Jul 3
Loading...
4-in-1 Color Changing Foundation with SPF 50 - Medium to Full Coverage | Long-Lasting & Waterproof Anti-Aging Makeup | Combines Sunscreen + Moisturizer + Concealer + Brightener (30ml)

4-in-1 Color Changing Foundation with SPF 50 - Medium to Full Coverage | Long-Lasting & Waterproof Anti-Aging Makeup | Combines Sunscreen + Moisturizer + Concealer + Brightener (30ml)

(2)
$16.99
$1.99 delivery Jun 19 - Jul 3
Loading...
Floral Beads Kit 50000pcs & 300pcs Giant Large Colorful Gel Jelly Balls, Non Toxic Beads for Vase Filler, Plant, Floating Candles, Wedding and Home Decoration

Floral Beads Kit 50000pcs & 300pcs Giant Large Colorful Gel Jelly Balls, Non Toxic Beads for Vase Filler, Plant, Floating Candles, Wedding and Home Decoration

(2)
$15.99
FREE delivery Sat, Nov 22 on your first order
Loading...
Gifts 5-12 Years Old Girls, Bracelet Making Kit, Unicorn Toys, Gifts for Teen Girls, Beads for Making Jewellery, Crafts for Kids 6-8, Arts and Crafts for Kids Age 4 5 6 7 8 9 10 11

Gifts 5-12 Years Old Girls, Bracelet Making Kit, Unicorn Toys, Gifts for Teen Girls, Beads for Making Jewellery, Crafts for Kids 6-8, Arts and Crafts for Kids Age 4 5 6 7 8 9 10 11

(455)
$19.98
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
Hbnlai 5300 Pcs Clay Beads Bracelet Making Kit, Flat Preppy Beads for Friendship Jewelry Making, Polymer Heishi with Charms Gifts for Teen Girls Crafts for Girls Ages 8-12
Best Seller

Hbnlai 5300 Pcs Clay Beads Bracelet Making Kit, Flat Preppy Beads for Friendship Jewelry Making, Polymer Heishi with Charms Gifts for Teen Girls Crafts for Girls Ages 8-12

(2,416)
$12.99
FREE delivery Sat, Jun 14 on your first order
2K+ bought in past month
Loading...
EnvoGif Mens Leather Bracelet Personalized Name Bracelet for Men Engraved 1-6 Names Leather Braid Bracelets with Stainless Beads for Dad Husband Grandpa

EnvoGif Mens Leather Bracelet Personalized Name Bracelet for Men Engraved 1-6 Names Leather Braid Bracelets with Stainless Beads for Dad Husband Grandpa

(7)
$23.99
$2.99 delivery Jun 20 - Jul 4