This project takes takes you through the steps to create a project of reading values from a MQ135 Air Quality or other gas sensor with your computer using a NodeMCU board and a USB cable. Using the OnSiteMonitor software, you are able to process the sensor value and will send SMS text messages to your mobile device when the value falls below, meets, or exceeds custom set limits.
The NodeMCU board is used to communicate with the sensor or any device that provides an analog or digital value. This project focuses on a simple sketch that reads an analog signal. Connecting the NodeMCU board to your computer with a USB cable, your computer can read the values through the USB/Serial Port. The OnSiteMonitor desktop software allows you to easily begin to process you sensor values. One feature OnSiteMonitor provides SMS text messaging functionality by creating events using the sensor value.
Overview of StepsThe following are the steps you will follow to add a device to OnSiteMonitor to collect and process data from your DIY device.
1. Install OnSiteMonitor v2.4 or newer and create your account.
2. Create your DIY device where it is sending data in the specified OnSiteMonitor format.
3. Create/Addyour DIY device in the OnSiteMonitor console.
4. Display DIY data in OnSiteMonitor.
OnSiteMonitorOnce OnSiteMonitor is installed and your account is created, the Account ID is available for placement into the Sketch for the device. To obtain the Account ID, click on the ‘Setup’ tab on the Console application.
Any device that communicates data through the USB cable to the computer where OnSiteMonitor is running is a candidate for this process.
This sample project documented here utilizes the NodeMCU board and the MQ135 Air Quality Sensor. The Arduino IDE is used to upload the Sketch to the NodeMCU board.
The sketch is simple but requires four parameters:
1. Account ID – This ID allows your OnSiteMonitor Console to obtain data from your device(s).
2. Device Type – This is a literal value that identified the type of data being sent to OnSiteMonitor.
3. Device ID – This value is a unique, custom value that is assigned to a specific device.
4. Command Class – this value identifies that only one data value is retrieved from the device. It will have a value of “1”.
Once the Sketch has been uploaded, tested, and confirmed to be sending in the correct format, you can proceed to the OnSiteMonitor console to create and add your device. Download the sketch attached to this project.
Create/Add Device inOnSiteMonitorTo create a new DIY device, select the ‘DIY’ tab in theOnSiteMonitor Console application.
1. Select the "DIY" tab.
- Enter "Meter Reader" as the"Device Name".
- Enter "mtr" as the "Device ID".
- Select "OSM Meter Reader" as the"Device Type".
- Enter "Mtr Rdr" as the "Node Name".
- Select Range (0-100)" as the "Command Set".
- Click the "Create" button to create your new device.
Once the device has been created, it can then be added to allow data to be collected and processed by OnSiteMonitor.
In the Console, select the ‘Setup’ tab. Then select the‘Add/Remove Devices’ button.
1. Select the ‘Add A New Device option.
- Select ‘OSM Meter Reader’ for the Manufacturer option.
- Select ‘Meter Reader’ for the Model.
- Enter a custom Device Name.
- Enter a Location.
- Enter a Category.
- Select ‘Yes’ for Allows Remote Access.
- Click the ‘Add’ button to add the device to OnSiteMonitor.
2. Click ‘OK’ when the device has been added.3. Select the ‘Dashboard’ tab.4. The new device will be displayed in the list of devices.
To start sending data to OnSiteMonitor, the ‘Meter Reader’ is needed.
Select the ‘Tools’tab on the Console. Then click the‘Meter Reader’ icon.
The ‘Meter Reader’ application will appear.
1. Select the ‘Configuration’ tab and select the parameters for data collection.
- Operation Mode. Select ‘Standalone’ to allow the ‘OnSiteMonitor Configuration’ data will not be populated. Once this data is populated, the mode can be changed to ‘OnSiteMonitor’ to allow OnSiteMonitor to start collecting and processing data from the device.
- Serial/USB Port. This list contains the available ports that your computer know about. One should be the DIY device. If the list is blank, additional drivers may be required for your device to communicate via the USB cable.
- Data Points. Select the number of data points to display on the ‘Monitor’ tab.
- Data Range. Select the lower and upper range of expected data. This is used to set values for the alerts.
- High/Low Alarm Value. These values are used to play the selected sound for alarms. If the value is below or above the values selected, the alarm sound will be played.
- Alarm Sound. Select a Wav or MP3 file to play when the device value is outside the Alarm Values.
2. Click the ‘Monitor’ tab.3. Click the ‘Start’ button. After a few data points have been collected, click the ‘Configuration’ tab.
4. The OnSiteMonitor Configuration data should be populated with data from the device is communication is correct.
5. Select ‘OnSiteMonitor’ as the Operation Mode.6. Click the ‘Save’ button.7. Select the ‘Monitor’ tab.8. Click the ‘Start’ button to start collecting device data.9. Make sure the ‘Dashboard’ tab is selected on the Console.10. Your device should begin to update.
Create The Event
In the OnSiteMonitor console, select the 'Events/Schedules' tab. This window will allow you to create an alert that will send an SMS text message to your mobile device.
On the Console, select the 'Setup' tab. Enter the telephone number for the device that should be used to received text messages.
On the Console, select the 'Events/Schedules' tab.
1. Click the 'Event' option.
2. Enter 'Bad Air Value' for the 'Event/Action Name'.
3. Select the 'Meter Reader' as the 'Source Device'.
4. Select 'Greater Than' as the 'Operand'.
5. Select the 'Available Status Values' as the high alarm limit. When the value of the device rises above this number, the alert will be sent.
6. Enter 'Bad Air Alert' as the 'Action Name'.
7. Click the 'Mobile Text Alert' checkbox.
8. Click the 'Save' button.
9. Click the 'Dashboard' tab.
Make sure the 'Meter Reader' application is collecting data from the device. As soon as a value is received from the device that is above your alert value, the SMS text message should be received by your mobile device.








Comments