Code Monkey home page Code Monkey logo

sixfab_rpi_cellulariot_app_shield's Introduction

Sixfab RPi CellularIoT Library

Repository of Python Library for Sixfab RPi Cellular IoT HAT and Sixfab RPi Cellular IoT Application Shield

Library Installation

Manual Installation

git clone https://github.com/sixfab/Sixfab_RPi_CellularIoT_Library.git
cd Sixfab_RPi_CellularIoT_Library
sudo python3 setup.py install

Install with pip3

Use pip3 to install from PyPI.

sudo pip3 install sixfab-cellulariot

Test

Enable serial_hw and I2C interfaces by following instructions below:

  1. Run sudo raspi-config
  2. Select 5 Interfacing Options
  3. Enable P5 I2C
  4. For P6 Serial
    • Disable Login shell to be accessible over serial
    • Enable Serial port hardware
  5. Finish
  6. Reboot
  7. It's done.
cd sample
python3 sensor_test.py  #for testing sensor_test example

Examples

** basicUDP
** sensorTest

Tutorials

** Basic UDP Communication Tutorial for Sixfab RPi Cellular IoT Application Shield
** Sensor Test Tutorial for Sixfab RPi Cellular IoT Application Shield

Library Documentation

CellularIoT class

vars

board = "" # shield name (Cellular IoT or Cellular IoT App.)
ip_address = "" # ip address       
domain_name = "" # domain name   
port_number = "" # port number 
timeout = TIMEOUT # default timeout for function and methods on this library.
response = "" # variable for modem self.responses
compose = "" # variable for command self.composes

Primary Functions

setupGPIO - Needs documentation

clear_compose - Function for clearing global compose variable

clearGPIOs - Function for clearing GPIO's setup

enable - Function for enable BG96 module

disable - Function for powering down BG96 module and all peripherals from voltage regulator

powerUp - Function for powering up or down BG96 module

getModemStatus - Function for getting modem power status

getResponse - Function for getting modem response

sendDataCommOnce - Function for sending data to module

sendATCommOnce - Function for sending at comamand to module

sendDataComm - Function for sending data to BG96_AT

sendATComm - Function for sending at command to BG96_AT

resetModule - Function for saving conf. and reset BG96_AT module

saveConfigurations - Function for save configurations that be done in current session

getIMEI - Function for getting IMEI number

getFirmwareInfo - Function for getting firmware info

getHardwareInfo - Function for getting hardware info

setGSMBand - Function for setting GSM Band

setCATM1Band - Function for setting Cat.M1 Band

setNBIoTBand - Function for setting NB-IoT Band

getBandConfiguration - Function for getting current band settings

setScambleConf - Function for setting scramble feature configuration

setMode - Function for setting running mode

getIPAddress - Function for getting self.ip_address

setIPAddress - Function for setting self.ip_address

getDomainName - Function for getting self.domain_name

setDomainName - Function for setting domain name

getPort - Function for getting port

setPort - Function for setting port

getTimeout - Function for getting timout in ms

setTimeout - Function for setting timeout in ms

Network Service Functions

getSignalQuality - Fuction for getting signal quality

getQueryNetworkInfo - Function for getting network information

connectToOperator - Function for connecting to base station of operator

SMS Functions

sendSMS - Function for sending SMS

GNSS Functions

turnOnGNSS - Function for turning on GNSS

turnOffGNSS - Function for turning of GNSS

getLatitude - Function for getting latitude

getLongitude - Function for getting longitude

getSpeedMph - Function for getting speed in MPH

getSpeedKph - Function for getting speed in KPH

getFixedLocation - Function for getting fixed location

TCP & UDP Protocols Functions

activateContext - Function for configurating and activating TCP context

deactivateContext - Function for deactivating TCP context

connectToServerTCP - Function for connecting to server via TCP (just buffer access mode is supported for now)

sendDataTCP - Fuction for sending data via tcp (just buffer access mode is supported for now)

sendDataSixfabConnect - Function for sending data to Sixfab connect

sendDataIFTTT - Function for sending data to IFTTT

sendDataThingspeak - Function for sending data to Thingspeak

startUDPService - Function for connecting to server via UDP

