Giter Site home page Giter Site logo

bbsmith24 / esp32_credentials Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 36 KB

set up ESP32 WiFi credentials and time from NTP

License: GNU General Public License v3.0

C++ 86.62% CSS 7.39% HTML 5.99%
esp32 esp32-arduino iot-application ntp-timeserver wifi-credentials

esp32_credentials's Introduction

ESP32_Credentials

set up ESP32 WiFi credentials and time from NTP

First time running this creates an access point named ESP-WIFI-MANAGER. Connect to this, open a browser and enter the ip address created by the access point (192.168.4.1 by default). This will open a page allowing you to enter your WiFi credentials (SSID, password are required; IP and Gateway are optional) and timezone/DST offsets. Click 'Submit' and these values are stored in memory on the ESP32, and the ESP32 reboots to connect. After connecting, NTP server is queried for time, which is used to update the ESP32 RTC. loop() function writes current time to Serial every minute.

This can be used as the starting point for any project that requires a WiFi connection.

comment out '#define VERBOSE' to run in quiet mode using #define instead of const (HTML input parameters, SPIFFS filenames, NTP server name) saves some program space

Files: ESP32_Credentials.ino - program file data\wifimanager.html - html file for credentials/timezone page data\style.css - style sheet for presentation load the files in data using 'ESP32 Sketch Data Upload' in Arduino 1.8 'Tools' menu.

creates files in SPIFFS with data from wifimanager.html

ESP32_Credentials Functions: setup() - initialize LITTLEFS file system for load/store credentials and time info, initialize WiFi. Add any other initialization for new projects here

loop() - print current time to Serial every minute. Add whatever is needed for new projects here

LITTLEFS functions
	LITTLEFS_Init - initialize the LITTLEFS file system
	LITTLEFS_ReadFile - read a file, return contents as a String
	LITTLEFS_WriteFile - create a file using pathname and message
	LITTLEFS_ListDir - list files in LITTLEFS (for debugging)
	LITTLEFS_DeleteFile - delete a named file

WiFi_Init
	LoadCredentials - read credentials and timezone information from files in SPIFFS
	GetCredentials - create AP, load webpage to get credentials and timezone information, write to SPIFFS and reboot
	ClearCredentials - delete credentials files and reboot

Time functions
	UpdateLocalTime - first call, get time info from NTP server and save to RTC. Subsequent calls use RTC for time.
					  creates localTimeStr in mm/dd/yyyy hh:mm:ss
					  date/time in dayNum, monthNum, yearNum. hourNum, minNum, secNum integer values

esp32_credentials's People

Contributors

bbsmith24 avatar

Watchers

 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.