Observing External Sensor data with Sixfab Arduino NB-IoT Shield

Saeed • 5 Apr 2018
General
4

Related Blog Post

Subscribe to our newsletter

It is obvious that a single shield is never enough to design a project. You will definitely like to integrate different sensors in your NB-IoT projects. This is the reason we came up here with this tutorial. In this tutorial of Sixfab Arduino NB-IoT Shield, we are going to observe data from JSN-SR04T-2.0 Ultrasonic Waterproof Range finder, which can measure 20cm-600cm of distance.

We are considering you have already done the routers configuration as mentioned in our basic tutorial.

1

Here all our required parts are as follows:

a. Sixfab Arduino NB-IoT shield

b. Arduino Uno (any model with similar pinout)

c. JSN-SR04T Ultrasonic Waterproof Range Finder

d. USB-TTL converter

e. Jumper cables

2

 

Lets get started with following steps

1. Plug your shield to your Arduino. Plug your SIM and connect the Jumper connector for antenna.

3

2. Connect your JSN-SR04T to your shield the pin configuration will be as follows

JSN-SR04T ↔ Sixfab Arduino NB-IoTShield

5V ↔ 5V

GND ↔ GND

TRIG ↔ D13

ECHO ↔ D12

Now connect USB-TTL converter, the UART of the Arduino is already being used by BC95 module of our shield. So we will need another serial connection in order to observe our readings. Moreover to observe the data via our second serial we will need another serial monitor. We are going to use Serial Port Terminal in linux.(Windows user can use HERCULES SETUP).

The USB-TTL has 4 wires among them

VCC(5V, Red cable),

TX(Green cable),

RX(White cable) and

GND(Black Black).

There are also 4 M-M Jumper Cables so that you may connect to your shield.

The connection is to be made as following:

USB-TTL ↔ Sixfab Arduino NB-IoTShield

5V ↔ NOT USED

GND ↔ GND

TX ↔ D10

RX ↔ D11

#Note: Power has been supplied from Arduino so we don’t have to connect VCC of the USB-TTL.

4

3. Download advancedTutorialNBIoT.ino and open it in your Arduino IDE. Find the following lines

char ip[15] = “XX.XX.XX.XX”; //Local IP of your router

char port[10] = “XXXX”; //Service Port

and change it according to your own information. (Please go through our previous tutorial if you are not sure what it means)

4. Now connect Arduino and USB-TTL to your computer.

5. Upload the sketch to your arduino.

6. Now open Serial Port Terminal (HERCULES SETUP in Windows) and go to Configuration > Port settings.

9

7. Select your Port where your USB-TTL is connected (it’s ttyUSB0 in our case) and set Baud Rate to 9600.Then click OK.

10

Then you will be able to see the following screen

7a

8. Now to listen data being sending over UDP port, Open a terminal and run the following command

netcat -ul -p5000

where 5000 is our port number, so make sure you change it with your own port number. Windows user can HERCULES SETUP for this step.

Then you can observe the data package that has been sent over UDP.

8

Great you were able to listen the data over UDP.

Similary you can access any sensor you want. Make sure you are not using the ports of Arduino which are being used by the Sixfab NB-IoT shield.