Overview:
Equipment failure can cause a huge impact on business in the manufacturing industry. It is critical to keep production line rolling. One of the reasons, this can occur is due to insufficient oil level. Sometimes the oil is not in the stock and takes a few days to procure it. This system monitors the oil level and indicates to the user, if the level is below certain level. The backend of the system uses Azure IOT stream analytics and shows the trend of oil consumption. It can be used for predictive maintenance. The system can also tell, if there is unusual consumption of oil that can be caused by potential leakage or other issues.
Architecture:
The system comprises of a force sensor that is connected to the Raspberry Pi. Maintenance engine on the Raspberry Pi will periodically check the weight measured by the sensor. It will notify the weight to the UWP App and Azure. The UWP app will display the level on the screen. On Azure, an IOT suite will consume the telemetry data and define the business rules that will send messages to the Raspberry Pi based on the oil level. The maintenance engine on the Raspberry Pi will listen to the message and transmit them to the app for displaying to the user. The critical messages will also activate LED on the hardware.
- To make this more robust, Maintenance Engine also has local logic to notify the app. This is a backup, if the internet connection fails.
- The sensor is coupled with a potentiometer instead of a fixed resistor. This enables fine tuning in the field.
Constraints:
The system is designed to measure just the weight of oil and can be extended in the future for detailed oil analysis. The system can also be extended to send push notifications and integrate with procurement systems in the company.
Building the System:
The project comprises of building hardware using Raspberry Pi, UWP app and creating back-end analytics solution using Azure IOT Suite.
Hardware:
Force sensor FSR402 is an analog device. MCP3208 is used to translate analog signal to digital signal. After connecting the FSR402 and potentiometer, follow these steps to connect MCP3208.
- MCP3208: VDD - 3.3V on Raspberry Pi 2 or 3
- MCP3208: VREF - 3.3V on Raspberry Pi 2 or 3
- MCP3208: AGND - GND on Raspberry Pi 2 or 3
- MCP3208: CLK - “SPI0 SCLK” on Raspberry Pi 2 or 3
- MCP3208: Dout - “SPI0 MISO” on Raspberry Pi 2 or 3
- MCP3208: Din - “SPI0 MOSI” on Raspberry Pi 2 or 3
- MCP3208: CS/SHDN - “SPI0 CS0” on Raspberry Pi 2 or 3
- MCP3208: DGND - GND on Raspberry Pi 2 or 3
- MCP3208: CH0 - Potentiometer wiper pin
This gets the sensor connected. Connect LED and a resistor to GPIO4 for indicating the critical alter.
Azure IOT Suite:
Azure IOT Suite provides templated solutions for creating the back-end.
The process is simple.
1. Go to Azure IOTsuite portal and sign in
2. Click on Create New Solution.
3. Select Remote Monitoring Solution. It takes a while to create it.
4. The solution is created with simulated devices. You can go to the Devices tab and remove those devices.
5. Click on Add Device, Select Custom Device
6. After creating the device, note the values for Device ID, IoT Hub Hostname and Device Key.
UWP App:
Code for UWP app can be downloaded from the Github.
Update the following values in the UWP app based on the values obtained from the Azure IOT Suite AzureWeightSensor.cs
Update OilAlertDeviceID
with Device ID from the IOT Solution AzureConnector.cs
Update HostName
with IoT Hub Hostname from the IOT Solution.
Update DeviceKey
with Device Key from the IOT Solution.
Open Cloud Explorer and connect using your account.
Open DocumentDB
for the corresponding device.
In the JSON file, Update Telemetry section as follows:
"Telemetry": [
{
"Name": "Weight",
"DisplayName": "Weight",
"Type": "double"
}
],
This defines telemetry parameters for the dashboard.
Deploy the app on Raspberry Pi using Visual Studio.
In the app, click the Start button. As you apply and reduce pressure on the force sensor, it should reflect in the app as well as in the telemetry dashboard.
(Note: Force is recognized, only if applied within the boundaries of the sensor.)
If you like this project, please click the Respect button, share with your network and follow me.
Comments