sendDataUDP - Fuction for sending data via udp

closeConnection - Function for closing server connection

Shield Peripheral Functions

readUserButton - Function for reading user button

turnOnUserLED - Function for turning on user LED

turnOffUserLED - Function for turning off user LED

CellularIoTApp Class

Primary Functions

setupGPIO - Needs documentation

enable - Function for enable BG96 module

disable - Function for powering down BG96 module and all peripherals from voltage regulator

powerUp - Function for powering up or down BG96 module

getModemStatus - Function for getting modem power status

readAccel - Function for reading accelerometer

readAdc - Function for reading ADC

readTemp - Function for reading temperature

readHum - Function for reading humidity

readLux - Function for reading light resolution

turnOnRelay - Function for turning on RELAY

turnOffRelay - Function for turning off RELAY

readUserButton - Function for reading user button

turnOnUserLED - Function for turning on user LED

turnOffUserLED - Function for turning off user LED

Pinouts

Sixfab RPi Cellular IoT Application Shield

Pinout Schematic

Sixfab RPi Cellular IoT HAT

Pinout Schematic

Attention

! All data pins work with 3.3V reference. Any other voltage level should harm your hat or RPI.

Layouts

Sixfab RPi Cellular IoT Application Shield

Layout

Sixfab RPi Cellular IoT HAT

Layout

sixfab_rpi_cellulariot_app_shield's People

Contributors

d4rkd0s avatar ndrake avatar saeedjohar avatar saucompeng avatar selengalp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sixfab_rpi_cellulariot_app_shield's Issues

HTTP Abstraction (TCP Req/Resp)

I'd like to see the functionality for sending and receiving HTTP requests.

Something the allows for sending basic HTTP GET requests and get responses back. Eventually an abstraction for other HTTP methods, as well as abilities to post multipart-form data, apply headers for authorization, and json bodied requests.

Unable to send data to Thingspeak

When I run the ThingSpeak.py file from sample folder, I get the following error.

AttributeError: 'CellularIoTApp' object has no attribute 'sendDataComm'

I have checked the cellulariot.py file and 'sendDataComm' method is not defined

Please help

LTE is not working

Data module is not working, please advise what are the steps do debug it / fix it.

Thank yoy

Problem with BasicUDP.py and sending AT commands

Hi i have problem with this cos. So i have failure on sending AT commands:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 275, in open
self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
PermissionError: [Errno 13] Permission denied: '/dev/ttyS0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "basicUDP.py", line 21, in
node.sendATComm("ATE1","OK\r\n")
File "/usr/local/lib/python3.4/dist-packages/sixfab_cellulariot-1.2.0-py3.4.egg/cellulariot/cellulariot.py", line 200, in sendATComm
File "/usr/local/lib/python3.4/dist-packages/sixfab_cellulariot-1.2.0-py3.4.egg/cellulariot/cellulariot.py", line 172, in sendATCommOnce
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 278, in open
raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/ttyS0: [Errno 13] Permission denied: '/dev/ttyS0'

I dont know what it is I configure my modem to IP adress of RPI: 10.0.0.2
Port:5000.

PLEASE HELP ME !
I cant send any AT command to mi BG96.

Cellular IoT HAT UDP connectToOperator

Hello,

I'm following the tutorial for the Cellular IoT HAT UDP.
When i launch the basicUDP.py script, it stops at this operation :

Modem configuration : GSM_MODE Trying to connect base station of operator... AT+CGATT? AT+CGATT? AT+CGATT? AT+CGATT? AT+CGATT?

I have connected my HAT to a Raspberry PI 3 model B. My laptop is connected to the internet with WiFi. The Pi is connected to my laptop with an Ethernet cable. I have shared the connection of the Wifi with the ethernet.

I think the problem is the port forwarding. The IP address of my PC is 192.168.1.XX/24 so I port forward this IP. Although, the IP address of the PI is 192.168.137.XX/24. I don't know if this is correct or not.

PS: for my application, i cannot directly plug the PI with the rooter. Now my laptop IP is 192.168.1.46 and the raspberry IP is 192.168.1.47

Do you have any idea to solve this problem ?

Edit : I'm now able to have an IP of my router network for the PI but it still doesn't work at the same step.

