Our office is a large group office with limited bathroom space.”I” often find that I have no room to go to the bathroom, so I have to wait so long that I feel embarrassed.
The experiment used MakePython ESP8266 to set up a detection server that anyone could access via an IP address to check for toilet seats, avoiding awkward wait times.
Step 1: Supplies
- MakePython ESP8266
- Infrared sensor
- Bread board
- Jump line
- USB cable
- Scotch tape
MakePython ESP8266 is an ESP8266 board with an integrated SSD1306 OLED display, you can get it from this link: https://www.makerfabs.com/makepython-esp8266.html
Infrared sensor: When the module detects the front obstacle signal, the green indicator light on the circuit board lights up the level, while the OUT port continues to output low-level signals. The detection distance of the module is 2 ~ 30cm, and the detection Angle is 35°. The detection distance can be adjusted by the potentiometer. when the potentiometer is adjusted clockwise, the detection distance increases;Counterclockwise potentiometer, the detection distance is reduced;
Click this link to download uPyCraft IDE for Windows: https://randomnerdtutorials.com/uPyCraftWindows
Step 2: Wiring
- The VCC pin of the infrared module is connected to 3V3 of MakePython ESP8266, GND is connected to GND, and OUT is connected to IO14 of the board.
- Connect MakePython ESP8266 to PC using USB cable, Open device manager (Simply search for “device” in the Windows search box). When expanded, the port section should display something like the above. Make a note of the port number, such as COM18 in my case. If no port appears, try downloading the USB drive: https://www.silabs.com/products/development-tools/…
Step 3: UPyCraft Direction for Use
Download the Get Started MicroPython ESP8266 file, which is detailed in the MicroPython Development Tools section of the file, which will help you download and install the uPyCraft IDE and use it. It also includes an introduction to MakePython ESP8266
Or you can get the file from this link: https://www.makerfabs.com/makepython-esp8266-start…
Step 4: The Code Download
Download the main.py file and open it, you need to modify the following points:
- SSID: need to change to your local network name
- PASSWORD: need to change to your local network password
- If the OUT Pin of the infrared module receives a change from the MakePython ESP8266, change the number in the Pin() to the Pin you used to receive it.
When you’re done, to click Save and DownAndRun. “download ok” will be displayed when the download is successful, you can see an IP address (mine: 192.168.1.116)
Step 5: Installation
Place the infrared module next to the door for easy detection of people and secure it with sellotape.When someone is using the toilet, the module sends the test results to the server via WiFi, so we can access the server via an IP address to check if the toilet is occupied, instead of waiting by the toilet.
Step 6: Open a Browser
Open the browser on your PC, type in the IP address you just got (192.168.1.116), and click Enter to confirm.
Source: MicroPython Program: Is the Toilet Occupied?