ESP32: Who's at Home?
by Markus Opitz in Circuits > Microcontrollers
1409 Views, 21 Favorites, 0 Comments
ESP32: Who's at Home?
Who is at home right now? Are the kids back from school yet? Is dad in the house or in the garden? Is the car in the garage?
An ESP32 and an LED strip show you who is here at the moment.
You do not need any access data for your wifi, only the MAC addresses of the displayed users. You can either look them up on your mobile device or display them in your wifi router menu.
Basic knowledge for Arduino IDE is required.
Supplies
ESP32 or ESP8266
Neopixel LED strip (5-12 pixels)
5V power supply
Arduino IDE
wires, soldering iron, wooden/plastic case
MAC Addresses
The MAC address is the hardware address of each individual network adapter, which serves as a unique identifier of the device in a computer network. It is also referred to as physical address or device address.
Any person with a mobile phone can be recognized as a user, no matter if they are logged into wifi or not. Only the MAC address is required.
Sometimes the MAC address is written on the device. On the smartphone, you can usually find it out in Settings --> Device information.
With a microcontroller like ESP8266 or ESP32 you can find out the specific MAC address with the small script from randomnerdtutorials.com. Just upload it (to this ESP32 or another one), read the address on the serial monitor and enter it into the MAC list.
Also in the menu of your Wifi router you can see and note all the addresses registered in your network.
Downloads
MAC Scanner Software
In the sketch "WhosAtHome.ino", enter all users to be displayed after "String macList2[10][2] = {"
Here, this can be up to 10 users or devices, counting down from 10 to 1.
String macList2[10][3] = { //list of up to 10 users name, MAC, rank/pixel, color
{"Harry","X0:00:0X:00:XX:X0", "10"},
{"Sally","X0:00:0X:00:XX:X0","9"},
{"Laurel","X0:00:0X:00:XX:X0","8"},
{"Hardy","X0:00:0X:00:XX:X0","7"},
{"Batmobile","X0:00:0X:00:XX:X0","6"}
That's all.
You do not need any access data for your wifi, only the MAC addresses of the displayed users.
You can get the required libraries at Include Library --> Manage Library in the Arduino IDE.
Set the correct microcontroler at Tools --> Board and load the program on the chip
Downloads
ESP32 Hardware
Soldering is only necessary if you still need to attach pins - as with this ESP32 here. Only three pins for 5V, Gnd and Data are necessary.
LEDs
As indicators we use a programmable LED strip with three connections: 5V, Gnd, Data. Mostly connecting wires are already soldered to the contacts. If you have a cut small piece of LED strip left over from another project, you have to solder contacts carefully and fix them with a piece of heat shrink tubing.
You connect the contacts as follows to your ESP:
LED --> ESP
5V --> 5V
Gnd --> GnD
D in --> 12 (if you have written #define PIN_NEO_PIXEL 12 . You could also define another pin.)
Case
Your creativity is needed here: there are many possible materials for the housing. Plastic, wood, cardboard, metal (but it shields the radio waves).
I decided on wood and plastic with plexiglass. The LEDs fit on the wooden housing and illuminate the plexiglass strips on the sides. These can either be painted with a waterproof foil pen or engraved with a hard needle or engraving machine.
Bonus: Is the Car There?
To assign a MAC address to your car, you need another ESP8266 or ESP32 and a short adapter cable.
You don't have to program anything here, just plug the device into a USB socket/5V cigarette lighter of the car - done. Now you can read out the MAC address via your WiFi router and enter it in "WhosAtHome.ino".
The more family members are at home, the brighter the lamp gets.