Introduction: Add 3G to the Raspberry Pi: PiloT Tutorial

The following instructions are based on use of Raspbian Jessie OS.

The PiIoT is a WAN communications board which provides a 3G / HSPA wireless interface for the Raspberry Pi.

For purchase information or product details and specifications, visit the official PiloT product page here.

Before you begin this tutorial, please click here to ensure your PiloT is correctly mounted on the Raspberry Pi by following the assembly instructions.

Step 1: Install Minicom Using the Following Code:

sudo apt-get install minicom

To redirect the system console and stop login prompts being sent over the serial port, enter:

sudo raspi-config

Then go to Advanced options > Serial > answer 'No' > click 'OK'

Tap to finish

Click 'Yes' to reboot

Tap the right arrow twice and press 'enter' to finish.

Step 2: PiloT Power Supply Control

The PiloT power supply is controlled by a Raspberry Pi IO pin. A logic “1” output enables a power supply regulator which supplies the PiloT with power. Note that the regulator may switch on by default when power is applied to the Raspberry Pi.

Step 3: PiloT HL Module ON/OFF Control

The PiloT module ON pin is used to turn on the HL module’s internal power supply.

The PiloT module ON pin is GPIO21 on the Raspberry Pi. The HL module will automatically power on when the PiloT power supply powers on. Once the module is powered off, the ON pin will need to be pulsed to turn the module back on again. To power on, insert the following commands:

gpio –g mode 6 out

gpio –g write 6 1

gpio –g mode 21 out

gpio –g write 21 1

gpio –g write 21 0

Step 4: Connecting to the PiloT Via a UART Port

To enable handshaking on the serial port, enter the following commands:

gpio –g mode 16 ALT3

gpio –g mode 17 ALT3

You are now able to use AT commands to communicate with the HL module on the PiloT.

For a full list of AT commands for the Sierra Wireless HL modules, visit the Source. To use AT commands, open a Minicom session by entering the following:

minicom –D /dev/ttyAMA0

Check the AT commands are working by typing ‘AT’ and pressing enter.

This should return ‘OK’.

Exit Minicom (Ctrl A then X > enter).

Step 5: Connecting Via USB

USB interface provides several USB endpoints to the Raspberry Pi. These can be set using the AT+USBCOMP command. Serial endpoints can be seen by typing the following:

ls /dev/ttyACM*

This should show USB serial endpoints, as shown in the image above.

A serial session can be instigated using the command below:

minicom –D /dev/ttyACM0

Step 6: Using IP

Using Minicom, enter the following command, which changes the USB end points to provide a CDC ECM interface:

AT+KUSBCOMP=2

Close Minicom (Ctrl A then X > enter), then power cycle the Raspberry Pi by removing and reinserting the power cable.


Within a Raspberry Pi shell session, enter the following command:

ls /dev/ttyA*

This should show ACM0 end points, as seen in the picture above.


Type:

ifconfig

A new Ethernet device should appear in the reported list. On a Raspberry Pi 2, this should be ‘eth1’.

Edit the interface configuration file:

sudo nano /etc/network/interfaces

Change or add the entry for eth1 as follows:

#auto eth1

#allow-hotplug eth1

iface eth1 inet dhcp

pre-up ifconfig $IFACE down

dns-nameservers 8.8.8.8 8.8.4.4

Save the file by holding Ctrl A + X

Press ‘Y’ Then ‘enter’.

Configure the HL8 bearer APN by opening a Minicom session to/dev/ttyAMA0 or /dev/ttyACM0, then entering the following command using the appropriate APN according to your selected network:

AT+CGDCONT=1,“IP”,“Access Point Name”

Configure the APN username and password:

AT+WPPP=1,1,“username”,“password”

Configure dynamic DNS request:

AT+XDNS=1,1

To start an IP session:

AT+XCEDATA=1,0

To stop an IP session:

AT+CGACT=0,1

Step 7: Power Off

To power off the PiloT, open a Minicom session with /dev/ttyAMA0 or /dev/ttyACM0.

Power off by entering the following command:

at+cpof

Step 8: Using GPS

If you have the HL8548-G variant of the PiloT, you are able to access location and time information using the PiloT's on-board GNSS solution.

For instructions on how to use the GPS function, click here.

Comments

author
Swansong (author)2017-04-24

Thanks for sharing :)