logo elektroda
logo elektroda
X
logo elektroda

Superior detector with ESP8266 and OLED SSD1306

szdom 6321 47
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • Supervisor detector with a green LED and an OLED display showing Słucham....
    I would like to present a recently created contraption.
    I gave it a working name Supervisor detector.
    The ESP8266 chip and the SSD1306 OLED display are used here.
    I`m in a hurry to explain the principle of operation.
    The WIFI network is widely used, we use it at home, at work, in a cafe.
    Very often, as I have noticed, people do not turn off WIFI on their phone, either because of laziness or ignorance.
    And when phones lose connection to the network, they become quite "talkative" and periodically start desperate attempts to find a known WIFI network to connect to.
    They do this by sending packets containing, among others: their MAC address and this feature was used in the presented device.
    We have a defined list of MAC addresses in the table that we want to monitor and when one appears within the range of our ESP,
    we have signaling in the form of lighting the LED for a few seconds and displaying the name assigned to a given MAC address on the display.
    The algorithm is quite primitive, it only signals 1 active device nearby at a time, but it works great for the intended purposes.
    The listening library is not my own, a Ricardo Oliveira project called Friend Detector was used here.
    https://github.com/RicardoOliveira/FriendDetector
    I made changes to adapt the code to my requirements.
    It is true that the application is intended to be part of a building automation project and serve other purposes, i.e. after detecting the MAC address we want, it is supposed to turn on the air conditioner in the heating mode using the IR diode before the user even enters the house.
    But at the moment I`m testing the system at work and it works great as a supervisor detector ;)
    While writing the post, the LED light came on and I was able to prepare for my supervisor`s visit ;-) ) (greet him by name without even seeing him yet).
    I noticed that the system can catch frames at a distance of about 80 m and in a quite radio-polluted industrial environment where a lot of machines work.
    The casing is not very beautiful, but it was made quickly to protect the device so that bystanders would not accidentally short circuit it.
    I don`t have a diagram because it is a manual connection of the OLED display and LED to the ESP.
    Below is a video of the device in operation.



    Source codes attached.

    Cool? Ranking DIY
    About Author
    szdom
    Level 12  
    Offline 
    szdom wrote 37 posts with rating 43. Live in city Suwałki. Been with us since 2004 year.
  • ADVERTISEMENT
  • #2 20946555
    gulson
    System Administrator
    Incredible! Let me tell you, there is a deposit for a device that could be normally sold, for analyzing the presence of people, detecting, and notifying.
    Of course, it would support a certain number of MAC addresses, which could be easily entered by the user.
    MAC, of course, is not an encrypted data and, as you can see, it is publicly available, so it cannot be used for any security purposes.
    But simple detection of the presence of people...
    What if I added bluetooth in parallel? To think about!
    Contact me via Parcel Locker and I will send you a small gift that will be useful for future projects. ;)
  • #3 20946670
    Kkuba79
    Level 12  
    A very interesting and clever device. From what I can see on my phone, the MAC address is generated randomly, which may make it difficult to identify the user.
  • #4 20946935
    analog_6
    Level 16  
    Some time ago, 15 years ago, my relative and his friend in the USA had a company that offered billboards and other marketing attention grabbers that scanned the environment for mobile devices with BT enabled. It was supposed to resemble the functionality known from the movie "Minority Report", i.e. active dedicated advertising. They did it for some time and even had some contracts with J&J, but it didn`t take off. I don`t know why they gave up. Maybe because the law has started to keep up with the news and generally does not allow such practices. Unless the person being tracked gives consent. It is not without reason that various companies offer various services and applications for free, and at the same time force you to sign agreements on profiling, tracking, etc. People who are aware of such consents do not give such consents and, at least in Europe, it is not legally allowed to collect and process information about such people.
  • ADVERTISEMENT
  • #5 20946939
    gulson
    System Administrator
    There could be many problems, including the worst - reservations regarding privacy and the need to obtain prior consent.
    Although no one cared 15 years ago, so maybe they failed on some technicality.
  • ADVERTISEMENT
  • #6 20946944
    khoam
    Level 42  
    Kkuba79 wrote:
    From what I can see on my phone, the MAC address is generated randomly, which may make it difficult to identify the user.

    If the "Randomized MAC" function is enabled, there may be a problem with "targeting". In mine it is turned on ;)
  • #7 20947126
    krzbor
    Level 27  
    szdom wrote:
    Very often, as I have noticed, people do not turn off WIFI on their phone, either because of laziness or ignorance.
    And when phones lose connection to the network, they become quite "talkative" and periodically start desperate attempts to find a known WIFI network to connect to.
    They do this by sending packets containing, among others: their MAC address and this feature was used in the presented device.

    It seemed to me that the device was scanning for networks. Only when it finds a network saved in itself with the right to establish a connection does it become "talkative". In other words, if a device is not registered on a given WiFi network, it should not communicate.
  • ADVERTISEMENT
  • #8 20947190
    Sam Sung
    Level 33  
    krzbor wrote:
    szdom wrote:
    Very often, as I have noticed, people do not turn off WIFI on their phone, either because of laziness or ignorance.
    And when phones lose connection to the network, they become quite "talkative" and periodically start desperate attempts to find a known WIFI network to connect to.
    They do this by sending packets containing, among others: their MAC address and this feature was used in the presented device.

    It seemed to me that the device was scanning for networks. Only when it finds a network saved in itself with the right to establish a connection does it become "talkative". In other words, if a device is not registered on a given WiFi network, it should not communicate.
    What you described is passive scanning. Smartphones perform active scanning by sending a frame cyclically probe request , in which - in addition to your own identifier - there is also a place for a list of SSIDs of the networks to which the smartphone has previously connected.
    https://www.rfwireless-world.com/Terminology/WLAN-probe-request-and-response-frame.html
    https://blog.spacehuhn.com/probe-request
    https://niebezpiecznik.pl/post/kamery-w-zabce...warz-klientow-nie-motyw-w-zabce-i-nie-motywe/
  • #9 20947204
    analog_6
    Level 16  
    Otherwise, it would not be possible to connect to a network that has broadcasting disabled.
  • #10 20947256
    pixel7
    Level 24  
    It is worth adding a buzzer to the system. Now you have to constantly watch the display or diode.
  • #11 20947299
    szdom
    Level 12  
    Quote:
    If the "Randomized MAC" function is enabled, there may be a problem with "tracking". In mine it is turned on ;)

    My observations show that random MAC is for different WiFi networks. If you connected to one network, e.g. at home, the phone will report the same "randomized" MAC address to a specific network. I don`t know if this is standard, but I noticed in my network that phones with randomization turned on always get the same IP address and are visible in the logs at the same MAC address.

    Quote:
    It is worth adding a buzzer to the system. Now you have to constantly watch the display or diode.

    This is an idea. Although at the moment, when it`s on the desk next to the monitor, there`s no way I wouldn`t notice it ;)
  • #12 20947345
    pixel7
    Level 24  
    szdom wrote:
    anyway, they always get the same IP address and are visible in the logs at the same MAC address.


    This is actually true, otherwise the pool of addresses reserved on the router would increase. And with poor coverage, when the phone would lose and find (new MAC) the network, another IP would be blocked. I wonder how routers react to this?
  • #13 20947469
    szdom
    Level 12  
    If the phone loses coverage, it starts sending probe request frames and when it finds itself in the network coverage again, it is renegotiated on the DHCP server and the same IP address is granted for a new period (because the MAC has not changed).
  • #14 20947496
    khoam
    Level 42  
    szdom wrote:
    I don`t know if this is standard, but I noticed in my network that phones with randomization turned on always get the same IP address and are visible in the logs at the same MAC address.

    If smartphones are not restarted, enabling randomization may not actually be effective. In my opinion, in the name of generally understood security, the smartphone should be restarted once a day. The MAC randomization option itself is usually turned on for a specific WiFi network; in the case of a "home" one, it doesn`t make much sense. Corporate networks usually do not use long DHCP lease time, so any problem with assigning an IP address for a new MAC address is minimal.

    There are apps available for Android that allow you to randomize your MAC address ad hoc for a specific period of time and force you to log in to the WiFi network again. A supervisor can use this before inspecting the office ;)
  • #15 20947614
    pixel7
    Level 24  
    khoam wrote:
    Corporate networks usually do not use long DHCP lease time,


    I can set any time, I know. But I meant 20 attempts/sec.

    khoam wrote:
    A supervisor can use this before inspecting the office


    Unless we know the local MACs, and every stranger is him.
  • #16 20947632
    szdom
    Level 12  
    khoam wrote:
    A supervisor can use this before inspecting the office

    I wouldn`t be that optimistic about the supervisor`s skills ;-) ))
    Depending on age, it`s sometimes good to know where to find the slider to turn WiFi on/off.
  • #17 20947921
    analog_6
    Level 16  
    Most supervisors at some level know quite precisely how much time employees actually work and how much time they spend chatting, browsing the Internet or doing private matters. They just tolerate it for various reasons.
    And so they pay according to the value of the work performed and the usefulness, regardless of how clever the employee thinks he is :)
  • #18 20947991
    krzbor
    Level 27  
    Sam Sung wrote:
    What you described is passive scanning. Smartphones perform active scanning by periodically sending a probe request frame, which - in addition to its own identifier - also contains a list of SSIDs of the networks to which the smartphone has previously connected.

    Thanks for the clarification. I had previously read that the default mode for WiFi is passive mode and I thought this was used on smartphones.
    While researching the topic, I came across the website Link , in which user "heddha" (second answer) explained it quite well.
  • #19 20948385
    TechEkspert
    Editor
    Do BT wristbands and watches have MAC randomization? BT listening can also provide a lot of information, e.g. BT headphones or even cars.
  • #20 20948514
    jarekgol
    Level 39  
    Beautiful block :)
    Some time ago I looked at the DHCP server logs to check whether the management had reached the plant.
    By the way, assuming you are on the same Wi-Fi as the president, it would probably be possible to write something similar on Android and have the notification immediately in your pocket.
  • #21 20948517
    krzbor
    Level 27  
    I came across an interesting website: Link , and in it a picture:
    Timeline diagram of MAC address randomization implementation by iOS and Android systems
    It shows that iOS8 and Android 8 already had random MACs in the probe request. In 2019 (Android 10), random MAC addresses were also enabled by default when connecting to the network. So the question arises - how does the "detector" work - the boss probably has a very old phone :)
  • #22 20948530
    jarekgol
    Level 39  
    And what about the fact that a given manufacturer has an allocated pool of Macs? And I wonder what is the chance in larger chains that the Macs will clash after the draw?
  • #23 20948673
    analog_6
    Level 16  
    Conflicts on the Internet are nothing extraordinary and there may be various reasons. It`s enough that Chinese shoddy switches and routers do not implement basic network protocols correctly (because anyone who checks it will notice it) and with a slightly developed infrastructure based on such "blocks", IP conflicts may occur, especially if the ports are connected in an unfortunate order.
    The safest option is to simply not use DHCP at all. At the same time, the level of security increases significantly and the network throughput increases at the same time.
  • #24 20948734
    jarekgol
    Level 39  
    analog_6 wrote:
    at the same time, network throughput increases
    and why so? that DHCP generates so much traffic? I assume that in home networks it has no noticeable significance?
  • #25 20948736
    khoam
    Level 42  
    krzbor wrote:
    So the question arises - how does the "detector" work - the boss probably has a very old phone

    Not necessarily. On my work smartphone, after the first start, MAC randomization was disabled by default. Produced in 2020.

    jarekgol wrote:
    Does DHCP generate so much traffic? I assume that in home networks it has no noticeable significance?

    The traffic generated by DHCP is small compared to other forms of network traffic and does not constitute a significant burden on the network. Unless someone sets up a bot that will constantly send DHCP requests :)
  • #26 20948816
    analog_6
    Level 16  
    Of course. Network protocols are written by smart people who know how to minimize the protocol load on the network.
    However, undoubtedly any unnecessary network mechanism always causes a load on the router and usually on the network itself. If there is a network, then also all receivers physically connected to it. Each single packet, even the shortest, means time on the links and power consumption of both the transmitter and the receivers (at least for data processing in the lowest layers). So why activate unnecessary protocols? The answer is obvious - for nothing. Don`t do this. DHCP is extremely useful, like any plug & play. But often it is not necessary. And when it is not necessary, it should not be used. The net is not a bottomless bag. Each has bandwidth and data processing limits. They should be saved whenever possible. Because it`s not that difficult to exhaust them considering today`s user expectations.

    PS As a side note, an average text email, a regular one, not burdened with any fashionable HTML junk, generates about 5g of CO2 into the atmosphere in the form of electricity consumed. It`s worth thinking about.
  • #27 20948833
    krzbor
    Level 27  
    khoam wrote:
    Not necessarily. On my work smartphone, after the first launch, MAC randomization was disabled by default. Produced in 2020

    Perhaps Android (GOOGLE) has its own and the manufacturer has its own.
  • #28 20948980
    szdom
    Level 12  
    krzbor wrote:
    So the question arises - how does the "detector" work - the boss probably has a very old phone :)

    The newest iPhone ;) Also, set your own standards and live your own life.

    jarekgol wrote:
    Beautiful block :)
    Some time ago I looked at the DHCP server logs to check whether the management had reached the plant.

    Thanks.
    I solved it a little differently - since our plant is a bit scattered, several buildings are some distance from each other, and we have WiFi MESH networks on Ubiquiti, I solved the issue with a script.
    Sometimes I need to meet a certain person in person, so in order not to "disturb the guitar" with a telephone conversation, I have prepared a script that asks the controller which antenna the user was physically connected to in the last few minutes. Based on this data, it generates an HTML page where I have a list of people with their physical location ;) Of course, you must remember that this information is not 100% up to date, because the user may have already moved. But in most cases, it allows you to track down the perpetrator quite precisely.

    jarekgol wrote:
    And what about the fact that a given manufacturer has an allocated pool of Macs? And I wonder what is the chance in larger chains that the Macs will clash after the draw?

    The manufacturer can be identified by the first 6 characters in the MAC address, the remaining 6 can be randomized, I think this is enough for quite a large network.
  • #29 20949061
    sq3evp
    Level 37  
    Interesting idea, can any ESP or other controller be used?
  • #30 20949167
    krzbor
    Level 27  
    I`m thinking about using this device for monitoring. In the case of a separated and fenced building, you can detect that someone is hanging around (of course, if they have a phone :) . I noticed that information about the signal strength is transmitted - so you can determine approximately how far someone is. I am thinking about working in two modes - collecting data and then sending it via classic WiFi. This requires constant changes to the ESP settings. Currently in listening mode we have:
    Code: Arduino
    Log in, to see the code

    Here I have a question for people who know ESP well - how to switch it to transmit mode (STA)? Will running the above code again switch it back to listening mode?

Topic summary

The discussion revolves around a device called the Supervisor detector, which utilizes the ESP8266 chip and an SSD1306 OLED display to monitor the presence of smartphones by detecting their MAC addresses. Users express interest in the device's functionality, noting that smartphones often do not turn off Wi-Fi, leading to active scanning for known networks. Concerns about privacy and MAC address randomization are raised, as modern smartphones may generate random MAC addresses, complicating identification. Suggestions for enhancements include adding Bluetooth capabilities and a buzzer for notifications. The conversation also touches on the implications of using such technology in marketing and the legal considerations surrounding user consent for tracking. Additionally, technical discussions about the operation of the device, signal strength measurement, and the potential for using ESP32 are included.
Summary generated by the language model.
ADVERTISEMENT