Giter Site home page Giter Site logo

lily-open-source / esp8266-wireless-demo Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 21 KB

Explore ESP8266 wireless communication with sensors, buttons, and LEDs. Two modules, one as an Access Point, the other as a Client, showcase data exchange. Includes a flowchart for easy understanding. Ideal for IoT enthusiasts and hobbyists. Simplify your Arduino projects with this wireless demo!

License: MIT License

C++ 100.00%

esp8266-wireless-demo's Introduction

ESP8266 Wireless Demo

Table of Contents

Overview

This project showcases wireless communication between two ESP8266 modules, featuring data collection from sensors, buttons, and a switch. LEDs are used for visual indications of operation and standby states.

Components Used

  • ESP8266 Modules: Two ESP8266 modules serve as an Access Point (AP) and a Client.

  • Sensors: Four HC-SR04 ultrasonic sensors (A, B, C, D) measure distances.

  • Buttons: Three buttons (Button 1, Button 2, Button 3) offer manual input.

  • Switch: A switch toggles between using sensor data or button data.

  • LEDs: Two LEDs (red for operation, green for standby) provide visual indications.

  • Multiplexer: A 74HC4067 multiplexer simplifies pinout by enabling multiple sensors to share pins.

Wiring

Sender (1st ESP8266 - Access Point)/server

  • Connect ultrasonic sensors (A, B, C, D) to the 74HC4067 multiplexer.
  • Connect buttons (Button 1, Button 2, Button 3) to digital pins.
  • Connect the switch to a digital pin.
  • Connect a red LED to indicate operation.
  • Connect a green LED to indicate standby.

Receiver (2nd ESP8266 - Client)/client

  • Connect a red LED to indicate operation.
  • Connect a green LED to indicate standby.

How to Use

  1. Upload the provided code to both ESP8266 modules using the Arduino IDE.
  2. Power on both ESP8266 modules.
  3. The first ESP8266 (AP) will create a Wi-Fi network. Connect to this network from your device.
  4. Access the web interface hosted by the first ESP8266 through a browser by entering its IP address.
  5. The second ESP8266 (Client) will connect to the Wi-Fi network created by the first ESP8266.
  6. Observe the LEDs on both ESP8266 modules. The red LED indicates operation, and the green LED indicates standby.

Configuration

  • Adjust the Wi-Fi credentials in the code to match your network settings.
  • Modify pin assignments in the code based on your hardware connections.
  • Customize the distance conditions, button assignments, and switch behavior as needed.

Flowchart

graph LR

  subgraph cluster_A
    style cluster_A fill:#FF90BC;
    A1((Start))
    A2(Wi-Fi Setup)
    A3(Multiplexer Setup)
    A4(Button and Switch Setup)
    A5(LED Setup)
  end

  subgraph cluster_B
    style cluster_B fill:#FFC0D9;
    B1(Wait for Connection)
    B2(Wait for Command)
  end

  subgraph cluster_C
    style cluster_C fill:#FFC5C5;
    C1(Read Sensor Data)
    C2(Read Button State)
    C3(Read Switch State)
    C4(Determine Command)
  end

  subgraph cluster_D
    style cluster_D fill:#FFEBD8;
    D1(Turn on Red LED)
    D2(Send Command to Client)
    D3(Wait for Confirmation)
    D4(Turn off Red LED)
    D5(Turn on Green LED)
    D6(Go to Sleep)
  end

  subgraph cluster_E
    style cluster_E fill:#EF9595;
    E1(Listen for Connection)
    E2(Receive Command)
    E3(Process Command)
    E4(Send Confirmation)
    E5(Turn off Green LED)
    E6(Turn on Red LED)
    E7(Respond to Sender)
  end

  subgraph cluster_F
    style cluster_F fill:#EBE3D5;
    F1((End))
  end

  %% Sender (1st ESP8266 - Access Point) Flow
  A1 --> A2 --> A3 --> A4 --> A5 --> B1
  B1 --> |Connected| C1
  C1 --> |Sensor Data| C2
  C2 --> |Button Data| C3
  C3 --> |Switch Data| C4
  C4 --> |Command Determined| D1
  D1 --> D2 --> D3 --> D4 --> D5 --> D6 --> F1
  D3 --> |Confirmation Received| F1

  %% Receiver (2nd ESP8266 - Client) Flow
  B2 --> E1
  E1 --> |Command Received| E2
  E2 --> E3 --> E4 --> |Confirmation Sent| E5
  E5 --> |Data Processed| E6
  E6 --> |Response Sent| E7 --> F1

Additional Notes

  • Ensure a stable power supply for proper operation.
  • Adjust delay times in the code to meet your application's requirements.

Contributing

Feel free to contribute to this project by opening issues or pull requests.

License

This project is licensed under the MIT License.

esp8266-wireless-demo's People

Contributors

1999azzar 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.