WiGPSFi – ESP8266 + GPS module

WiGPSFi – ESP8266 + GPS module

If you love finding solutions that could widen horizons – that is something you will like!

I wanted to know what my next ESP projects could connect to – and I decided to look for some open WiFis …. 

That is the result after two days programming – and 45 min walking arround. Only for testing this technique – Don´t do this at home, please ? 

In this blogpost, you can only read about finding and printing out maps with WiFi-Accesspoints and not how to crack them! I did not connected to any of this WiFis and you should also refrain. The ESP is only listening passivly!

 

I took a ESP8266 12-E  that could scan wifi. Connected a Serial GPS to it, to get the location and store them on a Micro-SD-Card. – Thats nothing new – WARDRIVING / WARCHALKING is known since a couple of years for now. In Germany it is not legal, Google payed a 140.000 € punishment because they did it.

I want to show you only my solution – here it is – the WiGPSFi:

I´m using the Arduino IDE and that is the code I wrote:


/* WiGPSfi - ESP8266 + GPS + SD + LED
* Autor: Robert Stefanowicz - euerdesign.de 04/2016
* ESP8266 Scans for Wifi-Networks - get GPS Position - write to SD
*
* Red LED blinking - NO GPS FIX
* Red LED fast strobe - SD - Error
* Each green lightup 1 Wifi Network + GPS ok + SD ok
*
* Connect ESP8266 + SD + GPS + LED:
*
* between VCC and GND capacitator 0.1uF + 470uF
*
* GPS VCC = 5V Connect a cap 470uF between GPS VCC and GPS GND
* GPS GND = GND
* GPS RX = ESP TX (Serial Baud 9600)
* GPS TX = ESP RX (Serial Baud 9600)
* SD CS = ESP 4
* SD SCK = ESP 14
* SD MOSI = ESP 13
* SD MISO = ESP 12
* SD VCC = 5V Connect a cap 470uF between SD VCC and SD GND
* SD GND = GND
* LED GRÜN = ESP 5
* LED ROT = ESP 16
* LED GND = 1kOhm GND
* ESP 5V = 5V (Konverter in ESP Breadboard Adapter) Ansonsten ESP 3,3V !!!!
* ESP GND = GND
* ESP EN = ESP VCC (3,3V)
* ESP 15 = ESP GND
*
*/
#include "ESP8266WiFi.h"
#include <TinyGPS.h>
#include <SPI.h>
#include <SD.h>
//-----------GPS
TinyGPS gps;
File myFile;
static void smartdelay(unsigned long ms)
{
unsigned long start = millis();
do
{
while (Serial.available())
gps.encode(Serial.read());
} while (millis() - start < ms);
}
void setup()
{
//------------GPS SS
Serial.begin(9600); //GPS Softwareserial
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(10, OUTPUT);
pinMode(16, OUTPUT);
pinMode(5, OUTPUT);
if (!SD.begin(4)) {
return;
}
} //SETUP END
void loop()
{
float flat, flon;
unsigned long age, date, time, chars = 0;
unsigned short sentences = 0, failed = 0;
ESP.wdtDisable();
gps.f_get_position(&flat, &flon, &age);
delay(50);
if (age != TinyGPS::GPS_INVALID_AGE){ //CHECK OB GPS FIX
digitalWrite(16, LOW);
int n = WiFi.scanNetworks(false);
if (n == 0){
}
else
{
for (int i = 0; i < n; ++i)
{
myFile = SD.open("scan.txt", FILE_WRITE);
if (myFile) {
digitalWrite(5, HIGH);
delay(150);
digitalWrite(5, LOW);
delay(150);
myFile.print(WiFi.BSSIDstr(i));
myFile.print(";");
myFile.print(WiFi.SSID(i));
myFile.print(";");
myFile.print(WiFi.RSSI(i));
myFile.print(";");
myFile.print((WiFi.encryptionType(i) == ENC_TYPE_NONE)?"0":"1");
myFile.print(";");
myFile.print(flat,5);
myFile.print(";");
myFile.print(flon,5);
myFile.println(";");
delay(10);
myFile.close();
}
else {
//CANT WRITE TO SD
for (int i = 0; i < 5; ++i)
{
digitalWrite(16, HIGH);
delay(200);
digitalWrite(16, LOW);
delay(200);
}
}
}
}
} else { //CHECK IF GPS FIX
digitalWrite(16, HIGH);
delay(10);
}
digitalWrite(16, LOW);
smartdelay(500);
}

That was pretty simple huh ?

 

This is a little ESP to Breadboard PCB with an voltage regulator an the firmware flash button:

For More Details: WiGPSFi – ESP8266 + GPS module


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top