Cellular connected IoT robot with Lego EV3, Linux Network Manager, and Huawei cellular dongle

Successfully connected Huawei MS2131 Dongle

Successfully connected Huawei MS2131 Dongle

 

Following up on our previous article describing how to get up and running with LEGO EV3 and Cellular connectivity, I reached out again to David from the ev3dev team to see if we could go with a more permanent integration of 3G Dongle support.

Thanks to David@ev3dev, ev3dev base image now has support for ppp linux module which means that we can use standard Linux Network Manager package to establish and manage a connection using a USB Cellular Dongle.
In this example, we used Huawei’s MS2131, but tutorial will work with any Dongle supported by Network Manager.

First of all, download the latest Ev3dev image on https://oss.jfrog.org/list/oss-snapshot-local/org/ev3dev/brickstrap/2017-06-27/
Please note that only Stretch version of the image is compatible with Network Manager.

Once you have the image, you can write to a SD card using Resin’s Etcher

As soon as your SD card is ready, add it to your LEGO EV3 and boot it up, as we’re going to use ssh access to install additional packages, you can follow ev3dev’s instruction on how to establish an initial internet connection for your EV3 setup, our preferred mode is Bluetooth.

Now that your EV3 is connected to the internet, let us start its configuration:
First of all, ssh into your EV3, the default password is ‘maker’ (Please replace 192.168.2.2 with your EV3 IP)

 

ssh robot@192.168.2.2

 

Once you’re connected to your EV3, install Network Manager and curl

 

sudo apt-get update && sudo apt-get install network-manager curl

 

This will take a little while, once the installation has been completed, you can now add a 3G Dongle configuration using Network Manager CLI

 

sudo nmcli con add type gsm ifname “*” con-name soracom apn
soracom.io user sora password sora

 

By default, Linux gives a lower priority to 3G connectivity, for this we’ve created a Network Manager route update script which you can install as follow

 

sudo curl -o /etc/NetworkManager/dispatcher.d/90.set_ppp_route_metric 
https://soracom-files.s3.amazonaws.com/handson/90.set_ppp_route_metric
sudo chmod +x /etc/NetworkManager/dispatcher.d/90.set_ppp_route_metric

 

That’s it, your LEGO EV3 is now ready to receive a 3G Dongle and connection, as Network Manager can be a bit sensitive to USB mode, we recommend restarting the device before plugging in your 3G Dongle.

After restart, you will now see a ppp0 interface which shows successful 3G connection

 

sudo ifconfig ppp0
ppp0: flags=4305 mtu 1500
inet 10.177.200.138 netmask 255.255.255.255 destination 0.0.0.0
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 7 bytes 106 (106.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 199 (199.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 

We find LEGO EV3 a very useful tool to build concept robots, adding in 3G connectivity greatly expands a variety of use cases, for example I built a EV3 Robot that can sense when mail is delivered in his house and carries it to my home office. Also a perfect companion when away from home as would sense if the door opens and send us an alert, I’m working on adding in a camera which will extend its function to looking around the house for us if needed. More on that use case in the coming months as the code will be tested and open sourced.

 For example this robot can interact with you via the IR Beacon. It supports a wide set of sensors that can easily be programmed or extended in the EV3Dev Image.
For example this robot can interact with you via the IR Beacon. It supports a wide set of sensors that can easily be programmed or extended in the EV3Dev Image.
 

If you’d like to learn more about IoT and meet our communities around the world, feel free to join our free Hands-On Workshops across Europe and the US, we list those on our Facebook Events page:
https://www.facebook.com/soracom.io/events/

You can also follow us on your preferred social networks for getting news about our events and more IoT tutorials!
Twitter: @alexis_susset and @SoracomIoT
LinkedIn: Soracom
Facebook: Soracom

 
Free SIM offer