sensor_test.py causes shutdown on upgraded OS

Hi,

I have successfully run the sensor test on a fresh install of Raspbian Buster
Linux raspberrypi 4.19.57-v7+ #1244 SMP Thu Jul 4 18:45:25 BST 2019 armv7l GNU/Linux
Description: Raspbian GNU/Linux 10 (buster)
Python 3.7.3

But when I have tried to run on Stretch and then Stretch upgraded to Raspbian Buster 10.3, running the sensor_test.py causes the Pi to shutdown.
Linux raspberrypi 4.19.97-v7+ #1294 SMP Thu Jan 30 13:15:58 GMT 2020 armv7l
Description: Raspbian GNU/Linux 10.3 (buster)

(I have a 3A PSU)

Do you have any suggestions as to what I should check in my OS settings

Python libs in Fresh buster

Adafruit-ADS1x15==1.0.2
Adafruit-GPIO==1.0.4
Adafruit-PureIO==1.0.4
asn1crypto==0.24.0
astroid==2.1.0
asttokens==1.1.13
automationhat==0.1.0
beautifulsoup4==4.7.1
blinker==1.4
blinkt==0.1.2
buttonshim==0.0.2
Cap1xxx==0.1.3
certifi==2018.8.24
chardet==3.0.4
Click==7.0
colorama==0.3.7
colorzero==1.1
cookies==2.2.1
cryptography==2.6.1
docutils==0.14
drumhat==0.1.0
entrypoints==0.3
envirophat==1.0.0
ExplorerHAT==0.4.2
Flask==1.0.2
fourletterphat==0.1.0
gpiozero==1.5.1
html5lib==1.0.1
idna==2.6
isort==4.3.4
itsdangerous==0.24
jedi==0.13.2
Jinja2==2.10
keyring==17.1.1
keyrings.alt==3.1.1
lazy-object-proxy==1.3.1
logilab-common==1.4.2
lxml==4.3.2
MarkupSafe==1.1.0
mccabe==0.6.1
microdotphat==0.2.1
mote==0.0.4
motephat==0.0.2
mypy==0.670
mypy-extensions==0.4.1
numpy==1.16.2
oauthlib==2.1.0
olefile==0.46
pantilthat==0.0.7
parso==0.3.1
pgzero==1.2
phatbeat==0.1.1
pianohat==0.1.0
picamera==1.13
picraft==1.0
piglow==1.2.4
pigpio==1.42
Pillow==5.4.1
psutil==5.5.1
pycrypto==2.6.1
pygame==1.9.4.post1
Pygments==2.3.1
PyGObject==3.30.4
pyinotify==0.9.6
PyJWT==1.7.0
pylint==2.2.2
pyOpenSSL==19.0.0
pyperclip==1.6.4
pyserial==3.4
python-apt==1.8.4
pyxdg==0.25
rainbowhat==0.1.0
requests==2.21.0
requests-oauthlib==1.0.0
responses==0.9.0
roman==2.0.0
RPi.GPIO==0.6.5
RTIMULib==7.2.1
scrollphat==0.0.7
scrollphathd==1.2.1
SecretStorage==2.3.1
sense-hat==2.2.0
simplejson==3.16.0
six==1.12.0
sixfab-cellulariot==1.2.0
skywriter==0.0.7
sn3218==1.2.7
soupsieve==1.8
spidev==3.3
ssh-import-id==5.7
thonny==3.1.0
thonny-pi==1.1
touchphat==0.0.1
twython==3.7.0
typed-ast==1.3.1
unicornhathd==0.0.4
urllib3==1.24.1
webencodings==0.5.1
Werkzeug==0.14.1
wrapt==1.10.11

Python libs in Upgraded Buster

