Firmware is designed to control up to 6 sensors:
- One motion
- One temperature
- Up to four reed switches (door/window type)
Each sensor may be enabled/disabled through MultiSensor\src\User.h
Each sensor sends its own MQTT status message - so you must have a Mosquitto Broker running
Temperature is actually "heat index" and is calculated by taking temperature and humidity into account
1.0 Initial version
1.1 Testing completed
1.2 Updated README
1.3 Added IP lookup
1.4 Fixed PIN mappings (motion was hooked up to D4/builtin LED)
1.5 Added over the air serial output with Telnet (RemoteDebug library)
-
Flash SPIFFs to upload the configuration files - MultiSensor/data/config.json. You may modify the contents prior to upload but not necessary
-
Flash firmware
-
Device will initially come up with its own Access Point called esp82XX-xxxxxxx. Connect to this and configure WiFi parameters. Once saved, device will reboot and connect to your WiFi
See section Finding device IP Address -
Once device is connected to WiFi, connect to it using a Browser. User/Password are stored in MultiSensor/src/User.h
-
Configure device parameters on web page and save settings. Once saved, device will reboot and reconnect to your WiFi and MQTT Broker
-
All sensors will now send their own MQTT message as appropriate
- Above steps should be done over USB-->Serial interface until device is fully functioning
- Future firmware updates can be performed over the air with no need for USB-->Serial interface
- Test all sensors and once ok, turn off debugging and upload new compiled firmware
See section Debug - Serial/Telnet output
To get the device IP address you have the following options:
1. Look at the Serial output where it will show on startup (assuming you have debug output turned on)
2. Look in your router to see WiFi clients
3. Try an mDNS browser app but this often takes time to get the device showing up
4. If already connected to WiFi and MQTT Broker, you can send a blank MQTT message as defined in user.h at "IP_REQUEST"
Each device will respond with a MQTT message such as defined with "IP/REPLY/<deviceID>" with the IP address in the payload
You have two options after turning on SERIAL_DEBUG within MultiSensor\src\User.h:
- Serial output over USB if connected
- Telnet if connected
Do not leave SERIAL_DEBUG enabled for normal use
Once device is connected to your WiFi, find its IP and connect to it through using a Browser
User/Password are stored in MultiSensor/src/User.h and you can always modify and flash new firmware to change it
Follow on screen firmware update instructions to flash new firmware
Project was developed on a Wemos D1 mini pro board. I like this boards form-factor and its ease of use
Sensors can be hooked up as follows:
- D1 Pin for Temperature sensor (DHT22)
- D2 Pin for Motion sensor (HC-SR501)
- D5 Pin for door/window sensor 1 (Reed)
- D6 Pin for door/window sensor 2
- D7 Pin for door/window sensor 3
- D8 Pin for door/window sensor 4
These can be reconfigured within MultiSensor\src\User.h
I am simply reusing other peoples amazing work for instance the following libraries:
- PubSubClient
- WifiManager
- RemoteDebug
- ArduinoJson
- Adafruit Unified Sensor
- DHT sensor library
AND OF COURSE the many examples on github
My development environment is Atom with its builtin PlatformIO toolset. Its a fantastic build and debug environment