MicroPython Program: Is the Toilet Occupied?
by Lan_Makerfabs in Circuits > Microcontrollers
2811 Views, 13 Favorites, 0 Comments
MicroPython Program: Is the Toilet Occupied?
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.
Supplies
hardware:
- MakePython ESP8266
- Infrared sensor
- Breadboard
- 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;
software:
uPyCraft V1.1
Click this link to download uPyCraft IDE for Windows: https://randomnerdtutorials.com/uPyCraftWindows
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 a 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/...
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...
Downloads
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).
Downloads
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.
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.
Testing
Click the "detect" button, you can check whether the toilet is occupied. When the toilet is occupied, the page will show that it is occupied, otherwise, it will show that there is no one, so you can easily go to the toilet without waiting outside.
Idea
After the experiment, I had some ideas, in some shopping malls, there are toilets on every floor, but there are often long lines for women's toilets for women's clothes, while men's toilets are empty. Make use of Makepython with Lora connection to detect the mobile phone traffic at the door of each bathroom, judge the number of people, and conduct diversion as expected; I will try it later, if you're interested, follow or join me.