Adafruit-ADS1x15==1.0.2
Adafruit-GPIO==1.0.4
Adafruit-PureIO==1.1.0
astroid==2.1.0
asttokens==1.1.13
automationhat==0.2.0
blinker==1.3
blinkt==0.1.2
buttonshim==0.0.2
Cap1xxx==0.1.3
chardet==2.3.0
click==6.6
colorama==0.3.7
colorzero==1.1
cryptography==1.7.1
docutils==0.13.1
drumhat==0.1.0
envirophat==1.0.0
ExplorerHAT==0.4.2
Flask==0.12.1
fourletterphat==0.1.0
gpiozero==1.5.0
idna==2.2
isort==4.2.5
itsdangerous==0.24
jedi==0.10.2
Jinja2==2.8
keyring==10.1
keyrings.alt==1.3
lazy-object-proxy==1.3.1
MarkupSafe==1.1.0
mcpi==0.1.1
microdotphat==0.2.1
mote==0.0.4
motephat==0.0.2
mypy==0.470
numpy==1.16.2
oauthlib==2.0.1
pantilthat==0.0.7
pgzero==1.2
phatbeat==0.1.1
pianohat==0.1.0
picamera==1.13
picraft==1.0
piglow==1.2.5
pigpio==1.38
Pillow==5.4.1
pyasn1==0.1.9
pycairo==1.16.2
pycrypto==2.6.1
pygame==1.9.4.post1
Pygments==2.2.0
PyGObject==3.30.4
pyinotify==0.9.6
PyJWT==1.4.2
pylint==1.6.5
pyOpenSSL==16.2.0
pyperclip==1.5.27
pyserial==3.2.1
python-apt==1.8.4.1
pyxdg==0.25
rainbowhat==0.1.0
requests==2.12.4
requests-oauthlib==0.7.0
roman==2.0.0
RPi.GPIO==0.7.0
RTIMULib==7.2.1
scrollphat==0.0.7
scrollphathd==1.2.1
SecretStorage==2.3.1
sense-emu==1.1
sense-hat==2.2.0
simplejson==3.16.0
six==1.12.0
sixfab-cellulariot==1.2.0
skywriter==0.0.7
sn3218==1.2.7
spidev==3.4
thonny==3.1.0
thonny-pi==1.1
touchphat==0.0.1
twython==3.4.0
typed-ast==1.3.1
unicornhathd==0.0.4
urllib3==1.19.1
Werkzeug==0.11.15
wrapt==1.10.11

Unable to conect via USB and not sending SMS through UART

I am trying to connect the shield via USB but Its not responding is there any extra step for it cause I was not able to find anything. Also I tried sending SMS when connected to GPIO/UART. It is unable to send SMS. The code flow is as follows
sudo python3 Sixfab_RPi_CellularIoT_App_Shield/sample/sendSMS.py

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

RDY

ATE1
ATE1
OK

AT+CMGF=1
AT+CMGF=1
OK

AT+CMGS=""
AT+CMGS="
"

hello world!

AT commands gives no reply, jsut keep on repeating

I have tried to use the sample codes given in sample folder. none of them is working except 'sensor_test.py'
the AT commands repeat themselves on the terminal.
can i use some AT commands without using the sim?

GNSS hangs indefinitely

I'm having problems initialising GNSS on the Hat.

My code is here:

  node = cellulariot.CellularIoTApp()
  node.setupGPIO()
  time.sleep(1)
  node.turnOnGNSS()
  time.sleep(30)
  node.disable()
  time.sleep(1)
  node.enable()

When I interrupt it, the stack trace is here:

  File "src/cosmic_test.py", line 73, in <module>
    main()
  File "src/cosmic_test.py", line 42, in main
    sixfab_sensors.init()
  File "/home/pi/cosmic-pi/src/sixfab_sensors.py", line 10, in init
    node.turnOnGNSS()
  File "/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py", line 421, in turnOnGNSS
  File "/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py", line 206, in sendATComm
  File "/usr/local/lib/python3.7/dist-packages/sixfab_cellulariot-1.2.0-py3.7.egg/cellulariot/cellulariot.py", line 30, in millis

I have the antenna plugged in, I am testing it outside, under cloudless sky and I have a SIM card inserted.

Should I be checking satellite coverage for my area, or is there something else I need to do or a way of checking?

Hat GPIO Conflicts

I'd like to use this modem in conjunction with a PiJuice hat, but I'm running into a conflict on GPIO 17.

It appears that the PiJuice hat relies on GPIO 17 to be 3v3. So, when I run node.enable() this effectively does GPIO.output(17,0), which interrupts the power supply and restarts the Pi.

