Smart OEE System
This repo contains
- Firmware
- Circuit Diagram
- Detailed instructions
for Smart OEE System.
These instructions will get you a copy of the project up and running on your system.
Things you need to install the FW.
- Arduino IDE
A step by step series that tell you how to get the Firmware and Backend running
You should have Arduino IDE Installed
-
Add ESP32 Board to your Arduino IDE 1. In your Arduino IDE, go to File> Preferences Installing ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux open preferences 2. Enter
https://dl.espressif.com/dl/package_esp32_index.json
into the “Additional Board Manager URLs” field then, click the “OK” button: Note: if you already have the ESP32 boards URL, you can separate the URLs with a comma(each board will go to neaw line) as follows:https://dl.espressif.com/dl/package_esp32_index.json,\n http://arduino.esp8266.com/stable/package_esp8266com_index.json
-
Open the Boards Manager. Go to Tools > Board > Boards Manager…
-
Search for ESP32 and press install button for the ESP32 by Espressif Systems“:
-
That’s it. It should be installed after a few seconds.
-
In your Arduino sketchbook directory, create tools directory if it doesn't exist yet.
-
Unpack the tool into tools directory(present in libs/ESP32FS-1.0.zip) (the path will look like <home_dir>/Arduino/tools/ESP32FS/tool/esp32fs.jar).
-
Close and re-open the Arduino IDE.
-
Now copy the contents of the libs folder to the libraries directory of your Arduino
- If you are using windows, the libraries directory will be Documents/Arduino/libraries
- Select ESP32 Dev Module from Tools->Board->ESP32
- Select the correct port from Tools->Port
- Then open Firmware.ino file,
- Select Tools > ESP32 Sketch Data Upload menu item. This should start uploading the files into ESP32 flash file system.
- Now Upload the Code to your ESP32 Dev Module.
- Your ESP32 is now ready to be used.
Follow the pinout diagram given below to connect different components to your TTGO LORA32 board.
Other components pin connection details
DHT22 Connections
DHT22 Pins | ESP32 Dev Module Pins |
---|---|
DATA OUT |
23 |
VCC |
5V |
GND |
GND |
Photoelectric Sensor Connections
From 2x 10K Resistors' center to Pin 18 of ESP32
LED Connections
LED Pins | ESP32 Dev Module |
---|---|
Anode |
D2 via 220Ω resistor |
Cathode |
GND |
D2 is also connected to the internal LED of ESP32 Dev Module |
SCT-013 Connections
- Voltage Divider with 2x 100KΩ resistors.
- 10uF capacitor connected between Voltage Divider Circuit Output and GND
- 3.5mm Audio Jack connected between Voltage Divider Circuit Output and ESP32 Pin 34.
The overall SCT-013 connection assembly will look something like shown in the diagram below.
The photoelectric sensor has three wires as shown below
Here's the complete circuit diagram of the system.
-
Power on your ESP32, it will present you with an AP named
OEE
(whileOEE
can be changed in the portal) -
Default captive portal password
12345678AP
which can be changed in captive portal. -
Connect to the ESP32 access point and open the web-browser and navigate to the link
http://esp32.local/_ac
. This link will work on most of the operating systems but if your operating system is not allowing to open it, you may want to check the captive portal IP Address from the serial monitor and can use that IP address inplace of the above mentioned URL. -
The default access IP Address is
http://192.168.4.1/_ac
-
You will be presented with a main dashboard as shown below(based on your device)
-
Once connected to a WiFi network, you can again access the captive portal using same URL or the IP Address from the Serial monitor.
-
The data is published to the MQTT Topic
OEE/{hostname}
while the hostname is the one which you can define in Settings page of the captive portal.
- Open Settings tab
- Enter timezone string from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones 'TZ database name' column.
- Click Save&Start
API Endpoints
Endpoint | Description |
---|---|
/api-now |
API: live sensor readings in JSON format |
/api |
API: historical sensors data in JSON format |
/LiveSensors |
HTML PAGE: Live Sensor Data |
/data |
HTML PAGE: Historical Sensor Data |
/mqtt_settings |
HTML PAGE: Settings. Default username: AP Name, Default Password: admin |
/_ac |
HTML PAGE: Main Captive portal page |
/ |
HTML PAGE: Historical Sensor Data |
- Connect to WiFi tab allows searching of nearby WiFi APs and adding them to the ESP32.
- Saved WiFi Networks tab allows connecting to the saved access points.
- Reset... tab allows reseting of the device to factory settings.
- Settings tab contains settings related to MQTT and sensors.
- api-now tab gives the live-sensor data in JSON format.
- api tab gives the historical sensor data acquired after every 5 mintues.
- LiveSensors tab shows live values of the sensors.
- HOME tab shows historical sensor data in a HTML table form acquired after every 5 minutes.
Dashboard Link: https://smartoeesystem.production.rehanshakir.com/
You can access the webapp with following test acccount credentials
Test Client
- Email Address:
[email protected]
- Password:
1234
Admin
- Email Address:
[email protected]
- Password:
12345678
Admin Dashboard
- Main Dashboard - Devices/Sensors Page - Adding a new Device/Sensor - Devices Management Page - User Profile
Client Dashboard - Main Client Dashboard - Updating energy cost - Devices Management - Adding a new device - User Profile
From Device the data should be published to the topic smartoee/data/#
in the format below:
- Replace
#
with the device MAC Address.
{
"macAddress": "FE064CSF",
"oee":"20",
"temperature":"30",
"humidity":"45",
"watts":"19"
}
Any change detected in the values will generate an alarm(as set in the dashboard) and will publish the value on the topic {MAC Address}/smartoee
of the device.
Following components are used to make this project
or
- Device Demo Video - OEE Device Demo Video
- @Nauman3S - Development and Deployment