├── README.md └── OpenWiFiDetector.ino /README.md: -------------------------------------------------------------------------------- 1 | MASLOW: an Open WiFi Detector with ESP8266 2 | ======= 3 | 4 | by Andres Sabas 5 | The Inventor's House Hackerspace 6 | 19 sept 2015 7 | 8 | ###Material 9 | - NodeMCU V1.0 or ESP8266 v2 or HUZZAH Adafruit o ESP8266 version 12 or 07 10 | - Lipo Battery 3.7v 11 | - Lipoly NodeMCU Backpack The Inventor's House 12 | 13 | Based in Adafruit work https://learn.adafruit.com/wifi-hotspot-finder-adafruit-pro-trinket-cc3000g 14 | -------------------------------------------------------------------------------- /OpenWiFiDetector.ino: -------------------------------------------------------------------------------- 1 | /* 2 | *MASLOW: an Open WiFi Detector with ESP8266 3 | *based in Adafruit https://learn.adafruit.com/wifi-hotspot-finder-adafruit-pro-trinket-cc3000 4 | * by Andres Sabas 5 | * The Inventor's House Hackerspace 6 | * 19 sept 2015 7 | */ 8 | 9 | #include "ESP8266WiFi.h" 10 | 11 | // Time to sleep (in seconds): 12 | const int sleepTimeS = 30; 13 | 14 | void setup() { 15 | Serial.begin(115200); 16 | 17 | // Set WiFi to station mode and disconnect from an AP if it was previously connected 18 | WiFi.mode(WIFI_STA); 19 | WiFi.disconnect(); 20 | delay(100); 21 | pinMode(4, OUTPUT); 22 | Serial.println("Setup done"); 23 | 24 | } 25 | 26 | void loop() { 27 | uint8_t sec; 28 | 29 | analogWrite(4, 10); 30 | 31 | Serial.print(F("Scanning...")); 32 | int n = WiFi.scanNetworks(); // WiFi.scanNetworks will return the number of networks found 33 | Serial.println(F("scan done")); 34 | if (n == 0) 35 | Serial.println(F("no networks found")); 36 | else 37 | { 38 | Serial.print(n); Serial.print(F(" network")); 39 | if(n > 1) Serial.print('s'); 40 | Serial.println(F(" found:")); 41 | for (int i = 0; i < n; ++i) 42 | { 43 | int sec = WiFi.encryptionType(i); 44 | 45 | // Print SSID and RSSI for each network found 46 | Serial.print(i + 1); 47 | Serial.print(": "); 48 | Serial.print(WiFi.SSID(i)); 49 | Serial.print(" ("); 50 | Serial.print(WiFi.RSSI(i)); 51 | Serial.print(")"); 52 | Serial.println(sec); 53 | delay(10); 54 | 55 | if((sec == ENC_TYPE_NONE || sec == ENC_TYPE_WEP) && (WiFi.RSSI(i) > -95)) { // If open network and good signal... 56 | // Switch LED to conspicuous 'open networks' flash immediately 57 | analogWrite(4, 1023); // 1 sec 58 | delay(1000); 59 | // "Open hotspot" is as good as the indicator gets and the scan 60 | // can stop now, get into power-saving sleep mode ASAP. 61 | // If you're using the Serial console and want to see all 62 | // networks displayed, comment out this line: 63 | //Serial.println("Not security"); 64 | //Mode Sleep for ESP8266 Version 12 or model with pin16 avaible 65 | //Necesary jump RST and GPIO16 66 | 67 | sleep_now(); // Function Sleep 30 seconds 68 | } 69 | } 70 | } 71 | 72 | } 73 | 74 | //Mode Sleep for ESP8266 Version 12 or model with pin16 avaible 75 | 76 | void sleep_now(){ 77 | 78 | Serial.print(F("Sleeping...")); 79 | // deepSleep time is defined in microseconds. Multiply 80 | // seconds by 1e6 81 | ESP.deepSleep(sleepTimeS * 1000000); 82 | } 83 | 84 | --------------------------------------------------------------------------------