Thales' cellular IoT products business is now part of Telit Cinterion, find out more.

You are here

Telit Cinterion IoT Developer Community

Using Connect Shield with Raspberry Pi

Tutorial, February 16, 2017 - 12:32pm, 15477 views

Just recieved the Cinterion® Connect Shield today. I found it provides "ON/OFF" pin so it's possible to control ELS61 boot from a embedded system. This inspires me to test it on a Raspberry Pi (RPi).

Cinterion® Connect Shield

The hardward part is easy, just use a male-to-female jumper leads to connect the "ON/OFF" pin on the Connect Shield to a GPIO on RPi, and an USB cable to connect with each other. I choose GPIO25 for toggling the "ON/OFF" pin.

The finished product will look like this, but still need some minor scripting to configure/setup the Connect Shield.

RPi with Connect Shield

Here I utilize my previous work for a Wi-Fi Hotspot router project, I copied the chat script used to configure ELS61 WAN port, and stored them to "/etc/chatscripts/els61-eth-on.chat" and "/etc/chatscripts/els61-off.chat".

The content of /etc/chatscripts/els61-eth-on.chat is 

TIMEOUT 60
READY-AT\r\n-OK At+CPIN?\r\n
READY-AT+CPIN=0000\r\n-OK ""
OK AT+CGDCONT?\r\n
IP-AT+CGDCONT=1,"IP","INTERNET"\r\n-OK ""
OK AT+CFUN?\r\n
1,0-AT+CFUN=1\r\n-OK ""
OK AT+CMEE=2\r\n
OK AT+COPS?\r\n
0,0-AT+COPS=0\r\n-OK-AT+COPS=0\r\n-OK ""
OK AT+CSQ\r\n
OK AT\^SWWAN=1,1\r\n
OK AT+CGPADDR\r\n
OK 

The content of /etc/chatscripts/els61-off.chat is

SAY "Turn-off Cinterion Modem"
"" AT\^SMSO\r\n
OK  

And the setup for corresponding WAN port interface for Raspbian is

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet dhcp
  pre-up /usr/sbin/chat -f /etc/chatscripts/els61-eth-on.chat -v  < /dev/ttyACM0 > /dev/ttyACM0
  down /usr/sbin/chat -f /etc/chatscripts/els61-off.chat -v < /dev/ttyACM0 > /dev/ttyACM0

allow-hotplug wlan0
iface wlan0 inet static
  address 192.168.42.1
  netmask 255.255.255.0
  post-up iw dev $IFACE set power_save off 

To turn-on the Connect Shield, one can use a simple python script to toggle the GPIO 25. Here is how I do it and you can store this script in /usr/local/bin/els61_on.py on the RPi

#!/usr/bin/python

from gpiozero import LED
from time import sleep

els61 = LED(25)

print "Turn-on ELS61..."
els61.on()
sleep(1)
els61.off() 

Please remember to use "sudo chmod +x /usr/local/bin/els61_on.py" to mark it as runnable.

You can then put a line on the /etc/rc.local to to call this script and trigger ELS61 booting up with the RPi, or add a service file to Raspbian's /etc/systemd/system/ directory to autorun the python script on boot using systemd. Here is the content of my /etc/systemd/system/els61-on.service

[Unit]
Description=Turn On ELS61
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/local/bin/els61_on.py
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target 

The permission of the file ***** to be set to 644:

sudo chmod 644 /lib/systemd/system/els61-on.service 

Now you can configure the systemd to start it during the boot sequence:

sudo systemctl daemon-reload
sudo systemctl enable els61-on.service 

Reboot the Pi and your custom service should run :

sudo reboot -h now 

After RPi booted up, you can check the status of your service using :

sudo systemctl status els61-on.service 

Or checking the LED on Connect Shield, if it gives off *** brightness, it's booted-up.

You can use ifconfig to check if eth1 get an IP or not, if everything is OK, you should see similar result:

