Posts

Showing posts from January, 2023

ESP32 Posting Requests to Local Webserver

Image
Code used in this demonstration: Python Server Code: # Tinker Foundry Example Python Code # Python web server to work with ESP32 POST request # This runs on your local computer, connected on the same WiFi network as your ESP32 controller from http.server import BaseHTTPRequestHandler, HTTPServer hostName = "192.168.xx.xxx" # use ipconfig in console (command prompt) to get the "IPv4 Address" of this machine serverPort = 8080 # BaseHTTPRequestHandler class is used to handle the HTTP requests that arrive at the server class MyServer ( BaseHTTPRequestHandler ):     def do_POST ( self ): # handle POST request from ESP32 (or anything else, really)         content_length = int ( self .headers[ 'Content-Length' ]) # Gets size of data         post_data = self .rfile.read1(content_length) # Gets data         print ( "Post Data: " )         print (post_data.decode( 'utf-8' )) # This is the message from the POST request         self .send_resp

Up Close with a US $20 Bill

Image

Accurate Timekeeping on ESP32 using an NTP Server

Image
Below is the code used in the video to have ESP32 request time from an NTP server and update the internal RTC clock. // The Tinker Foundry ---  https://youtu.be/c6r9kECS6RQ // ESP32 Code for testing RTC - real-time clock updated from an NTP (network time protocol) server over the Internet // Use NTP to get Coordinated Universal Time (UTC) and adjust to local time/date // ESP32 will connect to an NTP server and send a request packet // In response, the NTP server will send a time stamp packet #include <WiFi.h> // The usual for ESP32... #include "time.h" // ESP32 native time library to handle NTP server connectivity and synchronization   const char * ssid     = "********" ;   // input your wifi name const char * password = "********" ;   // input your wifi passwords   // set up the NTP server name const char * NTPServer = "time.google.com" ; // for our example, let's use Google's public NTP - see developers.google.time for m

Up Close with a Canadian $100 Note

Image

Connecting ESP32 to the Outside World with IFTTT

Image
Accompanying code for Arduino IDE, as shown in the video, below. // ESP32 Code for testing IFTTT // Sends a request to STATUSUPDATE (or whatever you define) applet which will trigger an e-mail being sent #include <WiFi.h> #include <HTTPClient.h>   const char * ssid     = "*****" ;   //input your wifi name const char * password = "*****" ;   //input your wifi passwords   // set up server name with trigger the event defined in the IFTTT applet const char * server_name = "https://maker.ifttt.com/trigger/EVENT_NAME_HERE/with/key/KEYHERE" ;   void setup () {   Serial . begin ( 115200 ) ;   Serial . setDebugOutput ( true ) ;   Serial . println () ;     WiFi . begin ( ssid, password ) ;     while ( WiFi . status () != WL_CONNECTED ) {     delay ( 500 ) ;     Serial . print ( "." ) ;   }   Serial . println ( "" ) ;   Serial . println ( "WiFi connected" ) ;     Serial . print ( "Msg: Ready! Use 'http:/

Up Close with a US $100 Bill...

Image
Taking an up-close look at a US $100 bill. Focusing on some interesting security features, including magnified views.