Do you think there's a way around this? Is there a way to set the modem to use BG96_ENABLE = 18 for example or is that locked in at the hardware level?

sensor_test.py fails

uname -a
Linux raspberrypi 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux

lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 9.8 (stretch)
Release: 9.8
Codename: stretch

python3 sensor_test.py
Traceback (most recent call last):
File "sensor_test.py", line 6, in
from cellulariot import cellulariot
File "/usr/local/lib/python3.5/dist-packages/sixfab_cellulariot-1.2.0-py3.5.egg/cellulariot/cellulariot.py", line 11, in
ImportError: No module named 'RPi'

This may indicate that I did not install cellulariot.py - I believe I obeyed the instructions as written.

Thoughts?

CATM1 enabled and start hangs forever, no response

Following this tutorial, https://www.twilio.com/docs/iot/supersim/getting-started-super-sim-raspberry-pi-sixfab-cellular-iot-hat#appendix-downgrading-the-pi-kernel

When I run the python3 sample/configureCATM1.py command, nothing happens.

The thing runs forever, the blue network light is flashing and everything else seems fine.

Also, my stats on Twilio SuperSim are going up as if something is actually happening.

Screen Shot 2022-11-03 at 1 23 19 PM

I'm never even getting to see the "Waiting time:" prompt or anything else. I live in a crowded US town with great coverage.

Thanks!

Unable to connect with ppp using nb configuration

Hey,i am trying to connect a nb sim supporting IPV4-V6 with the nb configuration but it is not possible.But when i am using GSM configuration for the same sim everything works fine.
Any thoughts?

send (AT+QCFG="band",0,0,80000^M)
expect (OK)
^M
^M
OK
-- got it

send (AT+QCFG="nwscanseq",03,1^M)
expect (OK)
^M
^M
OK
-- got it

send (AT+QCFG="nwscanmode",3,1^M)
expect (OK)
^M
^M
OK
-- got it

send (AT+QCFG="iotopmode",1,1^M)
expect (OK)
^M
^M
OK
-- got it

send (ATI;+CSUB;+CSQ;+COPS?;+CGREG?;&D2^M)
expect (OK)
^M
^M
Quectel^M
BG96^M
Revision: BG96MAR02A07M1G^M
^M
SubEdition: V08^M
^M
+CSQ: 99,99^M
^M
+COPS: 0^M
^M
+CGREG: 0,4^M
^M
OK
-- got it

send (AT+CGDCONT=1,"IPV6","iot",,0,0^M)
expect (OK)
^M
^M
OK
-- got it

send (ATD*99#^M)
expect (CONNECT)
^M
^M
CONNECT
-- got it

Script chat -s -v -f /etc/chatscripts/chat-connect -T iot finished (pid 2171), status = 0x0
Serial connection established.
using channel 9
Using interface ppp0
Connect: ppp0 <--> /dev/ttyS0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xcd525e87> ]
rcvd [LCP ConfReq id=0x18 <asyncmap 0x0> <magic 0x1ef02889> ]
No auth is possible
sent [LCP ConfRej id=0x18 ]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xcd525e87> ]
rcvd [LCP ConfReq id=0x19 <asyncmap 0x0> <magic 0x1ef02889> ]
sent [LCP ConfAck id=0x19 <asyncmap 0x0> <magic 0x1ef02889> ]
sent [LCP EchoReq id=0x0 magic=0xcd525e87]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [LCP DiscReq id=0x1a magic=0x1ef02889]
rcvd [LCP EchoRep id=0x0 magic=0x1ef02889 cd 52 5e 87]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
sent [LCP EchoReq id=0x1 magic=0xcd525e87]
rcvd [LCP EchoRep id=0x1 magic=0x1ef02889 cd 52 5e 87]
IPCP: timeout sending Config-Requests
sent [LCP TermReq id=0x2 "No network protocols running"]
rcvd [LCP TermAck id=0x2]
Connection terminated.
abort on (ERROR)
abort on (NO DIALTONE)

Sending break to the modem
send (+++^M)
send (+++^M)
send (+++^M)

Goodbye
Script chat -s -v -f /etc/chatscripts/chat-disconnect finished (pid 2915), status = 0x0
Serial link disconnected.