eth1      Link encap:Ethernet  HWaddr 00:00:11:12:13:14  
          inet addr:10.35.106.133  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::2c06:6943:11d5:c018/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2955 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5658 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:813771 (794.6 KiB)  TX bytes:503643 (491.8 KiB) 

Now your RPi 4G CAT1 connection is ready to use.

RPi with 4G CAT1 connection

Hi,

How did you receive it when it is not available on Gemalto webstore?

Regards, -Mikkel

The ordering code for Connect Shield is : L30960-N5200-A100

You can contact local Gemalto sales with this order code to buy it.

Best Regards,
Antony Shen

Hi Anthony,

I have received a connect shield today. The first step is to download installation package from developer.gemalto.com but I can't find any link? Can you help :-) Looking forward to share my work with the community.

Regards, -Mikkel

Hi Mikkel,

Because I used it on Raspberry Pi, which is running Linux, and is capable enough to drive the ELS61, so I didn't try to download the installation package.

Best Regards,
Antony Shen

Hi Mikkel,

did you get the installation package?
We had some issues with the upload now it's available.
https://iot-developer.thalesgroup.com/documentation/cinterion%C2%AE-conn...

Let us know if you need something more! 

Hi Antony,

Thanks for the great tutorial.  I purchased the Cinterrion Concept Board based on EHS6 ME to provide GPRS (3G) connection to Raspberry PI 3 via USB connection. Then I will connected another PLC to Raspberry PI  with ethernet cable so that PLC will connect to the internet via Raspberry PI 3 and the Concept board. So far no luck.

I followed your tutorial. But the EHS6 doesn't have AT\^SWWAN=1 command. I also can't change the PIN of sim card with AT+CPIN=0000 command.

Could you please help? I would really appreciate that!!!

Thank and Regards,e

Eric.

Hi Eric,

The AT^SWWAN command is relatively new in the product portfolio. It is used to tell the Cinterion 4G module which APN (from AT+CGDCONT=1,"IP","SIMs_APN_HERE") to use with the 4G module's Wireless Ethernet interface(s).

So to use this project, on older 2G / 3G only modules, you can do the following:

1. Ensure that your Raspberry Pi has the pppd chat utility installed:
$ sudo apt update
$ sudo apt install ppp

2. Modify /etc/chatscripts/els61-eth-on.chat (in this example the APN is called "INTERNET"):

ABORT   BUSY
ABORT   'NO CARRIER'
ABORT   ERROR
REPORT  CONNECT
TIMEOUT 10
""      "AT&F"
OK      "ATE1"
OK      'AT+CGDCONT=2,"IP","INTERNET"'
SAY     "Calling UMTS/GPRS"
TIMEOUT 30
OK      "ATD*99***2#"
CONNECT ' '                           

Here we define the APN "INTERNET" in PDP CID #2:
OK      'AT+CGDCONT=2,"IP","INTERNET"'

and then ask the Raspberry Pi to make a PPP connection to the module, using that APN defined in CID #2:
OK      "ATD*99***2#"

Finally, you can't change the SIM card's PIN with AT+CPIN. AT+CPIN is used to only temporarily use a locked SIM. Be warned if you get this wrong, more than 3 *****, then the SIM will most likely be locked and require a PUK/PUK2 to unlock it. Therefore I am not a big fan of automated scripts issuing SIM PIN commands.

To permanently control SIM PIN lock status itself, please see our AT Command AT+CLCK="SC" an example of its use is here:
AT+CPIN?              // ask if SIM PIN lock is enabled
AT+CPIN="1234"  // if not "READY" above enter the SIM PIN
AT+CLCK="SC",0,"1234" // disable the SIM PIN lock forever

It is good that you have shared the picture of this Connect Shield here. The picture shared here and marking important parts really help me to understand about it. I wish to know more details regarding this. Can you update it soon? shot glasses

Author

antonyshen's picture
antonyshen