Sixfab is launching their new shield for Raspberry Pi named as Sixfab Raspberry Pi Cellular IoT Application Shield. The Shield uses Quectel BG96 module which gives this shield combined feature of LTE technologies Cat.M1, Cat.NB1 and eGPRS for your Raspberry Pi.

Please visit the product page for detailed feature

The Shield also contains built-in temperature, humidity, light sensors, 3-axis accelerometer and relay

Since this is our first tutorial on this Shield. Here we will be observing all built-in sensors and control relay.
What we need:

    • Raspberry Pi,
    • Sixfab Raspberry Pi Cellular IoT Application Shield.

1. Attach the Shield to your Raspberry Pi and turn ON your Raspberry Pi. Make sure your I2C and Serial interfaces are enabled from raspi-config.

2. Clone our GitHub Repo to your Raspberry Pi.

git clone https://github.com/sixfab/Sixfab_RPi_CellularIoT_App_Shield.git

 

rpi_ciot_code1

3. Once the repo is cloned get into the Sixfab_Rpi_CellularIoT_Library

cd Sixfab_Rpi_CellularIoT_Library

 

rpi_ciot_code2

 

4. Now install the library by

sudo python3 setup.py install

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.

sudo pip3 install sixfab-cellulariot

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

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

cd sample

rpi_ciot_code4

6. For this tutorial, we will run sensor_test.py

python3 sensor_test.py

rpi_ciot_code5

 

In this way, you will get data from all available sensors on the Shield. Now we will examine the code.

 

from cellulariot import cellulariot
import time

node = cellulariot.CellularIoTApp()

node.disable()
node.enable()

time.sleep(0.5)
print("Acceleration: "+str(node.readAccel()))
time.sleep(0.5)
print("Humidity: " + str(node.readHum()))
time.sleep(0.5)
print("Temperature: " + str(node.readTemp()))
time.sleep(0.5)
print("Lux: " + str(node.readLux()))
print("ADC1: " + str(node.readAdc(0)))
time.sleep(0.5)
print("ADC2: " + str(node.readAdc(1)))
time.sleep(0.5)
print("ADC3: " + str(node.readAdc(2)))
time.sleep(0.5)
print("ADC4: " + str(node.readAdc(3))) 
time.sleep(0.5)
node.turnOnRelay()
time.sleep(2)
node.turnOffRelay()
time.sleep(0.5)
node.turnOnUserLED()
time.sleep(2)
node.turnOffUserLED()
  • LINE 1: imports the cellulariot class from cellulariot Library
  • LINE 2: imports time library
  • LINE 4: declares node as an object
  • LINE 6: Disables the module
  • LINE 7: Re-enables the module
  • LINE 9: idle for 0.5 seconds
  • LINE 10: readAccel() returns the accelerometer value
  • LINE 12:  readHum() returns the Humidity
  • LINE 14: readTemp() returns temperature
  • LINE 16: readLux() returns lux in percentage
  • LINE 17-23: returns ADC values
  • LINE 25/27: turns ON/OFF the Relay
  • LINE 29/31: Switch ON/OFF the USER led

 

In the next tutorial, we will show sending data over UDP.

8 thoughts on “Sensor Test Tutorial for Sixfab RPi Cellular IoT Application Shield”

  1. The github repository is not available.
    git clone https://github.com/sixfab/Sixfab_RPi_CellularIoT_Library.git

    What to do?
    I am not able to use this device without documentation on how to configure it.
    Please send instructions!

  2. When I execute this script I get the following error:

    TypeError: super() argument 1 must be type, not classobj

    Any idea how to fix this?

  3. it seems there is a bug.I followed strictly your documentation but when i am going to run the sensor_test.py i get an Import Error:no module name ‘cellulariot’.
    Any thoughts?

  4. installed from git, but when I run the sensor_test, I get the following error.

    [email protected]:~/Sixfab_RPi_CellularIoT_App_Shield/sample $ python3 sensor_test.py
    Sixfab Raspberry Pi Cellular IoT Application Shield Class initialized!
    BG96 module disabled!
    BG96 module enabled!
    Traceback (most recent call last):
    File “sensor_test.py”, line 17, in
    print(“Acceleration: “+str(node.readAccel()))
    File “/usr/local/lib/python3.5/dist-packages/sixfab_cellulariot-1.2.0-py3.5.egg/cellulariot/cellulariot.py”, line 696, in readAccel
    File “/usr/local/lib/python3.5/dist-packages/sixfab_cellulariot-1.2.0-py3.5.egg/cellulariot/MMA8452Q.py”, line 33, in __init__
    FileNotFoundError: [Errno 2] No such file or directory
    [email protected]:~/Sixfab_RPi_CellularIoT_App_Shield/sample $

  5. I can run sensor_test application successfully but when I run sendSMS.py I get below error:
    Sixfab Raspberry Pi Cellular IoT Application Shield Class initialized!
    /usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py:691: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
    /usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py:692: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
    BG96 module disabled!
    BG96 module enabled!
    BG96 module powered up!
    Traceback (most recent call last):
    File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 265, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
    FileNotFoundError: [Errno 2] No such file or directory: ‘/dev/ttyS0’

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File “sendSMSA.py”, line 18, in
    node.sendATComm(“ATE1″,”OK\r\n”)
    File “/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py”, line 200, in sendATComm
    File “/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py”, line 172, in sendATCommOnce
    File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 268, in open
    raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
    serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyS0: [Errno 2] No such file or directory: ‘/dev/ttyS0’

Leave a Reply

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