Skip to main content
All CollectionsConnect your Devices
Connect your Advantech WISE-4012E to Ubidots
Connect your Advantech WISE-4012E to Ubidots

Retrofit or deploy monitoring and control systems with Advantech and Ubidots

Sergio M avatar
Written by Sergio M
Updated over 3 months ago

The Advantech WISE IoT Developer Kit is a complete hardware & software solution to help users develop IoT applications and deploy their projects in the simplest way possible.

The WISE-4012E comes with an integrated Wi-Fi interface with AP mode and web configuration accessible by both web and mobile devices directly. It also includes an extension board for simulating sensor status, which can then be automatically pushed to a cloud. IoT is made easy with Advantech's WISE series!

The WISE-4012E IoT Developer Kit is good choice for system integrators and academic institutions looking to develop IoT applications quickly and deploy POCs at with ease and reliability – giving end-customers a sense of what data-driven analytics and smart monitoring can be, but without the thousands of dollars in POC startup cost.

To ensure your solutions data can be accessed and configured from anywhere, the WISE-4012E and WISE-4000 devices support local data storage, public cloud access (like Dropbox), and private clouds via a RESTful web API. The later being the viable option when visualizing data with Ubidots.

In this guide we detail the integration of the Advantech WISE-4012E with Ubidots, starting from the Hardware Setup and concluding with some application tips and tricks, to put your company's best foot forward.

In the following guide, Ubidots will demonstrate how to setup an Advantech WISE-4012 to display the readings inputs of the extension board with Ubidots cloud platform. 

Requirements 

IMPORTANT NOTE: This guide assumes your Raspberry Pi has been configured and is connected to the Internet. If not, you can quickly do so using this quick start guide from the Raspberry Pi Foundation

Table of Contents

  1. Hardware Setup

  2. Synchronizing the RTC

  3. Data Visualization

  4. Data Transmission  

  5. Sending data to Ubidots for visualization

  6. Application Optimization

Hardware setup 

1. Make sure the Operation Mode of the WISE is set to Normal Mode, with any doubts see here for notes on operation modes.

2. With the help of a trusted screwdriver, connect the extension board to the WISE device included the IoT Developer Kit for simulating the sensor status.

3.  Insert the Micro-B USB to the USB port located on the side of the module, and also insert the other end to the Type-A 5VDC USB to a power supply – PC, notebook, USB power adapter, or USB power bank.

4. Once the WISE is properly assembled, power on the device and scan the networks available and select the SSID: WISE-4xxx_MAC_Address, wait a few of seconds until the connection is established properly.  

5. Open your web browser (Google Chrome recommended) and enter the configuration page URL: http://192.168.1.1/config :

Then, login with the below parameters:

  • account: root 

  • password: 00000000  

6. Scroll down to "Network Information" and select "Go to Configuration" to connect the WISE with your local network.  

7. In the option WLAN Mode, select Infrastructure Mode. Then, assign an SSID Security type and Security Key

To finish, scroll down and select the DHCP checkbox and then press Submit.  

Once the changes are made you will receive a successful message.

8. Now the WISE is connected your network you can use a network scanner app to learn the new ip address assigned to the WISE. At Ubidots we know and love fing which is easy-to-use and available in both Google's Play Store and Apple's App Store.

As you can see below, in my case the IP Address assigned was 192.168.1.24 :

9. Now, return back to the browser, access the configuration page, but this time using the new IP Address assigned, as is shown below:

If you desire make another extra configuration to change the account, password, etc... feel free to do so as it applies to your solutions requirements.

Synchronizing the RTC

The WISE-4000 series supports data log functions – the I/O status can be logged in the module and also be queried from the module. 

Most hardware now days come with a RTC (real-time clock) that keeps the current time. The WISE-4012E does not have this pre-set so you will need to synchronize the your devices time with a Simple Network Time Protocol (SNTP) server to confirm the RTC time is accurate within your WISE device. 

1. To do this go to Configuration > Time & Date

As you can see above the current time will not be correct. 

2. Select your Time Zone and press the save icon. Then, select the screwdriver icon to calibrate the time & date with your local timezone; once the time is calibrated press the save icon to update the current time as is shown below - ours is set to USA Eastern Standard Time or GMT -5:00.

Data Visualization 

Now with all already configured, verify if the the WISE  is taking the reading of the sensor proper. 

1. Select the IO Status option, then select AI (analog inputs). Into this section, you will be able to see the changes of the analogs inputs in real time, please change the dimmers position of the extension board  to see the changes.

2. Select the IO Status option, then select DI (digital inputs). Into this section, you will be able to see the changes of the digital inputs in real time, please change the switch position of the extension board  to see the changes.

If you are able to visualize the changes proper, your device is updating the values correctly.

Data Transmission   

For the data transmission, we are going to use the REST (REpresentational State Transfer) which is a design style of software architecture for Web application behavior and services including image indication, resource request & response, and message delivery included in the WISE modules. Thanks to ADVANTAGE REST feature, we can simply send a HTTP request to retrieve the data from the all inputs.  

For this guide, we used a Raspberry Pi as gateway but remember for your solutions, best to choose a gateway based on environment it will live in. For an industrial operation, we highly recommend this option

