This repository's code is part of S.O.S., a Shower/Stall Occupancy System.
- WeMos D1 Mini v2
- PIR sensor
- Reed sensor
- 5V micro USB plug
This code was made in and should be uploaded to the ESP8266 via the Arduino IDE.
- Install an MQTT broker (e.g. Mosquitto). Make sure the daemon is running before step 6.
- Install the Arduino IDE: Ensure you have this program set up on your computer to compile and upload the code in this repository.
- Install required libraries:
ESP8266WiFi
Ticker
AsyncMqttClient
SoftwareSerial
- Configure the project:
- Rename
example.config.h
toconfig.h
. - Open
config.h
and update it with your WiFi credentials, MQTT broker details, and topics.
- Rename
- Set up the circuit according to the diagrams above.
- Upload the code:
- Open
occupancy-sensing.ino
with the Arduino IDE. - Select your ESP8266 board under
Tools > Board
. - Compile and upload the code to your ESP8266.
- Open
- Monitor and test:
- Open the Serial Monitor in the Arduino IDE to view debug messages.
- Verify the device connects to WiFi and the MQTT broker.
- Test occupancy detection functionality.