Getting Started¶
These directions provide the steps for terminal access to your SNAPconnect E20 from either Windows, Linux or macOS.
Requirements¶
Connect USB to Host PC¶
You will need to connect the USB cable to the SNAPconnect E20 and determine which serial port was assigned. This process is different based on the OS.
Note
If you find that your host PC cannot connect to the SNAPconnect E20 over the USB connection, you may need to install the Silicon Labs CP210x USB to UART VCP drivers.
Windows¶
Check under “Ports” in the Device Manager and look for “Silicon Labs CP210x USB to UART Bridge (COMxx)”. The “COMxx” will indicate the serial port assigned (e.g., COM3, COM88).
Linux¶
The USB connection will be in the /dev
directory. Check the directory before and after connecting the USB cable
to identify the new ttyUSBx
where x
indicates the USB connection assigned (e.g., ttyUSB0). For example:
$ ls /dev/ttyUSB*
/dev/ttyUSB0
/dev/ttyUSB1 # <- new device
macOS¶
The USB connection will be in the /dev
directory. Check the directory before and after connecting the USB cable
to identify the new device. It is typically /dev/tty.SLAB_USBtoUART
.
$ ls /dev/tty.*
/dev/tty.Bluetooth
/dev/tty.SLAB_USBtoUART # <- new device
Terminal Access¶
Use a terminal emulator to communicate to the SNAPconnect E20’s serial port using the following serial port settings:
115200 baud
8 bits
No parity
1 stop bit
No flow control
For example, using cu in Linux:
$ sudo cu –l /dev/ttyUSB0 –s 115200
Another example, using screen in macOS:
$ sudo screen /dev/tty.SLAB_USBtoUART 115200
Login¶
Login to your SNAPconnect E20 gateway the first time using the default credentials:
Username: snap
Password: synapse
Note
You must change your password the first time you log in.
Connect to the Internet¶
The easiest way to do this is to make a wired connection to an Internet-connected router that supports DHCP. If you wish to configure your device for a static IP address or configure your Wi-Fi at this point, you may do so via the serial connection before making your Internet connection.
Update Python Development Libraries¶
Before starting work with the SNAPconnect E20, you’ll want to make sure you have the latest versions of the software installed on the unit. The gateway makes use of Python Development Libraries that are sometimes updated to add new functionality and correct bugs. You can update the version installed on your unit by running the command:
sudo apt-get update
sudo apt-get install python-dev
Set the Clock¶
First, you should specify the timezone in which your device will reside.
An easy way to do this is to use tzdata
, which allows you to select the general region,
and then select the specific zone for your location.
You can run it with the command:
sudo dpkg-reconfigure tzdata
Next, and only if the gateway’s date is not set (i.e. it is not connected to a network, so it does not
set the date from an NTP server, and the hardware clock has never been set), set the date manually.
The following example sets the date to April 20, 2017, at 12:30:59 p.m
.
sudo date --set "2017-04-30 12:30:59"
Sat Apr 30 12:30:59 CDT 2017
You can set the hardware clock from the system clock using the hwclock
command.
sudo hwclock -wu
Update SNAPconnect¶
The SNAPconnect software enables the connection from your SNAPconnect E20 device to the rest of your SNAP-powered network.
To update SNAPconnect, type the command:
sudo –H pip install --extra-index-url https://update.synapse-wireless.com/pypi/ --upgrade snapconnect
Update PyCrypto¶
The PyCrypto project is required for using AES128 encryption on your radio network.
To update PyCrypto type the command:
sudo –H pip install --extra-index-url https://update.synapse-wireless.com/pypi/ --upgrade pycrypto
That’s it! Your SNAPconnect E20 is now ready to work with your SNAP-powered network. Your Python program, using the SNAPconnect library, or the SNAPtoolbelt utilities, interfaces with the gateway’s SNAP module directly, and the rest of your nodes through that. You can also have full Internet access (either through a wired connection or a Wi-Fi connection).
You can find examples of other people’s efforts on the Synapse Wireless repository at GitHub: https://github.com/synapse-wireless.
The site includes sample projects for things like sending data collected by SNAP-powered nodes to cloud services, or a gateway-hosted web server. Download the code there, or fork it for your own projects. Better yet, contribute to the code base for other users.