Our previous tutorial was about observing data from the available sensors on the Sixfab R.Pi Cellular IoT Application HAT. Since our shield is capable of combined LTE technologies Cat.M1, Cat.NB1 (NB-IoT) and eGPRS we will be demonstrating transmitting data over UDP.

Before we start with the Raspberry Pi Cellular IoT HAT, we will need to make some setup for our router. The steps are as follows:

1. Login to you routers configurations, by going to 192.168.1.1(generally this is the address for router configurations, might change for some router) from your Internet browser and login with your own credentials.

2

2. Now scroll down at Basic Status page to find your IP address of your connection (which is mentioned as dsl_internet in our case). We will need it later.

3a

3. Now click on Forwarding form the option list and then click Virtual Server.

4. Then click on Add New, which will take you to the following screen. Now fill up Service Port(as desired, in our case it is 5000), IP Address(It is IP Address of your Computer/Laptop. Check the note below if you don’t know how to obtain your IP Address) and select Protocol(as UDP). Click Save.

5a

** Note: Open your terminal and run ifconfig command to obtain your IP Address. This is applicable for linux users. Windows user can type ipconfig in cmd command.

5. Now insert your SIM card to Sixfab Raspberry Pi Cellular IoT Application HAT and plug the antenna to LTE port.

rpi_ciot_img46. Now attach the HAT to your Raspberry Pi and turn ON your Raspberry Pi. Make sure your I2C and Serial interfaces are enabled from raspi-config.

7. Now clone our github Repo to your Raspberry Pi to install our library(If you have already done it, you may skip to step 10).

rpi_ciot_code1

8. Once the repo is cloned get into the Sixfab_Rpi_CellularIoT_Library

rpi_ciot_code2

9. Now install the library by

rpi_ciot_code3

The library is written with python3 so we will be writing and running every script in python3.

*** Alternate method of installing the library is using pip3. Simply run the following command.

once after installation you will need the scripts from github repo.

10. Once it is installed you may get into sample directory where you will find examples for the shield.

rpi_ciot_code4

11. Here we will need basicUDP.py script for this tutorial. Before running the script, we will need to make some changes in the script. Type

rpi_ciot_code5

12. Now find the following lines

and replace xx.xx.xx.xx with your Router’s IP and xxxx with your defined port. Then save the script with the changes.

rpi_ciot_code6

13. Before you run the script, open a terminal to listen the data sent over UDP. Type the following command to listen the data. Here 5000 is my port address that I set at step 4.

rpi_ciot_code8

14. Once you have changed and saved your changes run the following command to run your script.

rpi_ciot_code7

15. Once you run the script you will be able to see the SEND OK at the end.

rpi_ciot_code9

16. On the other terminal where you were listening to UDP data you will be able to see the received data as follows

rpi_ciot_code10

In this way you will be able to send data over UDP using your Sixfab R.Pi Cellular IoT Application HAT.

2 thoughts on “Basic UDP Communication Tutorial for Sixfab RPi Cellular IoT Application HAT”

    1. Hey,
      Carrier having any of B1/ B2/ B3/ B4/ B5/ B8/ B12/ B13/ B18/ B19/ B20/ B26/ B28 and B39 will work with M1.
      AT&T, Boost Mobile, FreedomPop, Mint Mobile, Sprint, US Cellular, Verizon Wireless, Cricket Wireless, MetroPCS works with M1 chipset.

Leave a Reply

Your email address will not be published. Required fields are marked *