5G Edge ThingSpace Tutorial
In this tutorial, you connect a CAT-M1 LTE-enabled IoT device to a 5G Edge API server on an Amazon EC2® instance in the Boston Wavelength Zone (us-east-1-wl1-bos-wlz-1). To build this tutorial, you will require a Verizon ThingSpace account for your IoT connectivity plan, the IoT device from our ThingSpace Marketplace, a Raspberry Pi® 4 device and an active Amazon Web Services® (AWS® ) account. First, make sure your AWS account has Wavelength Zones enabled. If you have not submitted your request to get access, please complete the sign-up form . Next, purchase your and ensure that you have a compatible with the latest Raspberry Pi OS (32-bit),After purchasing the Raspberry Pi 4, make sure you have a USB-C charger (i.e. same as MacBook Pro 2017+) to power the device. You will also need a which includes everything you need—including the LTE module— to plug directly onto the Raspberry Pi board,While you wait for shipment, visit the to activate your SIM card with a monthly data plan of your choice. Note: Since you already have a Verizon-certified SIM in your Monarch Go, you will need the and values on the module (see white sticker attached to Monarch Go module),Upon shipment(s) arrival, follow the Raspberry Pi to boot the OS and then attach the Monarch Go Pi Hat to the board. For more information on configuring your board, visit a step-by-step guide from the Avnet team,Plug your SD card into your laptop (you may need an SD-card-to-), and then navigate to the boot directory on the SD card (),Download from the package manager:,sudo apt-get install vim,Create an empty file named SSH in the boot directory of the SD card (vim SSH),Create a new file named which tells the Raspberry Pi how to connect to your Wi-Fi network to enable a headless boot. Be sure to edit the and with your Wi-Fi network name and its corresponding password:,country=US ctrlinterface=DIR=/var/run/wpasupplicant GROUP=netdev updateconfig=1 network={ scanssid=1 ssid=yourwifissid psk=yourwifipassword },Edit the file to change the console universal asynchronous transmitter/receiver (UART) from primary UART to secondary UART (serial1), which the Monarch Go Pi Hat requires. Within that first line, change console=serial0 to . After this step, eject the SD card from your laptop and plug it back into your Raspberry Pi,Use the native ARP protocol () to find the address of your Pi on your local network. Alternatively, you can leverage () to get the IP address if connected to your Wi-Fi network,Upon retrieving the address of your Pi, ssh into the board. Remember to supply the default password of,ssh pi@,Open the Raspberry Pi configuration page,sudo raspi-config,Select Serial 5,At the prompt Would you like a login shell to be accessible over serial? answer,At the prompt Would you like the serial port hardware to be enabled? answer,Select to exit, and to reboot the Raspberry Pi,After rebooting, ssh into your Raspberry Pi as you did earlier. To get started, download the minicom package, which is a text-based modem control and terminal emulator program:Next, configure the general-purpose input/output (GPIO) pins on your board, which adjusts the RTS/CTS signals you need for the Monarch Go to communicate over LTE:,echo 17 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio17/direction echo 0 > /sys/class/gpio/gpio17/value echo 16 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio16/direction,Establish the communication to the modem using minicom:,minicom --device /dev/serial0,Now that you have direct communication to the modem, verify that you can connect to the modem and that the modem can connect to the LTE network. Run the command and you should see an output generated that looks something like this:,+CEREG: 2,1 150B,00539391,7,Exit minicom,To communicate over LTE, you need to enable the point-to-point (PPP) protocol by downloading the package () and adding a few additional files,Add a new file titled with the following text, which creates the PPP network interface connection:,auto ppp0 iface ppp0 inet ppp provider sequans,Next, we need to create a new file named in the /etc/ppp/peers/ folder with the following contents:,/dev/serial0 115200 crtscts -chap pppd by debug defaultroute which pppd dump local lock noauth nodetach noipdefault usepeerdns connect /usr/sbin/chat -t6 -f /etc/chatscripts/connect disconnect /usr/sbin/chat -t6 -f /etc/chatscripts/disconnect,Next, add a new file in the /etc/chatscripts/ directory that provides the AT commands for the connect chatscript. Then, add a new file in the /etc/chatscripts/ directory that provides the AT commands for the connect chatscript:,#connect TIMEOUT 30 ABORT ERROR AT OK AT+CGDATA=PPP,3 CONNECT #disconnect # This is the chat script used to hang up the Sequans Module # \d\d\d+\c,Edit the file and add the line auto ppp0 to the end of the file,To configure ppp0 as the default network, find the IP address of the ppp0 interface. The correct IP address will be the one with the Iface column indicating that it is of type ppp0 (not wlan0),With the IP address of the pp0 interface, add the IP to the default route to your gateway:,sudo route add default gw XXX.XXX.XX.X netstat -rn,Your Raspberry Pi will now connect, by default, to the LTE modem,To communicate to 5G Edge, you'll need to enable a Wavelength Zone in a public subnet within a virtual private cloud (VPC), attach a carrier gateway to the subnet, launch an EC2 instance, allocate a carrier IP address to our EC2 and run a Flask server to accept incoming HTTP traffic. To provision your 5G Edge infrastructure, you'll need the AWS CLI version 2 installed on your local machine. To launch an EC2 instance in a Wavelength Zone of your choice, view this using the CLI,After configuring your infrastructure, ssh into the EC2 instance in the Wavelength Zone and open a new file to accept GET request traffic over the test endpoint:,from flask import Flask, jsonify app=Flask(name) @app.route(/test,methods=[GET]) def getTest(): return Hello from 5G Edge! if name=='main': app.run(host=0.0.0.0),Run the API server and terminate the session:,nohup python api.py &,sudo apt update sudo apt install python3 python import requests r=requests.get(http://,Congratulations, your Hello World! application using ThingSpace and 5G Edge is complete!,These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information. These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. We use both third party and first party cookies for this purpose. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance. These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly. These cookies may be set through our site by Verizon and third parties. They are used to present Verizon advertising on third party sites that you may visit. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising from Verizon. BackClear Filters,All Consent Allowed
Learn more