Skip to content

Latest commit

 

History

History

NwIO-WiFi-HTTP-xIO

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

NwIO-WiFi-HTTP-IxO

CC BY-NC-SA 4.0

About The Project

This program allows to use an ESP32 to control 32 Inputs/Outputs over HTTP using WiFi Connection.

  • 16 inputs (Waveshare MCP23017 GPIO)
  • 16 outputs (Waveshare MCP23017 GPIO)

Features

  • send the state of an input to an HTTP server
  • set the state of an output by HTTP calls

Overview

Getting Started

Hardware

  • ESP32 NodeMCU
  • 2 x Waveshare MCP23017 IO Expansion Board (connected on ESP32 using I2C)

About Hardware

You must weld A0 to change address of the board used for inputs.

Software

This program is edited using PlatformIO.

If you use Arduino IDE

  • Import code in Arduino IDE
  • Enable the Path variable support for ESPAsyncWebServer

The procedure is detailed in Using Arduino IDE.

Configuration

Before uploading program to your ESP32, you must configure settings (IP Address, ...).

Configuration

Usage

Send input state to HTTP Server

Each change of state triggers an HTTP request to following URL (depending value of deviceId)

When deviceId is HTTP request is sent to
Empty String ("") http://{server}:{serverPort}/input/{id}/{state}
Non-empty String http://{server}:{serverPort}/input/{deviceId}/{id}/{state}
Parameter Description Values
deviceId Device identifier Value of deviceId in Configuration.hpp
id Input id See io-mappings
state Input state 0 or 1

Examples

Example A

Given the following configuration :

IPAddress server(192, 168, 0, 1);
int serverPort = 1234;
...
String deviceId = "";
When HTTP request is sent on
Input 0 changes to 0 http://192.168.0.1:1234/input/0/0
Input 0 changes to 1 http://192.168.0.1:1234/input/0/1
Example B

Given the following configuration :

IPAddress server(192, 168, 0, 1);
int serverPort = 1234;
...
String deviceId = "deviceA";
When HTTP request is sent on
Input 0 changes to 0 http://192.168.0.1:1234/input/deviceA/0/0
Input 0 changes to 1 http://192.168.0.1:1234/input/deviceA/0/1

Set output state with HTTP calls

To set output state, call following URL http://{ip}/output/{id}/{state}/{duration}

Parameter Description Values
id Output id See io-mappings
state Output state off or on
duration Duration (ms) Only available for "on" 1 to 65535

Examples

Given the following configuration :

IPAddress ip(192, 168, 0, 11);
Usage URL to call
Enable output 0 http://192.168.0.11/output/0/on
Disable output 0 http://192.168.0.11/output/0/off
Enable output 0 during 2000 ms http://192.168.0.11/output/0/on/2000

Set all outputs state with HTTP calls

To set all outputs state, call following URL http://{ip}/outputs/{state}

Parameter Description Values
state Output state off or on

Examples

Given the following configuration :

IPAddress ip(192, 168, 0, 11);
Usage URL to call
Enable all outputs http://192.168.0.11/outputs/on
Disable all outputs http://192.168.0.11/outputs/off

License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

See LICENSE for more information.

CC BY-NC-SA 4.0

Built With

Authors

  • Amael BERTEAU

Contact