1. With your Raspberry Pi connected to the internet, verify the IP address assigned to the board access using ssh in your computer's terminal:

ssh pi@{IP_Address_assigned}

If you haven't already configured the credentials of your Raspberry Pi, note that you will have to use the default credentials provided:

  • User Name: pi 

  • Password: raspberry

When your pi is configured and connected  correctly, the user of your terminal becomes listed as:pi@raspberrypi 

2. Now let's upgrade some packages and install pip, Python's packet manager. Copy and paste the below commands into your terminal and press "enter" after each to run the commands. 

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-pip python-dev build-essential 

3. Then, install Request library, which is a popular Python library that simplifies making HTTP requests. Copy and paste the below commands into your terminal and press "enter" run the command. 

$ pip install requests

Sending data to Ubidots for visualization

Create and run the below Python script in your computer's terminal:

$ nano wise-ubidots.py

Then, paste the code below and assign the IP assigned to your WISE (step 1, point 8) and your Ubidots TOKEN where indicated. Once the token is assigned, save the code to your terminal:

NOTE: The following code uses the "user" Wise account, which has read-only permissions and a default password: ''00000000." Please note that we made no modifications to any credentials in this guide. If you have already modified any credentials of your Wise account, you should assigned your specific credentials where indicated below: (WISE_ACCOUNT, WISE_PASS).

import requests
from requests.auth import HTTPBasicAuth
import time

TOKEN = "A1E-MeQ9eYmq8Rj1sID5c1LAR6Pj7bD9ws" # Assign your Ubidots TOKEN
DEVICE_LABEL = "advantech-wise" # Ubidots Device Label

WISE_IP = "192.168.1.24" # Assign the WISE IP
WISE_ACCOUNT = 'user' # WISE account access
WISE_PASS = '00000000' # WISE account password

# GET Request to the WISE REST
def get_wise_data(account, password):
    # Retrieve information about the analog input values
    r_analog = requests.get('http://' + WISE_IP + '/ai_value/slot_0/', auth=HTTPBasicAuth(account, password))
    response_analog = r_analog.json()
    # Assign the value of the channel 0 to a new variable
    ai_0 = response_analog['AIVal'][0]['Val']
    # Assign the value of the channel 1 to a new variable
    ai_1 = response_analog['AIVal'][1]['Val']
    # Retrieve information about the analog input values
    r_digital = requests.get('http://' + WISE_IP + '/di_value/slot_0/', auth=HTTPBasicAuth(account, password))
    response_digital = r_digital.json()
    # Assign the value of the channel 0 to a new variable
    di_0 = response_digital['DIVal'][0]['Val']
    # Assign the value of the channel 1 to a new variable
    di_1 = response_digital['DIVal'][1]['Val']
    return ai_0, ai_1, di_0, di_1

# Build the payload to be sent
def build_json(variable_1, value_1, variable_2, value_2, variable_3, value_3, variable_4, value_4):
    try:
        data = {variable_1: value_1, variable_2: value_2, variable_3: value_3, variable_4: value_4}
        return data
    except:
        return None

# POST Request to Ubidots
def post_ubidots(device, value_1, value_2, value_3, value_4):
    try:
        url = "https://industrial.api.ubidots.com"
        url = url + "/api/v1.6/devices/" + device
        headers = {"X-Auth-Token": TOKEN, "Content-Type": "application/json"}
        data = build_json("analog_input_0", value_1, "analog_input_1", value_2, "digital_input_0", value_3, "digital_input_1", value_4)
        print data
        r = requests.post(url=url, headers=headers, json=data)
        print r.json()
        #return r.json()
    except:
        pass

if __name__ == "__main__":
    while True:
        # Assign the sensors readings
        ai_0, ai_1, di_0, di_1 = get_wise_data(WISE_ACCOUNT, WISE_PASS)
        # POST the sensor readings to Ubidots
        post_ubidots(DEVICE_LABEL, ai_0, ai_1, di_0, di_1)
        time.sleep(5)

Now let's test the script. Paste and run the below script in your computer's terminal. 

python wise-ubidots.py

 4. Confirm your work - go to the Device section and locate the new device created called "advantech-wise" containing the analog and digital inputs of the WISE module. Remember that in this tutorial we are using the extension board to simulate the sensor status.

Application Optimization: 

Rename the Device and Variables

The names of the variables created are the same as the API labels (ai_0, ai_2, di_0, di_1), which are the IDs used by the API. This doesn't mean their names can't be changed, so it is recommended to change the names of your devices and variables to make them friendlier to your IoT solution's nomenclature. Click here to learn how to rename your device and variables names.

Event Setup 

An event (or alert) is any action triggered when data fulfills or exceeds a logical design rule. For example, an email or SMS message can be sent anytime a sensor stops sending data or a temperature exceeds a maximum or minimum threshold.

Results 

The WISE-4012E IoT Developer Kit helps developers to build and test applications for their customers with simple integration requirements. We built this integration with starter equipment and simple know-how; with the right devices for your environment, you can launch industrial monitoring and control applications in a matter of days instead of months for your clients – leading to cost savings, and improved customer happiness. 

With your data being captured by Ubidots, its time to create Dashboards and visualizations to control and monitoring your machines, systems, and environments remotely – keeping you and your clients happy and production at its peak.


Did this answer your question?