Raspberry PI USB Vs SERIAL Communication With Gsm Shield (itbrainpower.net A-gsm Shield)

7.7K184

Intro: Raspberry PI USB Vs SERIAL Communication With Gsm Shield (itbrainpower.net A-gsm Shield)

About this how to

This how to refers to the itbrainpower.net a-gsm shield, having following main features:

  • Worldwide compatibility - quad band module
  • GSM / GPRS / SMS / DTMF supported
  • Two SIM sockets (single SIM active)
  • combo Integrated GSM antenna and uFL connector for external antenna (as standard)
  • Integrated uSD(TF) socket
  • Micro-USB interface for communication and powering
  • 3-5V serial interface (auto)
  • 5-38V wide voltage switching power supply
  • ARDUINO & RASPERRY PI direct compatibility
  • Windows and Linux PC connectivity
  • Audio jacks (high power audio out-700 mW RMS, in- capacitor MIC)
  • Ideal for small-medium series gadget / project integration

More about a-gsm shield >> presentation and features, documentation and more.

RaspberryPI and a-gsm shield can communicate together in TWO ways: using the RPI serial port (TXD0 + RXD0) or via the USB connection. The second one is quite useful when the RPI serial port it is not available (Eg. it's designated to support serial communication with other shields). IMPORTANT: This tutorial it's based on RPI B/RPI B+/RPI2 usage, but can be easy ported to RPI A or RPI A+ or RPI Zero. You must identify the RPI A pin configuration. For RPI Zero you can use the same pin-out as for RPI B+/RPI2 model B.

See in picture up there, the top picture off a-gsm shield with details description.

What you will need
  • Raspberry PI model B+ or Raspberry PI2 model B (Raspberry PI A+ can be used. You must hack the wiring. Also RPI ZERO can be used!) 1 pcs http://raspberrypi.org
  • power supply for Raspberry PI 1 pcs
  • a-gsm shield v2.064 1 pcs. a-gsm shield distributors
  • GSM (2G) SIM card, for a-gsm 1 pcs
  • optional (read bellow) power supply for the a-gsm shield (5V, ~1A... any decent Android phone/iPhone power adapter with uUSB type B connector) or external 6->38V, ~1A(recommended) for powering via a-gsm pin Vin 1 pcs
  • USB cable and connection wires
General considerations and references

All shell commands must be run as root or using roots right. "sudo your_command"

STEP 1: Wiring (logical and Powering) Reference

The drawings up here may be used as general wiring guidelines, but in order to chose your final configuration you must read the sections bellow.

IMPORTANT! Mandatory for RPi serial for connection with a-gsm (you can skip this for USB connection usage).

You may like to have available the RPI serial line >> use vi or mcedit or any other editor at your convenience. Comment last "/etc/inittab" line:
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

then, reboot your RPi: "reboot" or "restart now".

STEP 2: SERIAL Wiring for Raspberry PI and A-gsm Shield * Serial, Power and Modem Control (logical)

RPI a-gsm shield serial and modem control description

can be seen in picture up-there

POWER using via a-gsm Vin PIN for serial connection

You can use any good quality external power adapter providing a voltage between 5.125V and 38V and supporting a current bigger than 1 A. Connect spare GND PIN located on "Arduino power in connector" on a-gsm shield with the GND pin on your external power adapter. Connect the Vin PIN located on "Arduino power in connector" on a-gsm shield with the Vout pin on your external power adapter. The a-gsm's POWER supply input selector must be in "use Vin" position.

Power via USB variant for serial connection

Power the a-gsm board over USB, using a good quality power adaptor (eg. your Arduino/iPhone power adapter). The a-gsm's POWER supply input selector must be in "use USB" position.

Power using the RPI 5V PIN for serial connection

Connect PIN 02/04 on Raspberry PI B+ extension connector with 5V PIN on "Arduino power in connector" on a-gsm shield. The a-gsm's POWER supply input selector must be in "use 5V" position.

IMPORTANT!!! The RPI power supply adapter must be rated for a minimum 2A sustained load without decrease supplied voltage under 5.05-5.10 V, in order to cover powering need for both boards regardless application, location, time...

STEP 3: USB Wiring for Raspberry PI and A-gsm Shield * Serial, Power and Modem Control (logical)

Power using via a-gsm Vin PIN for USB connection

You can use any good quality external power adapter providing a voltage between 5.125V and 38V and supporting a current bigger than 1 A. Connect spare GND PIN located on "Arduino power in connector" on a-gsm shield with the GND pin on your external power adapter. Connect the Vin PIN located on "Arduino power in connector" on a-gsm shield with the Vout pin on your external power adapter. The a-gsm's POWER supply input selector must be in "use Vin" position.

Power via USB variant for USB connection

YOU MUST use a special USB Y adapter cable! Power the a-gsm board over USB, using a good quality power adaptor (eg. your Arduino/iPhone power adaptor), using "POWER ONLY" end of your USB Y adapter cable. The "DATA ONLY" end of your USB Y adapter cable, must be connected to any RPI USB port. The a-gsm's POWER supply input selector must be in "use USB" position.

Power using the RPI 5V PIN for USB connection

Connect PIN 02/04 on Raspberry PI B+ extension connector with 5V PIN on "Arduino power in connector" on a-gsm shield. The a-gsm's POWER supply input selector must be in "use 5V" position.


WARNING: Regardless the powering schema variant chosen, be sure than you check twice the wiring and be warned regarding the GROUND possible voltage differences(when use external power adapter), before you power the RPI a-gsm bundle. RPI a-gsm USB connection, software setup considerations

USB connectivity has been tested using 2015-02-16-raspbian-wheezy on RPI2

After USB cabling you will notice in the /var/syslog:

... 
raspberrypi kernel: [ 2481.862240] usb 1-1.3: cp210x converter now attached to ttyUSB0

In our Python example files (can be downloaded from here - your email address and the modem IMEI are required) and in your custom Python files, you must set:

agsm = serial.Serial("/dev/ttyUSB0", serialSpeed, timeout=1) 

instead of

agsm = serial.Serial("/dev/ttyAMA0", serialSpeed, timeout=1)		

We suggest to you to use the newest RASPBIAN versions https://www.raspberrypi.org/downloads/. As backup, if something goes wrong, you can still use the 2015-02-16 version, used by us for testing. You can download it from here: http://itbrainpower.net/a-gsm/downloadables/2015-...

That's all you need in order to be able to use directly the Raspberry PI and a-gsm shield with communication via USB.

The a-gsm shield can be ordered online via itbrainpower.net distributors.

Originally published by me in 2015, on itbrainpower.net projects and how to section.

4 Comments

can raspberry pi 3 B power the gsm module alone?

Hello,

We must take into account the fact that the gsm shield consumption it is dependent on the network condition (signal/band) and to the usage mode (Searching/Registration/Registered/Calling/Voice-including the RX volume/DTMF/SMS/DATA).... sometimes, may happen to need more current than RPI3 module can provide from 5V pin.

In order to be on the safe side, I recommend to power RPI3/2/any other Linux board and the a-gsm in STAR/parallel mode.

Alternatives:

a. use our c-uGSM / h-nanoGSM or d-u3G modular shields (all having USB/serial connection capabilities) in Lithium Polymer/super-capacitor configuration instead the a-gsm module. You can see how to connect them with RPI3 in our how to/projects area: http://itbrainpower.net/a-gsm/gsm-shield-Arduino-R...

b. You may check by soldering one >4700-1000uF/ >5V or one super-capacitor / 5V bw. GND and modem's 4V supply. Avoiding the pulse consumption in this way, the RPI and the modem can run on the safe side.

Dragos

Hello,

First of all thanks for the detailed explanation. However, could you please let me know if this GSM module supports 3G internet connection or not?

Kind regards,

Fatih

Hi Fatih,
The a-gsm shield it is 2G (GSM) only. If you need 3G communication, you can use our d-u3G modular modem. d-u3G has very same SERIAL and USB connectivity support for Raspberry PI (including Raspberry PI3) and other ARM Linux boards.
More information about d-u3G shield, other modular shields and associated accessories/adapters can be found on our site (check the how to and project area, also).

Kind regards,
Dragos