Your HotSpot is a presence detector

note: USB connector used only to power the circuit

I never connect my devices to “free wifi” hotspots. I’ve seen what a (bad) hacker can do, using one laptop, a battery powered Raspberry PI board and a collection of software tools. He can spy (almost) any smartphone that is connected to the same “free wifi” hotspot.

For this reason, I always use my own LTE 4G connection and my smartphone is always enabled to share such internet connection with my other devices (one laptop, another smartphone and some other) using an access filter based on MAC address of every device. This is more secure than use “free wifi” hotspots and I suggest to everyone the same approach. However, this isn’t the subject of my post.

Having my own hotspot, with the SSID choosen by myself, I can use the smartphone for a lot of nice services. In this article I will describe one of them.

The presence blinker

I’m currently living in a B&B, ‘cause I’m far from home, due to a contract job. When I am in my room, I don’t make too much noise. I just read or write documents; the TV is turned off and also the music is off. So, it happens that other hosts of the B&B, when going out, lock the main door with the key! This makes me a bit claustrophobic! To avoid this unfair situation, I decided to build a flashing light that will be visible from the low side of my room’s door, just to warn the other hosts that I am in my room

I thought about a passive IR sensor, but such devices work only if there is a movement in the room, and I don’t move so often. Also microwave sensors based on Doppler effect work in the same way; they activate the output when there is a movement. Finally, I decided to use my smartphone as a presence detector… I built a small device based on the well known ESP-01 module. This device has an ATtiny2313 microcontroller and a blue led (high luminosity) that blinks when I am in the room (with my smartphone). When my smartphone goes out (with me) the led stops blinking…

The working principle is very simple. The microcontroller sends AT commands to the ESP-01 to get the list of active hotspots in the area. One of such hotspots is my smartphone, so the SSID string is taken and compared with the one programmed in the internal flash memory. If the two strings match, the led blinks; otherwise the led remains off. So simple…

Note that no connection is active between the module and the smartphone; there is only a periodic check of the visible hotspots. This timed check happens every six seconds and the led lights for 250 mS each time (if your SSID is found).

Note that the SSID of your smartphone must be programmed in the flash memory of the microcontroller (the default is “myHotspot_15car”) so I added an application for PC that modifies the original .hex file to change the default SSID to the one that you like. The max number of characters allowed for your SSID is 15. This limit comes from the low amount of ram memory available on the ATtiny2313 microcontroller (just 128 bytes). Remember that you can choose your SSID in the smartphone using the appropriate menu, so write down one that has max 15 characters and the job is done. Another limit imposed by low ram resources (lack of buffers for serial communication), is that you must program the ESP-01 module to use a 9600 BPS communication speed. There is an AT version created with such default speed on this website:

http://wiki.aprbrother.com/wiki/Firmware_For_ESP8266

go there and look for ai-thinker-0.9.5.2-9600.bin. You can also modify (in a permanent way) the current communication speed of your ESP-01 module using AT commands. There are two, that works depending upon the version of firmware installed. Try both of them; the first that gives answer “OK” is the right one 🙂

For additional information and tools, take a look at my previous articles here:
http://ficara.altervista.org/?p=3041
http://ficara.altervista.org/?p=3158

You could also look at another my article, that was the “starting point” for this project. There you can find a downloadable executable and the relative source program in FreeBasic. It can be useful to better understand how it works. The link is:
http://ficara.altervista.org/?p=3711

Someone can say: “Hey, I can program the same SSID on my smartphone and fool your device so it thinks that you’re in the room, while you aren’t” ! Then I can answer: “so, I will add to my firmware a check of the WPA2 password of my hotspot, that’s invisible to you” ! Such password check option opens the road to many applications where your smartphone will be the key to unlock your car, your door, to turn on lights at home and every thing you want, simply having it near to you. No buttons to click, no Apps to run, just the “native” HotSpot feature active. It’s easy !

In the downloadable file you can find the .hex file that must be programmed in the microcontroller and the .exe that allows you to insert your SSID in the flash memory, prior to program the micro ! The firmware is very small (less than 1 Kb) and has been written in pure C without any special library.

The schematic of the device is simple. Here below there is a picture of it. You can also download it in PDF format for a better view (click this link).

Disclaimer of Liability.
The program or software described, freely downloadable from the site, has to be considered a free “demo” and therefore the author Emilio P.G. Ficara will not provide any support nor will be responsible for any problem, damage, or consequence that may occur during download or execution of the application.

By clicking this link to download the file, you implicitly declare that you have read and understood the non-assumption clause and to accept it.

Always check the MD5 checksum for the files you download! In this case, it must be FC211B2DCBF05C7874489AC32C7D9641 . If it is different, the file is corrupted or is not the original one, so do not unpack it and throw it away! If it is all right, you can unzip it (use the 7Z program with the password: eficara).

You can also run the executable on a USB memory stick as it does not need installation, being a pure executable.

Have fun !!!