Skip to main content
All CollectionsConnect your Devices
Advantech Series: Connect ADAM-6717 to Ubidots Using MQTT
Advantech Series: Connect ADAM-6717 to Ubidots Using MQTT

This article explores how to send data to Ubidots from an ADAM-6717

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

ADAM-6717 is an edge data acquisition module running Linux with gateway capabilities. Among its most remarkable features is the possibility to run Node-Red on it, thus reducing the burden of hard coding.


The following technical guide goes through the configuration steps on Node-Red to interface the ADAM-6717 to a temperature and humidity sensor through Modbus RTU and send the obtained data to Ubidots via MQTT.


Requirements

Table of contents


1. Set up the ADAM-6717 Connections

  • Connect the ADAM-6717 to the power supply. The recommended power input is 10-30 DC Voltage. Here you can check the device’s specifications.

  • Wait for the “Status” LED to start blinking. This means that the module has successfully booted.

  • Connect the ADAM-6717 to your router using an Ethernet cable.

  • Connect the sensor to the Modbus port. In this article, D0+ and D0- were used, however, you can choose to use D1+ and D1- as well.

2. Obtain the ADAM-6717 IP address

  • For Windows:

    • Download the ADAM/Apax.NET utility according to your architecture.

    • Launch the utility.

    • Right click on the Ethernet icon and click "search device".

    • All ADAM devices connected to the network will be listed on the utility along with their corresponding IP.

    • Copy this IP address to a notepad.

  • For Linux:

    • Open a command terminal.

    • Run the following command on the terminal:

      ifconfig

    • This will return information about your connection interfaces. Depending on your connection interface (wireless or Ethernet), you should copy the IP address displayed.

    Component 4.png
    • In this example, the PC is connected to the local network via Wi-Fi, so the IP address shown above is the corresponding to the PC.

    • Run the following command, replacing “192.168.1.41 ” with the IP address that you obtained in the previous step:

      sudo nmap -sn 192.168.1.41/24

    • E.g., if your PC’s IP address is 10.0.0.1, then you’d have to run the command as:

      sudo nmap -sn 10.0.0.1/24

    • Doing so will display all of the devices connected to the same network as your PC:

    • Among the list of different devices, search for the one being displayed as “Texas Instruments” and copy its IP address, this is the ADAM’s IP address:

3. Launch Node-Red on the ADAM-6717

  • Go to your preferred web browser and type the ADAM’s IP address in the search bar.

  • Click on the second option, “Graphic programming tool by Node-RED”.

  • When prompted for a username and a password, enter the following credentials:

    • Username: root

    • Password: 00000000

  • After doing so, the Node-Red environment will be displayed on your browser:

4. Install Ubidots’ MQTT Nodes on the ADAM-6717

You need to launch a SSH session into the ADAM in order to allow the filesystem to be R/W. These steps explain the process according to your OS:

  • For Windows OS:

    • Use PuTTY to launch a SSH session into the ADAM:

    • The root user does not have a password set, so when prompted for it, just hit the “Enter” key on your keyboard.

  • For Linux based OS:

    • Launch a SSH session into the ADAM by running the following command on a terminal:

    ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa root@192.168.1.32

    • Keep in mind that you need to change “192.168.1.32” for your ADAM’s IP address.

    • You’ll be prompted for a password, but don't enter anything, just hit the “Enter” key on your keyboard.

  • Independently of your OS, once inside the ADAM, run the following command:

remountfs rw 1000
  • You should get an output like this:

  • Run the following command:

reboot

  • At this point, the ADAM device will reboot.

  • Wait for the ADAM’s status LED to start blinking.

  • Launch again a SSH session into the ADAM as mentioned in beginning of this section.

  • Run the following command:

    npm install ubidots-nodered

  • A couple of warnings may rise up, you can dismiss them.

  • Once the installation is finished, run the following command:

    reboot


Pro Tip: For security reasons, you should set the remountfs value to its default. You can do so by following the steps above


5. Configure the temperature and humidity reading node

  • Search for the “Modbus Read” node and place it on the workspace.

  • Double click on it to display its configuration settings.

  • Click on the pencil icon at the “Server” configuration section.

  • The following menu will be displayed. There, edit the following settings according to:

    • Name: Set any name that you may find appropriate.

    • Type: Serial Expert.

    • Serial port: click on the magnifying glass icon.

      • Select “/dev/ttyAP0” if you are using the Modbus interface 0 (D0+, D0-).

      • Select “/dev/ttyAP1” if you are using the Modbus interface 1 (D1+, D1-).

    • Serial type: RTU-BUFFERED.

    • Baud rate: Set it according to the baud rate of the sensor you are using. In this example, the sensor is configured to operate at 9600 bauds. You should match this value according to your sensor.

    • Data bits: This setting goes according to your sensor’s.

    • Stop bits: This setting goes according to your sensor’s.

    • Parity: This setting goes according to your sensor’s.

    • Unit-id: This is the address of the Modbus slave that you are using. Match this value according to your specifics.

  • Leave all the other settings in their default configuration and click on the “Add” button.

  • Edit the following settings according to:

    • Name: set any name that you find appropriate.

    • Topic: leave blank.

    • Unit-id: This is the address of the sensor/slave on the Modbus network. Change this value according to your setup.

    • FC: FC 4: Read Input Registers.

    • Address: This is the address of the input register containing the data that you wish to read. The sensor used in this example stores the temperature value at 'address 1' and humidity is located at 'address 2'. You should match this values according to your sensor.

    • Quantity: 2. This is the quantity of registers to be read. Settings this value to 2 means that 2 contiguous registers will be read: namely temperature and humidity. If you wish to read only 1 register, set this value to 1.

    • Poll Rate: This is the frequency at which the data will be fetched from the sensor. Set this value according to your requirements.

  • Click on the “Done” button.

  • Search for the “Function” node and drag it to the workspace.

  • Double click on it to open its settings.

Component 15(1).png
  • Paste the following code:

var timestamp = new Date();
var timestamp = new Date();
msg.payload =
{
"temperature":{
"value":msg.payload.data[0]/10,
"timestamp":timestamp
},
"humidity":{
"value":msg.payload.data[1]/10,
"timestamp":timestamp
}

};
return msg;
  • Click on the “Done” button.

  • Search for the “Debug” node and drag it to the workspace.

  • Search for the “Modbus Response” node and drag it to the workspace.

  • Connect the nodes as shown below and then hit the “Deploy” button.

  • Click on the “Done” button.

image.png
  • Once the deployment is finished, click on the “Debug” button and you’ll be able to see the temperature and humidity measured by the sensor as well as the timestamp with which the data is sent.

Component 22(1).png

6. Configure the MQTT Node

  • Search for the ubidots_out node and drag it to the workspace.

  • Join the ubidots_out node directly to the output of the Function node. It should look like this:

image 163.png
  • Do the following for each of the two ubidots_out nodes:

    • Double click on it to open its settings.

    • On “Account type” select “Ubidots”.

    • On the “Name” field, type your Ubidots account username.

    • On the “Token” field, type your Ubidots Token.

    • On the “Device Label” field, type the name that you wish to be displayed at Ubidots for this device.

    • Click on the “Done” button.

  • Once you’ve done this, deploy the current flow.

image 164.png

7. Visualize the Data on Ubidots

  • Go to your Ubidots account → Devices and you’ll be able to see that a new device was created with the “Device Label” that you set in the previous section.

Component 21(1).png
Did this answer your question?