Sixfab came up with Raspberry Pi Cellular IoT HAT. This time it is a Hat rather than a shield. To be more specific this HAT is lighter version of our previous Raspberry Pi Cellular IoT Application Shield, where both uses Quectel BG96 module. The major difference is the peripheral sensors, the HAT doesn’t contain any sensors on it.


 

What is the feature of this HAT?
This HAT contains Quectel BG96 which has combined LTE technologies Cat.M1, Cat.NB1 and eGPRS.
It also supports GPS.

Preconfiguration

Before we start working with the HAT, let us setup our router settings and Raspberry pi.
Your router needs port forwarding for UDP connection. You can do it by following Port Forwarding Tutorial. Note down the IP address of your router and UDP port number.
The Serial port hardware of your Raspberry Pi should be enabled and Login shell to be accessible over serial should be disabled. This can be done from raspi-config.

Hardware Setup

  1. Attach the Cellular IoT HAT to your Raspberry Pi.
    cell_hat_hw
  2.  

  3. Insert the Sim.
    cell_hat_sim
  4.  

  5. Plug the antenna. You will need one LTE antenna with u.FL for this tutorial. Here, I am using LTE Full Band PCB Antenna.
    cell_hat_Antenna
  6.  

Software Setup

Now we are ready to start.

  1. Download/clone the library from github
    git clone https://github.com/sixfab/Sixfab_RPi_CellularIoT_App_Shield.git
    cell_hat_sw_1

  2.  

  3. Now get into the cloned directory.
    cd Sixfab_RPi_CellularIoT_Library
    cell_hat_sw_2

  4.  

  5. Now install the library
    sudo python3 setup.py install
    Make sure you are installing it with python3.
    cell_hat_sw_3

  6.  

  7. Now goto sample directory
    cd sample/
    cell_hat_sw_4

  8.  

  9. Now open the basicUDP.py script.
    nano basicUDP.py
    cell_hat_sw_5

  10.  

  11. Here, you will see following two lines.

    You have to replace these information with your own which have set in the preconfiguration step that is the routers IP and the UDP port address.
    cell_hat_sw_6

  12.  

  13. Check if the node = cellulariot.CellularIoT() is uncommented.
    cell_hat_sw_7

  14.  

  15. Now save the python script and run with
    python3 basicUDP.py
    cell_hat_sw_8

  16.  

  17. Just before running the script open a new terminal in your laptop and type
    netcat -ul -p5000
    Here 5000 is my port number. Replace it with your port number. (This is to be done in the Device where you have directed the UDP port during the preconfiguration step)
    cell_shield_udp_sw_8

  18.  

  19. Here you can see the Data that has been sent over UDP.
    cell_shield_udp_sw_10

Hence, We are done with the tutorial here. Please write suggestions, questions and feedback in the comment section below.

8 thoughts on “Cellular IoT HAT Getting Started with UDP connection”

  1. Hi !
    When I follow this tutorial for the Raspberry Pi Cellular IoT HAT – LTE-M & NB-IoT & eGPRS, the program loop at “AT+CGATT?”. Any idea of what could be wrong with my device ?

  2. Hi Saeed, thank you for your response.

    However it is.. I didn’t modify the band : node.setGSMBand(node.GSM_900)
    node.setCATM1Band(node.LTE_B5)
    node.setNBIoTBand(node.LTE_B20)

    I’m located in Singapore. Could it be the problem ?

  3. OK, I think I understand what you mean. I’ve changed the band to GSM_1800 as I’m using a Sim card operator : M1 and APN: sunsurf.
    I use the GSM_MODE.

    Unfortunately, it still doesn’t work. But thank you for your response, I will research a solution.

    1. Hi, Since you are using LTE CAT M1,

      use
      node.setMode(CATM1_MODE)
      node.setCATM1Band(node.LTE_B5) #Make sure B5 supports in your location. If you don’t know your band you can use LTE_CATM1_ANY instead.

  4. Hi again,

    I tried with CATM1_MODE and LTE_CATM1_ANY and it still doesn’t work. Is there other test I could try to find my problem ?

      1. Here is the output. I have tried with GSM_MODE but it’s the same result.

        Sixfab Raspberry Pi Cellular IoT Shield Class initialized!
        BG96 module disabled!
        BG96 module enabled!
        BG96 module powered up!
        ATE1
        ATE1
        ATE1
        OK

        AT+CGSN
        AT+CGSN
        866425039281441

        OK

        AT+CGMR
        AT+CGMR
        BG96MAR02A07M1G

        OK

        AT+CGMM
        AT+CGMM
        BG96

        OK

        AT+QCFG=”band”,2,0,0
        AT+QCFG=”band”,2,0,0
        OK

        AT+QCFG=”band”,0,400A0E189F,0
        AT+QCFG=”band”,0,400A0E189F,0
        OK

        AT+QCFG=”band”,0,0,80000
        AT+QCFG=”band”,0,0,80000
        OK

        AT+QCFG=”band”
        AT+QCFG=”band”
        +QCFG: “band”,0x2,0x400a0e189f,0x80000

        OK

        AT+QCFG=”nwscanseq”,02,1
        AT+QCFG=”nwscanseq”,02,1
        OK

        AT+QCFG=”nwscanmode”,3,1
        AT+QCFG=”nwscanmode”,3,1
        OK

        AT+QCFG=”iotopmode”,0,1
        AT+QCFG=”iotopmode”,0,1
        OK

        Modem configuration : CATM1_MODE
        AT+CSQ
        AT+CSQ
        +CSQ: 99,99

        OK

        AT+QNWINFO
        AT+QNWINFO
        +QNWINFO: No Service

        OK

        Trying to connect base station of operator…
        AT+CGATT?
        AT+CGATT?

Leave a Reply

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