logo
WIFI Joke
This is a joke WIFI access point with a IFTTT Trigger



    This is a little project i made as a Joke, after someone connects to the wifi, it sends them a webpage indicating
it's a joke and then sends you a message using the IFTTT Webhook.
It also sends a trigger to IFTTT webhook Triggers to notify you that the wifi was accessed.
If you don't want the IFFTTT webhook only used one ESP8266 ESP-01 and install the
Access Point Sketch


PARTS

2pcs ESP8266 ESP-01 Serial Wireless Wifi
4.5V-7V to 3.3V Power Supply Module Voltage Regulator
Female MICRO USB to DIP 5-Pin Pinboard 2.54mm micro USB type
Plastic Electronic Project Box Enclosure Instrument Case 100x60x25mm
10K Ohm 1/8 Watt 0.125W Metal Film Resistors








free-wifi-joke-pic.jpg


Below is a screen shot of the page after you connect to the wifi





     noip_updater_wiring_s

  
 Below are the Sketches that work, it may not be the best put you can change it to suit your own designs

Access Point Sketch
#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
int pin = 1;
int pin2 = 2;
int a = 1;
const byte DNS_PORT = 53;
IPAddress apIP(172, 217, 28, 1);
DNSServer dnsServer;
ESP8266WebServer webServer(80);
const char index_html[] PROGMEM = {"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n<head>\n  <meta content=\"text/html; charset=ISO-8859-1\"\n http-equiv=\"content-type\">\n  <title>FreeWIFI</title>\n</head>\n<body>\n<div style=\"text-align: center;\"><big><big><big><big><big><br>\n<br>\n<br>\n<br>\n<big style=\"color: rgb(204, 102, 204);\"><big>FREE WIFI<br>\nLOL</big></big></big></big></big></big></big><br>\n<span\n style=\"color: rgb(51, 51, 51); font-family: &quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: center; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: rgb(255, 255, 255); display: inline ! important; float: none;\">Sorry,\nNo free wifi for you.</span></div>\n</body>\n</html>\n"};
void setup() {
 pinMode(pin, OUTPUT);
 digitalWrite(pin, HIGH);
 pinMode(pin2, OUTPUT);
 digitalWrite(pin2, HIGH);
 //Serial.begin(115200);
 WiFi.mode(WIFI_AP);
 WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
 WiFi.softAP("Complimentary-wifi");
 dnsServer.start(DNS_PORT, "*", apIP);
 webServer.onNotFound([]() {
   webServer.send(200, "text/html", index_html);
 });
 webServer.begin();
}
void loop() {
 if (WiFi.softAPgetStationNum() == 0)            //loop here while no AP is connected to this station
 {
   delay(100);
   a = 1;
 } else {
   delay(1000);
   dnsServer.processNextRequest();
   webServer.handleClient();
   Iftttupdat();
   a = 2;
   digitalWrite(pin, LOW);
   delay(100);
   digitalWrite(pin, HIGH);
   delay(100);
 }
}
void Iftttupdat() {
 if (a == 1)
 {
   digitalWrite(pin2, LOW);
   delay(5000);
   digitalWrite(pin2, HIGH);
   delay(100);
   return;
 } else {
   return;
 }
}
// END


IFTTT Sketch

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
String new_ip;
int pin2 = 2;
const byte DNS_PORT = 53;
const char* ssid     = "SSID";         // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "PASSWORD";     // The password of the Wi-Fi network
void setup() {
 pinMode(pin2, INPUT);
 Serial.begin(115200);         // Start the Serial communication to send messages to the computer
 delay(10);
 Serial.println('\n');
 WiFi.hostname("FREEWIFIifttt");
 WiFi.begin(ssid, password); // Connect to the network
 WiFi.mode(WIFI_STA);
 Serial.print("Connecting to ");
 Serial.print(ssid); Serial.println(" ...");
 int i = 0;
 while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
   delay(1000);
   Serial.print(++i); Serial.print(' ');
 }
 Serial.println('\n');
 Serial.println("Connection established!");
 Serial.print("IP address:\t");
 Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer
}
void loop() {
 if (digitalRead(pin2) == LOW)
 {
   delay(1000);
   Iftttupdat();
   delay(1000);
 }
}
void Iftttupdat() {
 Serial.println("working");
 //digitalWrite(pin, LOW);
 delay(5000);
 new_ip = "FreeWifiTriggered";
 HTTPClient http;

http.begin("http://your-noip-user-name:your-noip-password@dynupdate.no-ip.com/nic/update?hostname=your-noip-host-name&myip=" + new_ip);
// add your noip user name, password, noip host name eg: http://username:password@dynupdate.no-ip.com/nic/update?hostname=mytest.testdomain.com&myip=1.2.3.4
  // i just modifyed the scketch i used for the No-ip Updater, thats why im using the string new_ip
 int httpCode = http.GET();
 Serial.println("sent");
 if (httpCode > 0) {
   Serial.println("updatedifttt");;
 }
 http.end();
 return;
}

//END
 





www.000webhost.com