Not possible connect Sixfab IoT shield to raspberry pi through serial port

Hello,

I have since October 2018 a Sixfab IoT shield. I have been able to connect shield to raspberry pi with PPP, and get IP adress in Rasapberry Pi, being able to control remotely a robot connected to this raspberry pi through Sixfab shield. I am able to read with python sensors in shield, but when I try to send AT commands from raspberry pi using python to IoT shield to get RSRP, I am getting an error like one below:

from cellulariot import cellulariot
import time
node = cellulariot.CellularIoT()
Sixfab Cellular IoT Hat Class initialized!
node.sendATComm("ATE1","OK\r\n")
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)
OSError: [Errno 16] Device or resource busy: '/dev/ttyS0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.5/dist-packages/sixfab_cellulariot-1.0-py3.5.egg/cellulariot/cellulariot.py", line 152, in sendATComm
File "/usr/local/lib/python3.5/dist-packages/sixfab_cellulariot-1.0-py3.5.egg/cellulariot/cellulariot.py", line 142, 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 16] could not open port /dev/ttyS0: [Errno 16] Device or resource busy: '/dev/ttyS0'

quit(9
... quit()
File "", line 2
quit()
^
SyntaxError: invalid syntax

Now I am trying to connect Sixfab with Raspberry Pi through USB cable, using usb connection in IoT shield, and one out of four usb ports in raspberry pi, but I do not know how to get usb port in /dev directory of raspberry pi. I am able to connect IoT shield to windows computer through usb cable, and opening a putty serial console I can reach serial port of IoT shield and send AT commands and receive results from IoT shield. At this point I have connected Iot shield with raspberry pi only through usb cable, without insert Iot shield on 40 pins connection of raspberry pi.

I guess that I need drivers in raspberry pi in order to permit to Pi read serial port through usb, but following PDF Quectel_WCDMA&LTE_Linux_USB_Driver_User_Guide_V1.8.pdf is confusing for me since I do not know how to download kernel files.

Please, could you give me some clue about how to follow with this config and be able to connect Pi and Shield through usb serial cable?

Thank you for your help and best regards
Oscar

How to receive data from shield to raspberry pi

Hi,

I have modified code little bit to send and receive messages from the shield on MQTT, connecting to MQTT server and publish the data from the shield is working perfectly but when it comes to receiving the data from the network then the shield does not give the data to the raspberry pi via URC.

I can trace inside network i can see the MQTT publish message send from MQTT server to the modem but nothing comes on the URC.

When i connect the shield directly via Qnavigator and use AT commands to subscribe then i can see the data is displayed on the Qnavigator as shown below.

I just want to know whether the configuration are correct via the python code to receive the data on URC?

[2019-05-06 15:45:17:565_R:] OK
[2019-05-06 15:45:27:674_S:] AT+QPING=1,"8.8.8.8"
[2019-05-06 15:45:27:705_R:] AT+QPING=1,"8.8.8.8"

[2019-05-06 15:45:27:705_R:] OK

[2019-05-06 15:45:28:846_R:] +QPING: 0,"8.8.8.8",32,1131,255

[2019-05-06 15:45:29:002_R:] +QPING: 0,"8.8.8.8",32,147,255

[2019-05-06 15:45:29:159_R:] +QPING: 0,"8.8.8.8",32,160,255

[2019-05-06 15:45:29:315_R:] +QPING: 0,"8.8.8.8",32,160,255

[2019-05-06 15:45:29:346_R:] +QPING: 0,4,4,0,147,1131,399
[2019-05-06 15:45:51:033_S:] AT+QMTOPEN=1,"XXX.server.com",1883
[2019-05-06 15:45:51:080_R:] AT+QMTOPEN=1,"XXX.server.com",1883

[2019-05-06 15:45:51:080_R:] OK

[2019-05-06 15:45:57:783_R:] DSR:0 CTS:0 (RI:1) DCD:0

[2019-05-06 15:45:57:815_R:] +QMTOPEN: 1,0

[2019-05-06 15:45:57:861_R:] DSR:0 CTS:0 (RI:0) DCD:0
[2019-05-06 15:46:15:550_S:] AT+QMTCONN=1,"vbshr1z3pf77","USERNAME","password"
[2019-05-06 15:46:15:596_R:] AT+QMTCONN=1,"vbshr1z3pf77","USERNAME","password"

[2019-05-06 15:46:15:596_R:] OK

[2019-05-06 15:46:16:487_R:] +QMTCONN: 1,0,0
[2019-05-06 15:47:14:127_S:] AT+QMTSUB=1,1,"vbshr1z3pf77/866425030617007/temp/0/sensrovalue",0
[2019-05-06 15:47:14:205_R:] AT+QMTSUB=1,1,"vbshr1z3pf77/866425030617007/temp/0/sensrovalue",0

[2019-05-06 15:47:14:205_R:] OK

[2019-05-06 15:47:15:174_R:] +QMTSUB: 1,1,0,0

[2019-05-06 15:47:15:174_R:] DSR:0 CTS:0 (RI:1) DCD:0

[2019-05-06 15:47:15:299_R:] DSR:0 CTS:0 (RI:0) DCD:0

[2019-05-06 15:49:14:565_R:] +QMTRECV: 1,0,"vbshr1z3pf77/866425030617007/temp/0/sensrovalue","1"

[2019-05-06 15:51:15:084_R:] DSR:0 CTS:0 (RI:1) DCD:0

[2019-05-06 15:51:15:112_R:] +QMTRECV: 1,0,"vbshr1z3pf77/866425030617007/temp/0/sensrovalue","10"

[2019-05-06 15:51:15:206_R:] DSR:0 CTS:0 (RI:0) DCD:0

[2019-05-06 15:51:15:486_R:] +QMTRECV: 1,0,"vbshr1z3pf77/866425030617007/temp/0/sensrovalue","10"

[2019-05-06 15:51:15:502_R:] DSR:0 CTS:0 (RI:1) DCD:0

[2019-05-06 15:51:15:627_R:] DSR:0 CTS:0 (RI:0) DCD:0

[2019-05-06 15:53:14:112_R:] DSR:0 CTS:0 (RI:1) DCD:0
~~~~~~~~~~~~~QNAVIGATOR~~~~~~~~~~~~~~~~~~~~~~~~~~~


Below is the code and output of the messages.

pi@raspberrypi:~/boom/Sixfab_RPi_CellularIoT_Library $ python3 sample/basicUDP.py 
Sixfab Raspberry Pi Cellular IoT Application Shield Class initialized!
BG96 module disabled!
BG96 module enabled!
BG96 module powered up!
ATE0
ATE0
ATE0
OK

AT+CGSN

XXXXXXXXX

OK

AT+CGMR

BG96MAR02A07M1G

OK

AT+CGMM

BG96

OK

AT+QCFG="band",0,0,80

OK

AT+QCFG="band"

+QCFG: "band",0xf,0x400a0e189f,0x80

OK

AT+QCFG="nwscanseq",03,1

OK

AT+QCFG="nwscanmode",3,1

OK

AT+QCFG="iotopmode",1,1

OK

Modem configuration : CATNB1_MODE ( NB-IoT )
Trying to connect base station of operator...
AT+CGATT?
AT+CGATT?
AT+CGATT?
AT+CGATT?

+CGATT: 1

OK

AT+CSQ

+CSQ: 17,99

OK

AT+CSQ

+CSQ: 17,99

OK

AT+QNWINFO

+QNWINFO: "CAT-NB1","52508","LTE BAND 8",3518

OK

AT+QMTCFG="version"1,3

+QMTCFG: "version",3

OK

AT+QMTCFG="pdpcid",1,1

OK

AT+QMTCFG="keepalive",1,150

OK

AT+QMTCFG="session",1,0

OK

AT+QMTOPEN=1,"xxx.server.com",1883

+QMTOPEN: 1,0

AT+QMTCONN=1,"yajuvendra_mqtt_client","USERNAME","PASSWORD_123"

OK

AT+QMTSUB=1,1,"vbshr1z3pf77/866425030617007/temp/0/sensrovalue",1
AT+QMTSUB=1,1,"vbshr1z3pf77/866425030617007/temp/0/sensrovalue",1
AT+QMTSUB=1,1,"vbshr1z3pf77/866425030617007/temp/0/sensrovalue",1

+QMTSUB: 1,1,0,1

ATE0

OK

^CTraceback (most recent call last):
  File "sample/basicUDP.py", line 68, in <module>
    node.getResponse("QMTRECV")
  File "/usr/local/lib/python3.5/dist-packages/sixfab_cellulariot-1.2.0-py3.5.egg/cellulariot/cellulariot.py", line 131, in getResponse
  File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 572, in inWaiting
    return self.in_waiting
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 456, in in_waiting
    s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
KeyboardInterrupt
pi@raspberrypi:~/boom/Sixfab_RPi_CellularIoT_Library $


also below is the code 

pi@raspberrypi:~/boom/Sixfab_RPi_CellularIoT_Library $ cat sample/basicUDP.py 
'''
  basicUDP.py - This is basic UDP example.
  Created by Yasin Kaya (selengalp), August 28, 2018.
'''
from cellulariot import cellulariot
import time

your_ip = "xx.xx.xx.xx" # change with your ip
your_port = "xxxx" # change with your port

#node = cellulariot.CellularIoT() # for Sixfab CellularIoT HAT
node = cellulariot.CellularIoTApp() # for Sixfab CellularIoT App. Shield
node.setupGPIO()

node.disable()
time.sleep(1)
node.enable()
time.sleep(1)
node.powerUp()

node.sendATComm("ATE0","OK\r\n")

node.getIMEI()
time.sleep(0.5)
node.getFirmwareInfo()
time.sleep(0.5)
node.getHardwareInfo()
time.sleep(0.5)

#node.setIPAddress(your_ip)
#time.sleep(0.5)
#node.setPort(your_port)
#time.sleep(0.5)

node.setNBIoTBand(node.LTE_B8)
time.sleep(0.5)
node.getBandConfiguration()
time.sleep(0.5)  
node.setMode(node.CATNB1_MODE)
time.sleep(0.5)

node.connectToOperator()
time.sleep(0.5)
node.getSignalQuality()
time.sleep(0.5)
node.getQueryNetworkInfo()
time.sleep(0.5)

node.getIPAddress()
time.sleep(0.5)

#node.deactivateContext()
#time.sleep(0.5)
#node.activateContext()
#time.sleep(0.5)

node.SetMQTTConfigureParameters()
time.sleep(0.5)
node.OpenMQTTNetwork("xxx.server.com", 1883)
time.sleep(0.5)
node.CreateMQTTClient("yajuvendra_mqtt_client","USERNAME","PASSWORD=")
time.sleep(0.5)
delim=","
#node.MQTTPublishMessages(str(node.readTemp()),str(node.readHum()),str(node.readLux()),delim)
time.sleep(0.5)
node.MQTTSubscribeMessages()

node.getResponse("QMTRECV")



#node.closeConnection()
#time.sleep(0.5)
#node.startUDPService()
#time.sleep(0.5)

#node.sendDataUDP("Hello World!\r\n")
#time.sleep(0.5)
pi@raspberrypi:~/boom/Sixfab_RPi_CellularIoT_Library $




br..
Yaju

ppp installer

Hi,

@saeedjohar I am using this shield with RPI3 and not able to configure vodafone ireland normal sim for cellular internet using the ppp installer.

Also, the results from the samples here are also inconsistent.

Am i missing something ?

thanks,
Abhijeet

PPP installed but drops connection after a disconnect and does not reconnect unless restarted

Hi there,

I am running an IOT device using this PI hat, https://sixfab.com/product/raspberry-pi-lte-m-nb-iot-egprs-cellular-hat/

I have installed and everything works fine, but a stage issue, whenever the connection drops (Due to bad network usually) It does not reconnect to my LTE network. A quick restart fixes the issue, but I want the device to be running a script with LTE always ON and if it loses connection should try to reconnect, but the interface just drops unless I restart the PI.

I used the following instructions to install :
https://sixfab.com/ppp-installer-for-sixfab-shield-hat/

Any idea why this could be happening?

https://community.sixfab.com/t/ppp-installed-but-drops-connection-after-a-disconnect-and-does-not-reconnect-unless-restarted/565

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.