schollz / find-lf

Track the location of every Wi-Fi device (:iphone:) in your house using Raspberry Pis and FIND
https://www.internalpositioning.com/plugins/#using-find-without-an-app
GNU Affero General Public License v3.0
994 stars 123 forks source link

ESP8266 as node #17

Open hofi-jus opened 6 years ago

hofi-jus commented 6 years ago

Hello, Is it possbilbe to use a ESP8266 as Wifi Sniffer and report the data to your Server? I will automate my house via Home Assistant and found your interresting project. But i have the problem that i can not install any apps on my buisness phone but half a day i am searching it. So find if would be the perfect solution. As i automate everything at home i use NODEMCU dev boards everywhere. In light switch door opener etc pp. This boards are more powerfull than aruinos and really cheap. I send and receive mqtt packages for the given tasks.

With your server and a sniffing code like this https://github.com/rw950431/ESP8266mini-sniff

Also asked rw950431 if it could be done https://github.com/rw950431/ESP8266mini-sniff/issues/1

I would have allready everthing installt and can locate my buisness phone. No expensiv RPi3 and Wifi Dongles are needed.

ESP8266 can be used as wifi repeater, not for video streaming, but txt pages are good. So running in monitormode with connection via Wifi to your server should also be possible.

Any opinion how to send the data to server? Do not know a lot about mqtt but maybe this can be used to send.

schollz commented 6 years ago

Hi @hofi-jus, I think it would work fine. You could use MQTT to send data, or just JSON. However, you do need to have code that tells the ES8266 to switch from monitoring to transferring. Usually wifi chips do not allow both at the same time. You could do something like monitor for 30 seconds, then upload results, and then keep doing that forever.

Let me know if you have more questions.

(By the way, MQTT is not so bad - here's a sketch I made for using it with Particle Photons: https://gist.github.com/schollz/d388b0c0ed1bb3b604eba6b7154a49d1#file-find_photon_mqtt-ino )

hofi-jus commented 6 years ago

thanks will have a look on it. rw950431 mentioned that devices do not transmit all the time. Have you long-term experience with find if.

He also would take one esp for monitor and a second via serial transmitting to connect to wifi

schollz commented 6 years ago

Having two should work fine, I didn't think about that.

Another issue to keep in mind is the antenna. The range of cellphones that they will detect depends on the antenna. You can usually buy one or build one (just make sure that you have the correct length for 2.4 Ghz.

hofi-jus commented 6 years ago

Will try with onboard antenna and if its to weak will try the modules where I can attaché external antenna

nonchip commented 6 years ago

what would be really great:

so you can deploy only a few raspis but quickly deploy "node throwies" as required. both to save money at home/etc (ESPs are cheaper than raspis and wifi is cheaper than cables) and to quickly deploy a sensor network e.g. for conferences/etc.

I imagine if for example one of those ESP nodes spends 10secs in monitor mode, then one in "just broadcast all collected information to every monitoring node around me" mode, one could build a network of like 10 nodes, they'd get in the best case 1sec or in worst case 10secs "accuracy" for "fresh" latency measurements, which would be enough for e.g. matching people to rooms and/or even kinda accurately (to a few meters) locating them in a conference building/etc

also you might even be able to then use those nodes on e.g. a driving robot and use it to scan the network to locate itself, then improve that measurement with camera/lidar/sonar information and know exactly where it is, just by being in wifi range of a few "node throwies" stuck to walls.

nonchip commented 6 years ago

I have 5 "AI-THINKER ESP8266MOD" modules (the ones with FCC approval) lying around here, and no idea what to do with those (didn't even install a toolchain for them yet) so if you'd like to tell me what to do to help you developing/testing such a feature, I'd be glad to help.

specs according to laser etching (google datasheet for more): +25dBm; 802.11b/g/n @2.4GHz

programmable using SPI with a nice bunch of GPIOs at the side. and they even come in tape reels because they're so cute&small :P

nonchip commented 6 years ago

idea to avoid having to drop monitor mode: we don't even really have to connect to anything. why not forge a raw packet containing our data addressed to some invalid MAC the other nodes will recognize as "stuff forwarded to me" when monitoring.

jacobalberty commented 5 years ago

I've made good progress on this. https://github.com/jacobalberty/esp8266-find-passive . I'm taking the drop out of monitor mode approach. It doesn't yet push the json but if my memory is correct on the format for find-lf I do have the json generated correctly, everything but the timestamps.